Ubuntu 16.04 + Qemu + Raspberry Pi image triggered kernel panic
I tried to boot Raspbian OS on Qemu but failed!!
Ubuntu 16.04 + Qemu + Raspberry Pi image
Freeing unused kernel memory: 176K (c0530000 - c055c000) Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000004I googled it and resolved.. It need to edit raspberry pi's files in .img /etc/fstab by commenting out mmcblk entries and /etc/ld.so.preload old entries. OK, lets check .img file.
umiushi@umiushi-VirtualBox:~/Desktop/armv6_stretch$ file raspbian-stretch.img raspbian-stretch.img: DOS/MBR boot sector; partition 1 : ID=0xc, start-CHS (0x0,130,3), end-CHS (0x7,165,30), startsector 8192, 114688 sectors; partition 2 : ID=0x83, start-CHS (0x7,165,31), end-CHS (0x18e,97,19), startsector 122880, 6277120 sectorsThen, trying fdisk command. Which sector should be mounted..
umiushi@umiushi-VirtualBox:~/Desktop/armv6_stretch$ fdisk -l ./raspbian-stretch.img Disk ./raspbian-stretch.img: 3.1 GiB, 3276800000 bytes, 6400000 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x0009bf4f Device Boot Start End Sectors Size Id Type ./raspbian-stretch.img1 8192 122879 114688 56M c W95 FAT32 (LBA) ./raspbian-stretch.img2 122880 6399999 6277120 3G 83 LinuxOK, lets mount that. offset is 512*122880.
umiushi@umiushi-VirtualBox:~/Desktop/armv6_stretch$ sudo mount -v -o offset=62914560 -t ext4 ./raspbian-stretch.img /mnt/ [sudo] password for umiushi: mount: /dev/loop0 mounted on /mnt.
umiushi@umiushi-VirtualBox:~/Desktop/armv6_stretch$ ls /mnt/ bin dev home lost+found mnt proc run srv tmp var boot etc lib media opt root sbin sys usrWe can now edit files!! Commentig out as followings.. /mnt/etc/ld.so.preload
#/usr/lib/arm-linux-gnueabihf/libarmmem.so/mnt/etc/fstab
proc /proc proc defaults 0 0 #/dev/mmcblk0p1 /boot vfat defaults 0 2 #/dev/mmcblk0p2 / ext4 defaults,noatime 0 1 # a swapfile is not a swap partition, so no using swapon|off from here on, use dphys-swapfile swap[on|off] for that$ sudo umount /mnt and lets re-try execute qemu boot raspbian!!! $ ./start.sh
#!/bin/bash SSH_PORT=5022 EXTRA_PORT=6987 qemu-system-arm \ -cpu arm1176 \ -m 256 \ -redir tcp:${SSH_PORT}::22 \ -redir tcp:${EXTRA_PORT}::4444 \ -kernel kernel-qemu-4.4.34-jessie \ -M versatilepb \ -no-reboot \ -serial stdio \ -append "root=/dev/sda2 panic=1 rootfstype=ext4 rw console=ttyAMA0" \ -nographic -monitor /dev/null \ -hda ./raspbian-stretch.imgAnd another way, Ubuntu 18.04 does not happend that kernel panic error without editting fstab and ld.so.preload.
Comments
Post a Comment