libdevuansdk

common library for devuan's simple distro kits
git clone https://git.parazyd.org/libdevuansdk
Log | Files | Refs | Submodules | README | LICENSE

commit 5d2b73fe623926ba11a85bf191edabfcc0eb3274
parent 47933abaadf2597b52b2c0778d591749e2803d0c
Author: parazyd <parazyd@dyne.org>
Date:   Wed, 15 Jun 2016 17:57:48 +0200

install qemu-userstatic on bootstrap if applicable

Diffstat:
Mzlibs/bootstrap | 2+-
Mzlibs/helpers | 10----------
Mzlibs/qemu | 21++++++++++++++++++++-
3 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/zlibs/bootstrap b/zlibs/bootstrap @@ -44,7 +44,7 @@ bootstrap() { # Debootstrap stage 1 sudo debootstrap --foreign --arch ${arch} ${release} ${strapdir} ${mirror} - install-qemu + qemu_install_user # Debootstrap stage 2 sudo chroot ${strapdir} /debootstrap/debootstrap --second-stage diff --git a/zlibs/helpers b/zlibs/helpers @@ -37,16 +37,6 @@ escalate() { fi } -install-qemu() { - fn install-qemu - - [[ -n $enable_qemu ]] && { - sudo cp $qemu_bin $strapdir/usr/bin/ - act "installed qemu-user-static" - } - return 0 -} - findloopmapp() { fn findloopmapp req=(imgpath imgname workdir) diff --git a/zlibs/qemu b/zlibs/qemu @@ -21,8 +21,27 @@ # You should have received a copy of the GNU General Public License # along with this source code. If not, see <http://www.gnu.org/licenses/>. +qemu_install_user() { + fn qemu_install_user + local cputype="$1" + + [[ -n $enable_qemu ]] && { + act "installing qemu-arm-static" + sudo cp -vf /usr/bin/qemu-arm-static $strapdir/usr/bin/ + } + + [[ -n $cputype ]] && { + act "compiling qemu wrapper" + cp $R/src/qemu-wrapper.c /tmp/qemu-wrapper.c + sed -i -e 's/cortex-a8/'$cputype'/' /tmp/qemu-wrapper.c + gcc -static /tmp/qemu-wrapper.c -O3 -s /tmp/qemu-wrapper + sudo mv -vf /tmp/qemu-wrapper $strapdir/usr/bin/ + + print ':arm:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/qemu-wrapper:' | sudo tee /proc/sys/fs/binfmt_misc/register + } +} -qemu_make_img(){ +qemu_make_img() { fn qemu_make_img $@ local imgfile=${1:-"$H/builds/${name_default}_${arch}.img"}