rewrite workaround to support both qemu-arm 2.8.0 and below. Still recommended to upgrade
This commit is contained in:
parent
5714dfb32e
commit
4676084b68
|
|
@ -9,4 +9,6 @@ unzip raspbian_lite_latest.zip
|
||||||
sudo ./qemu-pi.sh *-raspbian-jessie-lite.img
|
sudo ./qemu-pi.sh *-raspbian-jessie-lite.img
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Note that it is recommended to use `qemu-arm` not older than 2.8.0 (see code)
|
||||||
|
|
||||||
See details on https://ownyourbits.com/2017/02/06/raspbian-on-qemu-with-network-access/
|
See details on https://ownyourbits.com/2017/02/06/raspbian-on-qemu-with-network-access/
|
||||||
|
|
|
||||||
13
qemu-pi.sh
13
qemu-pi.sh
|
|
@ -115,11 +115,16 @@ KERNEL=="sda", SYMLINK+="mmcblk0"
|
||||||
KERNEL=="sda?", SYMLINK+="mmcblk0p%n"
|
KERNEL=="sda?", SYMLINK+="mmcblk0p%n"
|
||||||
KERNEL=="sda2", SYMLINK+="root"
|
KERNEL=="sda2", SYMLINK+="root"
|
||||||
EOF
|
EOF
|
||||||
# Fix a well documented issue - the kernel panics as init exits;
|
|
||||||
|
# Work around a known issue with qemu-arm, versatile board and raspbian for at least qemu-arm < 2.8.0
|
||||||
|
# This works but modifies the image so it is recommended to upgrade QEMU
|
||||||
# Ref: http://stackoverflow.com/questions/38837606/emulate-raspberry-pi-raspbian-with-qemu
|
# Ref: http://stackoverflow.com/questions/38837606/emulate-raspberry-pi-raspbian-with-qemu
|
||||||
cat > tmpmnt/etc/ld.so.preload <<EOF
|
|
||||||
#/usr/lib/arm-linux-gnueabihf/libarmmem.so
|
QEMU_MAJOR=$( qemu-system-arm --version | head -1 | grep -oP '\d+.\d+.\d+' | cut -d. -f1 )
|
||||||
EOF
|
QEMU_MINOR=$( qemu-system-arm --version | head -1 | grep -oP '\d+.\d+.\d+' | cut -d. -f2 )
|
||||||
|
|
||||||
|
if [[ $QEMU_MAJOR == 2 ]] && [[ $QEMU_MINOR < 8 ]]; then sed -i '/^[^#].*libarmmem.so/s/^\(.*\)$/#\1/' tmpmnt/etc/ld.so.preload; fi
|
||||||
|
if [[ $QEMU_MAJOR < 2 ]] ; then sed -i '/^[^#].*libarmmem.so/s/^\(.*\)$/#\1/' tmpmnt/etc/ld.so.preload; fi
|
||||||
|
|
||||||
umount -l tmpmnt
|
umount -l tmpmnt
|
||||||
rmdir tmpmnt &>/dev/null
|
rmdir tmpmnt &>/dev/null
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue