leava@ubuntu-bionic:~$ wget https://buildroot.org/downloads/buildroot-2020.02.8.tar.gz
leava@ubuntu-bionic:~$ tar zxvf buildroot-2020.02.8.tar.gz && cd buildroot-2020.02.8
U-Boot 2020.04-00687-gd16d37bcd4 (Apr 29 2020 - 09:27:20 +0000)
DRAM: 948 MiB
RPI 3 Model B (0xa32082)
MMC: mmc@7e202000: 0, sdhci@7e300000: 1
Loading Environment from FAT... *** Warning - bad CRC, using default environment
In: serial
Out: vidconsole
Err: vidconsole
Net: No ethernet found.
starting USB...
Bus usb@7e980000: scanning bus usb@7e980000 for devices... 3 USB Device(s) found
scanning usb for storage devices... 0 Storage Device(s) found
Device Tree blobsをメモリ上に展開する。
U-Boot> dhcp ${fdt_addr_r} ${fdtfile}
Waiting for Ethernet connection... done.
BOOTP broadcast 1
DHCP client bound to address 172.16.1.2 (6 ms)
Using smsc95xx_eth device
TFTP from server 172.16.1.1 our IP address is 172.16.1.2
Filename 'bcm2837-rpi-3-b.dtb'.
Load address: 0x2600000
Loading: ################################################## 13.8 KiB
1 MiB/s
done
U-Boot> bootz ${kernel_addr_r} - ${fdt_addr_r}
Kernel image @ 0x080000 [ 0x000000 - 0x953200 ]
## Flattened Device Tree blob at 02600000
Booting using the fdt blob at 0x2600000
Using Device Tree in place at 02600000, end 02606725
Starting kernel ...
<<< snip >>>
Raspbian GNU/Linux 10 raspberrypi ttyS0
raspberrypi login:
おわりに
本記事では、U-Bootを利用してRaspberry Pi 3Bをネットワークブートする方法を紹介した。
U-Bootを利用したことで、Raspberry Pi 3Bで報告されている不具合を回避しながらも、SDカードの書き込み寿命の浪費を防ぐことができる。
U-Bootにはあらかじめスクリプトを書いておき、起動時に自動で実行する機構もあるので、そちらを利用するとより一層便利になる。
user@server:~$ sudo kpartx -a 2020-02-13-raspbian-buster-lite.img
user@server:~$ sudo mount /dev/mapper/loop0p1 /mnt/boot
user@server:~$ sudo mount /dev/mapper/loop0p2 /mnt/rootfs
$ git diff
diff --git a/Vagrantfile b/Vagrantfileindex 1c4ee1e..bb5337f 100644--- a/Vagrantfile+++ b/Vagrantfile@@ -45,17 +45,20 @@ Vagrant.configure("2") do |config|
# argument is a set of non-required options.
# config.vm.synced_folder "../data", "/vagrant_data"
+ config.ssh.forward_x11 = true+
# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
#
- # config.vm.provider "virtualbox" do |vb|- # # Display the VirtualBox GUI when booting the machine+ config.vm.provider "virtualbox" do |vb|+ # Display the VirtualBox GUI when booting the machine
# vb.gui = true
- #- # # Customize the amount of memory on the VM:- # vb.memory = "1024"- # end++ # Customize the amount of memory on the VM:+ vb.cpus = 8+ vb.memory = "16384"+ end++ config.disksize.size = '200GB'
#
# View the documentation for the provider you are using for more
# information on available options.
vagrant@ubuntu-bionic:~$ git clone git://git.yoctoproject.org/poky
vagrant@ubuntu-bionic:~$ cd poky/
vagrant@ubuntu-bionic:~/poky$ git fetch --tag
vagrant@ubuntu-bionic:~/poky$ git tag
vagrant@ubuntu-bionic:~/poky$ git checkout tags/yocto-3.0 -b yocto-3.0
ビルド環境の初期化する。
vagrant@ubuntu-bionic:~/poky$ source oe-init-build-env
You had no conf/local.conf file. This configuration file has therefore been
created for you with some default values. You may wish to edit it to, for
example, select a different MACHINE (target hardware). See conf/local.conf
for more information as common configuration options are commented.
You had no conf/bblayers.conf file. This configuration file has therefore been
created for you with some default values. To add additional metadata layers
into your configuration please add entries to conf/bblayers.conf.
The Yocto Project has extensive documentation about OE including a reference
manual which can be found at:
http://yoctoproject.org/documentation
For more information about OpenEmbedded see their website:
http://www.openembedded.org/
### Shell environment set up for builds. ###
You can now run 'bitbake <target>'
Common targets are:
core-image-minimal
core-image-sato
meta-toolchain
meta-ide-support
You can also run generated qemu images with a command like 'runqemu qemux86'
Other commonly useful commands are:
- 'devtool' and 'recipetool' handle common recipe tasks
- 'bitbake-layers' handles common layer tasks
- 'oe-pkgdata-util' handles common target package tasks
構成ファイルlocal.confを修正する。
diff --git a/build/conf/local.conf b/build/conf/local.confindex 2e0bb41e64..1941917154 100644--- a/build/conf/local.conf+++ b/build/conf/local.conf@@ -18,7 +18,7 @@
# of emulated machines available which can boot and run in the QEMU emulator:
#
#MACHINE ?= "qemuarm"
-#MACHINE ?= "qemuarm64"+MACHINE ?= "qemuarm64"
#MACHINE ?= "qemumips"
#MACHINE ?= "qemumips64"
#MACHINE ?= "qemuppc"
@@ -265,3 +265,6 @@ PACKAGECONFIG_append_pn-qemu-system-native = " sdl"
# track the version of this file when it was generated. This can safely be ignored if
# this doesn't mean anything to you.
CONF_VERSION = "1"
++BB_NUMBER_THREADS = '8'+PARALLEL_MAKE = '-j 8'
vagrant@ubuntu-bionic:~/poky/build $ ls -l tmp/deploy/sdk/
total 135232
-rw-r--r-- 2 vagrant vagrant 11909 Jun 25 10:28 poky-glibc-x86_64-meta-toolchain-cortexa57-qemuarm64-toolchain-4.0.host.manifest
-rwxr-xr-x 2 vagrant vagrant 138233871 Jun 25 10:30 poky-glibc-x86_64-meta-toolchain-cortexa57-qemuarm64-toolchain-4.0.sh
-rw-r--r-- 2 vagrant vagrant 1730 Jun 25 10:28 poky-glibc-x86_64-meta-toolchain-cortexa57-qemuarm64-toolchain-4.0.target.manifest
-rw-r--r-- 2 vagrant vagrant 225233 Jun 25 10:28 poky-glibc-x86_64-meta-toolchain-cortexa57-qemuarm64-toolchain-4.0.testdata.json
ツールチェインをインストールする。
vagrant@ubuntu-bionic:~/poky/build$ ./tmp/deploy/sdk/poky-glibc-x86_64-meta-toolchain-cortexa57-qemuarm64-toolchain-4.0.sh
Poky (Yocto Project Reference Distro) SDK installer version 4.0
===============================================================
Enter target directory for SDK (default: /opt/poky/4.0):
You are about to install the SDK to "/opt/poky/4.0". Proceed [Y/n]? Y
Extracting SDK...............................................done
Setting it up...done
SDK has been successfully set up and is ready to be used.
Each time you wish to use the SDK in a new shell session, you need to source the environment setup script e.g.
$ . /opt/poky/4.0/environment-setup-cortexa57-poky-linux
root@kbuild:/# cd work
root@kbuild:/work# git clone git://git.busybox.net/busybox
root@kbuild:/work# cd busybox
root@kbuild:/work/busybox# git checkout remotes/origin/1_32_stable
ビルド用の設定を修正する。最低限の動作を目指しているので、デフォルトからCONFIG_STATICを有効にするのみでよい。(CONFIG_STATICはSetting->Build static binary (no shared libs)を有効にすることで設定される)
root@kbuild:/work/busybox# make defconfig
root@kbuild:/work/busybox# make menuconfig