Fix a well known ld-preload issue

Need to comment out the pathname in rootfs /etc/ld.so.preload as when uncommented the kernel panics on startup.
See http://stackoverflow.com/questions/38837606/emulate-raspberry-pi-raspbian-with-qemu as a reference.
This commit is contained in:
Kaiwan N Billimoria 2017-04-25 12:27:08 +05:30 committed by GitHub
parent d2b1754511
commit 5714dfb32e
1 changed files with 7 additions and 0 deletions

View File

@ -102,17 +102,24 @@ SECTOR2=$( fdisk -l $IMG | grep Linux | awk '{ print $2 }' )
OFFSET1=$(( SECTOR1 * 512 )) OFFSET1=$(( SECTOR1 * 512 ))
OFFSET2=$(( SECTOR2 * 512 )) OFFSET2=$(( SECTOR2 * 512 ))
# make 'boot' vfat partition available locally
mkdir -p tmpmnt mkdir -p tmpmnt
mount $IMG -o offset=$OFFSET1 tmpmnt mount $IMG -o offset=$OFFSET1 tmpmnt
touch tmpmnt/ssh # this enables ssh touch tmpmnt/ssh # this enables ssh
umount tmpmnt umount tmpmnt
# make 'linux' ext4 partition available locally
mount $IMG -o offset=$OFFSET2 tmpmnt mount $IMG -o offset=$OFFSET2 tmpmnt
cat > tmpmnt/etc/udev/rules.d/90-qemu.rules <<EOF cat > tmpmnt/etc/udev/rules.d/90-qemu.rules <<EOF
KERNEL=="sda", SYMLINK+="mmcblk0" 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;
# 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
EOF
umount -l tmpmnt umount -l tmpmnt
rmdir tmpmnt &>/dev/null rmdir tmpmnt &>/dev/null