install qemu-userstatic on bootstrap if applicable

This commit is contained in:
parazyd 2016-06-15 17:57:48 +02:00
parent 47933abaad
commit 5d2b73fe62
No known key found for this signature in database
GPG Key ID: F0CB28FCF78637DE
3 changed files with 21 additions and 12 deletions

View File

@ -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

View File

@ -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)

View File

@ -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"
qemu_make_img(){
[[ -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() {
fn qemu_make_img $@
local imgfile=${1:-"$H/builds/${name_default}_${arch}.img"}