CentOS 7: Build buildroot and run QEMU

This article will describe building buildroot and running it on QEMU.


1 Download buildroot

Download buildroot 2016.02 released version.

$ wget https://buildroot.org/downloads/buildroot-2016.02.tar.bz2

You can download also git repository's one.

$ git clone https://git.busybox.net/buildroot/

2 Build buildroot

Use qemu_x86_defconfig for qemu-system-i386.

Change tty1 to ttyS0 for using QEMU nographic option.

$ tar jxf buildroot-2016.02.tar.bz2
$ cd buildroot-2016.02/
$ make qemu_x86_defconfig
$ sed -i -e 's/BR2_TARGET_GENERIC_GETTY_PORT="tty1"/BR2_TARGET_GENERIC_GETTY_PORT="ttyS0"/g' .config
$ make

3 Run QEMU

Install qemu-system-x86 in EPEL repository.

$ sudo yum install -y epel-release
$ sudo yum update
$ sudo yum install -y qemu-system-x86

Run QEMU with kernel output/images/bzImage and rootfs output/images/rootfs.ext2.

Add noapic option to kernel because APIC initialization is errored.

$ qemu-system-i386 --kernel output/images/bzImage --hda \
output/images/rootfs.ext2 --nographic --append \
"console=ttyS0 root=/dev/sda noapic"
Linux version 4.4.1 (hiroom2@centos-7) (gcc version 4.9.3 (Buildroot
2016.02) ) #1 SMP Fri May 27 17:07:40 JST 2016
x86/fpu: Legacy x87 FPU detected.
x86/fpu: Using 'lazy' FPU context switches.
e820: BIOS-provided physical RAM map:
Welcome to Buildroot
buildroot login: root