2

I have compiled an embedded Linux with Buildroot for i386. I didn't edited much, just defaults. Now I want to run it under qemu. But the only thing I see is this: enter image description here

I'm running qemu with these options:

qemu-system-i386 -kernel vmlinux -hda rootfs.ext2 -m 256

Why this is happening? I have compiled like the example in the buildroot documentation.

  • 1
    Without details how/what you did or what the exact problem is we can't help you. Try to use the serial option for qemu to determine problem. You probably want to specify -append as an option to qemu if your kernel has no default parameters, e.g. you should at least specify the root partition. – Ulrich Dangel Jul 26 '12 at 19:42
  • what info I should provide so it can help you? kernel config file? uclibc config file? – Majid Azimi Jul 27 '12 at 7:56
2

Commands that just work

To make absolutely sure that it will work, we can make Buildroot build QEMU for us, and use the exact QEMU CLI provided by Buildroot at: https://github.com/buildroot/buildroot/blob/2019.05/board/qemu/x86_64/readme.txt

git clone https://github.com/buildroot/buildroot
cd buildroot
git checkout 2019.05
make qemu_x86_64_defconfig
printf '
BR2_CCACHE=y
BR2_PACKAGE_HOST_QEMU=y
BR2_PACKAGE_HOST_QEMU_LINUX_USER_MODE=n
BR2_PACKAGE_HOST_QEMU_SYSTEM_MODE=y
BR2_PACKAGE_HOST_QEMU_VDE2=y
' >> .config
make olddefconfig
time make BR2_JLEVEL="$(nproc)" HOST_QEMU_OPTS='--enable-sdl --with-sdlabi=2.0'
./output/host/bin/qemu-system-x86_64 \
  -M pc \
  -kernel output/images/bzImage \
  -drive file=output/images/rootfs.ext2,if=virtio,format=raw \
  -append "rootwait root=/dev/vda" \
  -net nic,model=virtio \
  -net user \
;

You are now left on a shell and you can login with username root (no password).

enter image description here

Note however that the default Buildroot build does not have an interesting GUI like X11 by default, as that is not the most common use case for this project. I have covered that at: How to install X11 on my own Linux Buildroot system?

But because Buildroot does not focus enough on the run part to my needs (more automation, more boot types, GDB step debug), I extended it with some extra scripts on this project: https://github.com/cirosantilli/linux-kernel-module-cheat

Other ISAs mentioned at: https://cirosantilli.com/linux-kernel-module-cheat/#buildroot-hello-world

Buildroot 2019.08 QEMU build failed because QEMU 3.1.1 release has a broken x86_64 build... QEMU 3.1.1 failed to build

Tested in Ubuntu 19.04.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.