素人が初めてbuildrootに触れる
buildrootとは組み込みLinuxを構築できる仕組み(?)みたいなもの。カスタマイズされたLinuxを作成できるようだ。下記サイトなどを参照した。
ターゲット
ここでは、Intel PC(x64)とRaspberryPiとをターゲットにLinuxを作成してみた。
Build
buildroot自体をGet
$ git clone git://git.busybox.net/buildroot buildroot
ターゲットを選択
$ make list-defconfigs
とすると、Buildできるターゲットが表示される。
x64
$ make list-defconfigs | grep pc_x86_64
pc_x86_64_bios_defconfig - Build for pc_x86_64_bios
pc_x86_64_efi_defconfig - Build for pc_x86_64_efi
「pc_x86_64_efi_defconfig」を選択。
RaspberryPi
$ make list-defconfigs | grep raspberry
raspberrypi0_defconfig - Build for raspberrypi0
raspberrypi0w_defconfig - Build for raspberrypi0w
raspberrypi2_defconfig - Build for raspberrypi2
raspberrypi3_64_defconfig - Build for raspberrypi3_64
raspberrypi3_defconfig - Build for raspberrypi3
raspberrypi3_qt5we_defconfig - Build for raspberrypi3_qt5we
raspberrypi4_64_defconfig - Build for raspberrypi4_64
raspberrypi4_defconfig - Build for raspberrypi4
raspberrypi_defconfig - Build for raspberrypi
raspberrypicm4io_64_defconfig - Build for raspberrypicm4io_64
raspberrypicm4io_defconfig - Build for raspberrypicm4io
raspberrypizero2w_defconfig - Build for raspberrypizero2w
所持するRaspberryPiはとても古いので、「raspberrypi_defconfig」を選択。
ターゲット選択およびmenuconfig
$ make pc_x86_64_efi_defconfig
$ make menuconfig
または
$ make raspberrypi_defconfig
$ make menuconfig
とする。”make menuconfig”を実施すると、下記が表示される。
ここでは、そのまま”Exit”すればよい。
本当のBuild
$ make
Buildが終わると、x64(Intel)では
./output/images/disk.img
にイメージが、RaspberryPiでは
./output/images/sdcard.img
にイメージができあがる。
SDカードに書き込み
$ sudo dd if=./output/images/イメージファイル of=/dev/sdc bs=4M conv=fsync
により、SDカードに書き込み。”/dev/sdc”は環境に応じて変わる。
起動
x64(Intel)
RaspberryPi
とりあえず、成功。カスタマイズは別の機会に。
EOF