Notebook

これは日々の作業を通して学んだことや毎日の生活で気づいたことをを記録しておく備忘録である。

HTML ファイル生成日時: 2024/12/21 11:44:57.596 (台灣標準時)

Raspberry Pi 3 で UEFI を使って NetBSD を起動させる方法

Raspberry Pi 3 で UEFI を使って NetBSD-10 を起動させるには、 https://washbear.neocities.org/rpi3-netbsd-uefi を参考にすればよいようでござる。

まず、 Raspberry Pi 3 用の UEFI ファームウェアをダウンロードするでござ る。


# cd /tmp
# wget https://github.com/pftf/RPi3/releases/download/v1.39/RPi3_UEFI_Firmware_v1.39.zip
# ls -lF RPi3_UEFI_Firmware_v1.39.zip 
-rw-r--r--  1 root  wheel  3798561 Jun  5  2023 RPi3_UEFI_Firmware_v1.39.zip
# unzip -l RPi3_UEFI_Firmware_v1.39.zip 
Archive:  RPi3_UEFI_Firmware_v1.39.zip
  Length     Date   Time    Name
 --------    ----   ----    ----
  2031616  06-05-23 18:59   RPI_EFI.fd
    52476  06-05-23 18:59   bootcode.bin
      252  06-05-23 18:52   config.txt
     7266  06-05-23 19:00   fixup.dat
  2977280  06-05-23 19:00   start.elf
     3593  06-05-23 18:52   Readme.md
    33851  06-05-23 19:00   bcm2710-rpi-3-b-plus.dtb
    33224  06-05-23 19:00   bcm2710-rpi-3-b.dtb
    30923  06-05-23 19:00   bcm2710-rpi-cm3.dtb
        0  06-05-23 18:52   firmware/
      979  06-05-23 18:52   firmware/Readme.txt
     2172  06-05-23 18:52   firmware/brcmfmac43455-sdio.txt
     9136  06-05-23 18:52   firmware/LICENCE_bin+clm_blob.txt
     4733  06-05-23 18:52   firmware/brcmfmac43430-sdio.clm_blob
     4733  06-05-23 18:52   firmware/brcmfmac43455-sdio.clm_blob
   638951  06-05-23 18:52   firmware/brcmfmac43455-sdio.bin
    11836  06-05-23 18:52   firmware/LICENSE_txt.txt
     1185  06-05-23 18:52   firmware/brcmfmac43430-sdio.txt
   421158  06-05-23 18:52   firmware/brcmfmac43430-sdio.bin
 --------                   -------
  6265364                   19 files

ダウンロードした ZIP アーカイブのファイルを展開するでござる。


# mkdir rpi3_firmware
# cd rpi3_firmware
# unzip ../RPi3_UEFI_Firmware_v1.39.zip 
Archive:  ../RPi3_UEFI_Firmware_v1.39.zip
 extracting: RPI_EFI.fd  
 extracting: bootcode.bin  
 extracting: config.txt  
 extracting: fixup.dat  
 extracting: start.elf  
 extracting: Readme.md  
 extracting: bcm2710-rpi-3-b-plus.dtb  
 extracting: bcm2710-rpi-3-b.dtb  
 extracting: bcm2710-rpi-cm3.dtb  
   creating: firmware/
 extracting: firmware/Readme.txt  
 extracting: firmware/brcmfmac43455-sdio.txt  
 extracting: firmware/LICENCE_bin+clm_blob.txt  
 extracting: firmware/brcmfmac43430-sdio.clm_blob  
 extracting: firmware/brcmfmac43455-sdio.clm_blob  
 extracting: firmware/brcmfmac43455-sdio.bin  
 extracting: firmware/LICENSE_txt.txt  
 extracting: firmware/brcmfmac43430-sdio.txt  
 extracting: firmware/brcmfmac43430-sdio.bin  
# ls -lF
total 5068
-rw-r--r--  1 root  wheel  2031616 Jun  5  2023 RPI_EFI.fd
-rw-r--r--  1 root  wheel     3593 Jun  5  2023 Readme.md
-rw-r--r--  1 root  wheel    33851 Jun  5  2023 bcm2710-rpi-3-b-plus.dtb
-rw-r--r--  1 root  wheel    33224 Jun  5  2023 bcm2710-rpi-3-b.dtb
-rw-r--r--  1 root  wheel    30923 Jun  5  2023 bcm2710-rpi-cm3.dtb
-rw-r--r--  1 root  wheel    52476 Jun  5  2023 bootcode.bin
-rw-r--r--  1 root  wheel      252 Jun  5  2023 config.txt
drwxr-xr-x  2 root  wheel      432 Aug 15 14:07 firmware/
-rw-r--r--  1 root  wheel     7266 Jun  5  2023 fixup.dat
-rw-r--r--  1 root  wheel  2977280 Jun  5  2023 start.elf

次に、 bootloader をダウンロードして、適切な場所に置くでござる。


# pwd
/tmp/rpi3_firmware
# mkdir -p EFI/BOOT
# cd EFI/BOOT
# wget https://nycdn.netbsd.org/pub/NetBSD-daily/netbsd-10/latest/evbarm-aarch64/installation/misc/bootaa64.efi
# ls -lF bootaa64.efi 
-rw-r--r--  1 root  wheel  196056 Aug 13 16:54 bootaa64.efi

それから、 boot.cfg ファイルを用意するでござる。


# cd ../../
# pwd
/tmp/rpi3_firmware
# vi boot.cfg
# cat boot.cfg
menu=Boot RPi3 normally:acpi off;rndseed /var/db/entropy-file;boot
menu=Boot RPi3 single user:acpi off;rndseed /var/db/entropy-file;boot -s
menu=Drop to boot prompt:prompt
default=1
timeout=10
clear=1

今度は、 NetBSD-10 のイメージファイルをダウンロードするでござる。


# cd /tmp
# wget https://nycdn.netbsd.org/pub/NetBSD-daily/netbsd-10/latest/evbarm-aarch64/binary/gzimg/arm64mbr.img.gz
# gunzip arm64mbr.img.gz
# ls -lF arm64mbr.img 
-rw-r--r--  1 daisuke  wheel  1582301184 Aug 15 13:10 arm64mbr.img

arm64mbr.img ファイルから、必要なファイルを取り出すでござる。


# vndconfig vnd0 /tmp/arm64mbr.img
# mount -t msdos /dev/vnd0e /mnt
# cd /mnt/dtb/broadcom
# ls -lF
total 158
-r-xr-xr-x  1 root  wheel  37735 Aug 13 08:54 bcm2711-rpi-4-b.dtb*
-r-xr-xr-x  1 root  wheel  37679 Aug 13 08:54 bcm2711-rpi-400.dtb*
-r-xr-xr-x  1 root  wheel  20741 Aug 13 08:54 bcm2837-rpi-3-a-plus.dtb*
-r-xr-xr-x  1 root  wheel  21610 Aug 13 08:54 bcm2837-rpi-3-b-plus.dtb*
-r-xr-xr-x  1 root  wheel  21142 Aug 13 08:54 bcm2837-rpi-3-b.dtb*
-r-xr-xr-x  1 root  wheel  20465 Aug 13 08:54 bcm2837-rpi-cm3-io3.dtb*
# cp -pi bcm2837-rpi-* /tmp/rpi3_firmware
# cd /tmp/rpi3_firmware
# ls -lF 
total 5168
drwxr-xr-x  3 root  wheel       48 Aug 15 15:09 EFI/
-rw-r--r--  1 root  wheel  2031616 Jun  5  2023 RPI_EFI.fd
-rw-r--r--  1 root  wheel     3593 Jun  5  2023 Readme.md
-rw-r--r--  1 root  wheel    33851 Jun  5  2023 bcm2710-rpi-3-b-plus.dtb
-rw-r--r--  1 root  wheel    33224 Jun  5  2023 bcm2710-rpi-3-b.dtb
-rw-r--r--  1 root  wheel    30923 Jun  5  2023 bcm2710-rpi-cm3.dtb
-r-xr-xr-x  1 root  wheel    20741 Aug 13 08:54 bcm2837-rpi-3-a-plus.dtb*
-r-xr-xr-x  1 root  wheel    21610 Aug 13 08:54 bcm2837-rpi-3-b-plus.dtb*
-r-xr-xr-x  1 root  wheel    21142 Aug 13 08:54 bcm2837-rpi-3-b.dtb*
-r-xr-xr-x  1 root  wheel    20465 Aug 13 08:54 bcm2837-rpi-cm3-io3.dtb*
-rw-r--r--  1 root  wheel      201 Aug 15 15:10 boot.cfg
-rw-r--r--  1 root  wheel    52476 Jun  5  2023 bootcode.bin
-rw-r--r--  1 root  wheel      252 Jun  5  2023 config.txt
drwxr-xr-x  2 root  wheel      432 Aug 15 15:09 firmware/
-rw-r--r--  1 root  wheel     7266 Jun  5  2023 fixup.dat
-rw-r--r--  1 root  wheel  2977280 Jun  5  2023 start.elf
# umount /mnt
# vndconfig -u vnd0

micro-SD カードに arm64mbr.img を書き込むでござる。


# dd if=/tmp/arm64mbr.img of=/dev/rsd0d bs=1m
1509+0 records in
1509+0 records out
1582301184 bytes transferred in 82.598 secs (19156652 bytes/sec)

micro-SD カード上の一部のファイルを入れ替えるでござる。


# mount -t msdos /dev/sd0e /mnt
# cd /mnt
# ls -lF
total 23151
drwxr-xr-x  1 root  wheel      1024 Aug 13 08:54 EFI/
-rwxr-xr-x  1 root  wheel      1594 Aug 13 08:54 LICENCE.broadcom*
-rwxr-xr-x  1 root  wheel     52476 Aug 13 08:54 bootcode.bin*
-rwxr-xr-x  1 root  wheel        21 Aug 13 08:54 cmdline.txt*
-rwxr-xr-x  1 root  wheel       155 Aug 13 08:54 config.txt*
drwxr-xr-x  1 root  wheel      1024 Aug 13 08:54 dtb/
-rwxr-xr-x  1 root  wheel      7269 Aug 13 08:54 fixup.dat*
-rwxr-xr-x  1 root  wheel      5412 Aug 13 08:54 fixup4.dat*
-rwxr-xr-x  1 root  wheel      3180 Aug 13 08:54 fixup4cd.dat*
-rwxr-xr-x  1 root  wheel      3180 Aug 13 08:54 fixup_cd.dat*
-rwxr-xr-x  1 root  wheel  16770784 Aug 13 08:54 netbsd.img*
-rwxr-xr-x  1 root  wheel   2979264 Aug 13 08:54 start.elf*
-rwxr-xr-x  1 root  wheel   2254944 Aug 13 08:54 start4.elf*
-rwxr-xr-x  1 root  wheel    808060 Aug 13 08:54 start4cd.elf*
-rwxr-xr-x  1 root  wheel    808060 Aug 13 08:54 start_cd.elf*
# rm -rf *
# cd /tmp/rpi3_firmware
# tar cf - * | (cd /mnt; tar xvf -)
x EFI/
x EFI/BOOT/
x EFI/BOOT/bootaa64.efi
x RPI_EFI.fd
x Readme.md
x bcm2710-rpi-3-b-plus.dtb
x bcm2710-rpi-3-b.dtb
x bcm2710-rpi-cm3.dtb
x bcm2837-rpi-3-a-plus.dtb
x bcm2837-rpi-3-b-plus.dtb
x bcm2837-rpi-3-b.dtb
x bcm2837-rpi-cm3-io3.dtb
x boot.cfg
x bootcode.bin
x config.txt
x firmware/
x firmware/Readme.txt
x firmware/brcmfmac43455-sdio.txt
x firmware/LICENCE_bin+clm_blob.txt
x firmware/brcmfmac43430-sdio.clm_blob
x firmware/brcmfmac43455-sdio.clm_blob
x firmware/brcmfmac43455-sdio.bin
x firmware/LICENSE_txt.txt
x firmware/brcmfmac43430-sdio.txt
x firmware/brcmfmac43430-sdio.bin
x fixup.dat
x start.elf
# cd /mnt
# ls -lF
total 5142
drwxr-xr-x  1 root  wheel     1024 Aug 15 15:18 EFI/
-rwxr-xr-x  1 root  wheel  2031616 Jun  5  2023 RPI_EFI.fd*
-rwxr-xr-x  1 root  wheel     3593 Jun  5  2023 Readme.md*
-rwxr-xr-x  1 root  wheel    33851 Jun  5  2023 bcm2710-rpi-3-b-plus.dtb*
-rwxr-xr-x  1 root  wheel    33224 Jun  5  2023 bcm2710-rpi-3-b.dtb*
-rwxr-xr-x  1 root  wheel    30923 Jun  5  2023 bcm2710-rpi-cm3.dtb*
-r-xr-xr-x  1 root  wheel    20741 Aug 13 08:54 bcm2837-rpi-3-a-plus.dtb*
-r-xr-xr-x  1 root  wheel    21610 Aug 13 08:54 bcm2837-rpi-3-b-plus.dtb*
-r-xr-xr-x  1 root  wheel    21142 Aug 13 08:54 bcm2837-rpi-3-b.dtb*
-r-xr-xr-x  1 root  wheel    20465 Aug 13 08:54 bcm2837-rpi-cm3-io3.dtb*
-rwxr-xr-x  1 root  wheel      201 Aug 15 15:10 boot.cfg*
-rwxr-xr-x  1 root  wheel    52476 Jun  5  2023 bootcode.bin*
-rwxr-xr-x  1 root  wheel      252 Jun  5  2023 config.txt*
drwxr-xr-x  1 root  wheel     1024 Aug 15 15:18 firmware/
-rwxr-xr-x  1 root  wheel     7266 Jun  5  2023 fixup.dat*
-rwxr-xr-x  1 root  wheel  2977280 Jun  5  2023 start.elf*

こうして準備した micro-SD カードを Raspberry Pi 3 に差し込んで電源を入 れれば、 NetBSD-10 が起動するでござる。

ただし、起動の過程で root device, dump device, file system, init path について入力を求められるでござる。 Return キーを押さないと起動してくれ ないので、不便でござる。

参考文献



Frequently accessed files

  1. Computer___Python/20220518_0.html
  2. Computer___Network/20230726_00.html
  3. Misc___Taiwan/20240207_00.html
  4. Computer___Network/20230516_00.html
  5. Computer___FreeBSD/20220621_0.html
  6. Computer___Python/20220715_0.html
  7. Computer___Network/20230508_00.html
  8. Food___Taiwan/20220429_0.html
  9. Computer___Network/20240130_00.html
  10. Computer___NetBSD/20220817_3.html
  11. Computer___Python/20220410_0.html
  12. Computer___Network/20240416_00.html
  13. Computer___NetBSD/20230119_00.html
  14. Computer___Debian/20210223_1.html
  15. Computer___Python/20221013_0.html
  16. Computer___Python/20210124_0.html
  17. Computer___NetBSD/20220428_0.html
  18. Computer___NetBSD/20220818_1.html
  19. Computer___NetBSD/20240101_02.html
  20. Science___Math/20220420_0.html
  21. Computer___Python/20240101_00.html
  22. Computer___NetBSD/20220808_0.html
  23. Computer___TeX/20230503_00.html
  24. Science___Astronomy/20220503_0.html
  25. Computer___NetBSD/20230515_00.html
  26. Computer___Network/20220413_1.html
  27. Computer___NetBSD/20210127_0.html
  28. Computer___TeX/20231107_00.html
  29. Computer___Python/20220816_1.html
  30. Computer___Python/20230717_01.html


HTML file generated by Kinoshita Daisuke.