AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
How to emulate linux kernel11/11/2023 ![]() ![]() UPDATED after comment: What should I copy to disk image to be able to init the system ? I tried to play with parameters but I can't find a solution to be able to fully boot and have a bash prompt instead of initramdisk one. I'm very new to qemu and I think I'm not so far from having my emulated system working but I'm not able to go further. I'm experiencing a kernel panic but I don't know what is causing it. However /sbin/init is present on the disk image and is a symbolic link to /lib/systemd/systemd. It seems that kernel is not able to find a valib init script. However as you can see in boot trace, /scripts/local-block is still beeing run several times and take up to 10 seconds before passing to next step. Precising -fda floppy.img with floppy.img being a raw zeroed image of 1ko suppress floppy related error messages and save up to 20 seconds at boot. ![]() ![]() I tried to run qemu with -no-fd-bootchk option but it didn't change anything The kernel gave up after 30 try so it's not a critical issue but it's slowing down the boot sequence by 30 seconds. [ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000100Īt boot it seems that the kernel tries to read from a floppy device which doesn't exist or is not readable. Kernel Offset: 0x16600000 from 0xffffffff81000000 (relocation range: 0xffffffff80000000-0xffffffffbfffffff) Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1 Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000100 Run-init: /sbin/init: No such file or directory done.īegin: Running /scripts/init-bottom. Opts: (null)īegin: Running /scripts/local-bottom. EXT4-fs (sda): mounted filesystem with ordered data mode. Gave up waiting for suspend/resume deviceīegin: Will now check root file system. done.īegin: Running /scripts/local-block. clocksource: tsc: mask: 0xffffffffffffffff max_cycles: 0x30e5dd94d34, max_idle_ns: 440795304975 nsīegin: Waiting for suspend/resume device. tsc: Refined TSC clocksource calibration: 3392.292 MHz done.īegin: Running /scripts/local-premount. done.īegin: Running /scripts/init-premount. $ qemu-system-x86_64 -k fr -kernel /boot/vmlinuz-$(uname -r) -initrd /boot/initrd.img-$(uname -r) -hda vm/vm-image.raw -append "initrd=/boot/initrd.img-$(uname -r) root=/dev/sda rw console=ttyS0" -nographic Boot trace Kernel boot sequence īegin: Loading essential drivers. I'm now trying to boot the emulated operating system but I'm having some trouble configuring it. Ln -s /lib/systemd/systemd /mnt/sbin/init Mkdir /mnt/dev /mnt/lib /mnt/proc /mnt/root /mnt/run /mnt/sbin /mnt/sys I have then populated the disk image as follow: mount vm-image.raw /mnt To create the virtual machine, I have created a 500M raw image with dd if=/dev/zero of=vm-image.raw bs=1M count=512Īnd then format it to ext4 using mkfs.ext4 vm-image.raw On my work station I'm using Debian 9 running with kernel 4.9.0. ![]() To do so I would like to emulate my own operating system using qemu to avoid crashing my development OS each time I make a mistake into the kernel device code. I was able to make a "simple" implementation and I would like to go further into what block sub-system offers. I'm currently beginning kernel programming by implementing a block device driver. ![]()
0 Comments
Read More
Leave a Reply. |