Table of Contents
1 環境
以下の様な仮想マシン環境で実行しています。
CPUコア数 1 RAM 1GB スワップ 1GB ストレージ 80GB
2 buildrootのソースコード取得
ここでは2016年2月にリリースされたものを利用します。
$ wget https://buildroot.org/downloads/buildroot-2016.02.tar.bz2
リポジトリのものを使うには以下のとおりです。
$ git clone https://git.busybox.net/buildroot/
3 buildrootのビルド
qemu-system-i386で利用可能なデフォルト設定ファイルのqemu_x86_defconfigを使用します。
QEMUのnographicオプションの為に、コンソールの出力先をtty1(Ctrl-Alt-F1で表示される画面)からttyS0(シリアル)に変更します。
$ 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
本環境ではビルドに30分ほど掛かりました。
ビルド生成物を含むbuildroot-2016.02の容量は3.3GBほどです。
4 QEMUの起動
aptでx86向けのqemu-system-i386をインストールします。
$ sudo apt-get install -y qemu-system-i386
out/images配下にカーネルイメージのbzImageとルートファイルシステムイメージのrootfs.ext2が生成されます。
$ qemu-system-i386 –kernel output/images/bzImage –hda output/images/rootfs.ext2 –nographic –append “console=tty1 root=/dev/sda”WARNING: Image format was not specified for’output/images/rootfs.ext2′ and probing guessed raw. Automatically detecting the format is dangerous for rawimages, write operations on block 0 will be restricted. Specify the ‘raw’ format explicitly to remove therestrictions.Linux version 4.4.1 (hiroom2@ubuntu-16) (gcc version 4.9.3 (Buildroot2016.02) ) #1 SMP Tue May 10 08:23:43 JST 2016×86/fpu: Legacy x87 FPU detected.x86/fpu: Using ‘lazy’ FPU context switches.e820: BIOS-provided physical RAM map:BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff] usableBIOS-e820: [mem 0x000000000009fc00-0x000000000009ffff] reserved<snip>Welcome to Buildrootbuildroot login: root#