Raspberry Pi 4 Model B - n-hys/illumos-gate GitHub Wiki
The Raspberry Pi 4 Model B is the popular single-board computer.
Currently, GbE, uSD and UART are supported on OpenSolaris.
git clone -b osport/v2022.03 https://github.com/n-hys/arm-trusted-firmware.git
git clone -b osport/v2022.01 https://github.com/n-hys/u-boot.git
Download the firmware from https://github.com/raspberrypi/firmware/tags.
The following versions have been confirmed to work.
- firmware-1.20220120
Before building firmware, you must build OpenSolaris first.
The following additional packages are required to build firmware on openSUSE Leap 15.4.
zypper install mtools dosfstools swig python3-devel python3-setuptools util-linux
Refer to the following for building firmware and flashing.
You should change the "/dev/sdX" to your uSD drive.
build.sh
DISK=/dev/sdX
base_dir=$(cd $(dirname $0); pwd)
illumos_dir=${base_dir}/illumos-gate
uboot_dir=${base_dir}/u-boot
atf_dir=${base_dir}/arm-trusted-firmware
rpi_firmware_dir=${base_dir}/firmware-1.20210805
platform_dir=/data/proto/root_aarch64/platform/SUNW,rpi4
# arm trusted firmware
CROSS_COMPILE=${illumos_dir}/usr/src/cross/bin/aarch64-solaris2.11- \
make -C ${atf_dir} -j DEBUG=1 PLAT=rpi4 RPI4_PERI_HIGH=1 bl31 || exit 1
# u-boot
CROSS_COMPILE=${illumos_dir}/usr/src/cross/bin/aarch64-solaris2.11- \
ARCH=arm \
make -C ${uboot_dir} rpi_4_defconfig || exit 1
CROSS_COMPILE=${illumos_dir}/usr/src/cross/bin/aarch64-solaris2.11- \
ARCH=arm \
make -C ${uboot_dir} -j || exit 1
# flash
nsectors=`LANG=C fdisk -l ${DISK}|grep '^Disk /dev/'|grep -o "[[:digit:]]* sectors"|grep -o "[[:digit:]]*"`
if test x"$nsectors" = x; then
exit 1
fi
if ((${nsectors} <= 16777216)); then
VFAT_START=4096
VFAT_SIZE=131072
CYLINDER_SIZE=$((32 * 128))
else
VFAT_START=12544
VFAT_SIZE=125440
CYLINDER_SIZE=$((56 * 224))
fi
vfat_img=${base_dir}/vfat.img
SOLARIS_START=$((${VFAT_START} + ${VFAT_SIZE}))
DISK_END=$(((${nsectors} / ${CYLINDER_SIZE}) * ${CYLINDER_SIZE}))
SOLARIS_SIZE=$((${DISK_END} - ${SOLARIS_START}))
sfdisk --no-reread ${DISK} << EOF
${VFAT_START},${VFAT_SIZE},c
${SOLARIS_START},${SOLARIS_SIZE},bf,*
EOF
dd if=/dev/zero of=${vfat_img} bs=512 count=${VFAT_SIZE}
/sbin/mkfs.vfat ${vfat_img}
MTOOLS_SKIP_CHECK=1 mmd -i ${vfat_img} ::overlays
MTOOLS_SKIP_CHECK=1 mcopy -i ${vfat_img} ${atf_dir}/build/rpi4/debug/bl31.bin ::bl31.bin
MTOOLS_SKIP_CHECK=1 mcopy -i ${vfat_img} ${uboot_dir}/u-boot.bin ::u-boot.bin
MTOOLS_SKIP_CHECK=1 mcopy -i ${vfat_img} ${rpi_firmware_dir}/boot/bootcode.bin ::bootcode.bin
MTOOLS_SKIP_CHECK=1 mcopy -i ${vfat_img} ${rpi_firmware_dir}/boot/fixup4cd.dat ::fixup4cd.dat
MTOOLS_SKIP_CHECK=1 mcopy -i ${vfat_img} ${rpi_firmware_dir}/boot/start4cd.elf ::start4cd.elf
MTOOLS_SKIP_CHECK=1 mcopy -i ${vfat_img} ${rpi_firmware_dir}/boot/bcm2711-rpi-4-b.dtb ::bcm2711-rpi-4-b.dtb
for f in ${rpi_firmware_dir}/boot/overlays/*
do
echo $f
dest=::overlays/`basename $f`
echo $dest
MTOOLS_SKIP_CHECK=1 mcopy -i ${vfat_img} $f $dest
done
cat > config.txt << EOF
gpu_mem=16
start_file=start4cd.elf
fixup_file=fixup4cd.dat
enable_uart=1
arm_64bit=1
enable_gic=1
armstub=bl31.bin
kernel=u-boot.bin
dtoverlay=mmc
dtoverlay=disable-bt
dtoverlay=disable-wifi
force_turbo=1
EOF
MTOOLS_SKIP_CHECK=1 mcopy -i ${vfat_img} config.txt ::config.txt
MTOOLS_SKIP_CHECK=1 mcopy -i ${vfat_img} ${platform_dir}/inetboot ::inetboot
dd conv=notrunc if=${vfat_img} of=${DISK} bs=512 seek=${VFAT_START}
sync
In U-Boot, run run enet_boot
command.
When booting from network, some errors occurr but you can ignore errors.
You can login as root without using password.
boot.log
NOTICE: BL31: v2.6(debug):v2.5-1362-g37fdbf565
NOTICE: BL31: Built : 01:37:39, Mar 13 2022
INFO: Changed device tree to advertise PSCI.
INFO: ARM GICv2 driver initialized
INFO: BL31: Initializing runtime services
INFO: BL31: cortex_a72: CPU workaround for 859971 was applied
WARNING: BL31: cortex_a72: CPU workaround for 1319367 was missing!
INFO: BL31: cortex_a72: CPU workaround for cve_2017_5715 was applied
INFO: BL31: cortex_a72: CPU workaround for cve_2018_3639 was applied
INFO: BL31: Preparing for EL3 exit to normal world
INFO: Entry point address = 0x80000
INFO: SPSR = 0x3c9
U-Boot 2022.01-00004-gbf745ec874 (Aug 20 2022 - 23:44:24 +0900)
DRAM: 3.9 GiB
RPI 4 Model B (0xc03112)
MMC: mmc@7e340000: 0
Loading Environment from FAT... OK
In: serial
Out: serial
Err: serial
Net: eth0: ethernet@7d580000
PCIe BRCM: link up, 5.0 Gbps x1 (SSC)
starting USB...
Bus xhci_pci: Register 5000420 NbrPorts 5
Starting the controller
USB XHCI 1.00
scanning bus xhci_pci for devices... 2 USB Device(s) found
scanning usb for storage devices... 0 Storage Device(s) found
U-Boot> run enet_boot
BOOTP broadcast 1
DHCP client bound to address 192.168.5.58 (0 ms)
Using ethernet@7d580000 device
TFTP from server 192.168.5.35; our IP address is 192.168.5.58
Filename '/root_aarch64/platform/SUNW,rpi4/inetboot'.
Load address: 0x80000
Loading: ################################################## 588.5 KiB
13.1 MiB/s
done
Bytes transferred = 602584 (931d8 hex)
## Booting kernel from Legacy Image at 00080000 ...
Image Name: OpenSolaris
Image Type: AArch64 Linux Kernel Image (uncompressed)
Data Size: 602520 Bytes = 588.4 KiB
Load Address: 00080000
Entry Point: 00080000
Verifying Checksum ... OK
## Flattened Device Tree blob at 02600000
Booting using the fdt blob at 0x2600000
Loading Kernel Image
Using Device Tree in place at 0000000002600000, end 0000000002612fff
Starting kernel ...
phys memory add 0000000000000000 - 000000003e5fffff
phys memory add 0000000040000000 - 00000000fbffffff
memory resv 0000000000000000 - 000000000007ffff
memory resv 000000003f175000 - 000000003f175fff
bootargs=-D /scb/ethernet@7d580000
bootpath=/scb/ethernet@7d580000
vdev_probe error
rootnex_map_regspec: fd580000 -> ffff0000fd580000
WARNING: Cannot mount /system/boot
rootnex_map_regspec: fe201000 -> ffff0000fe201000
cpu0: ARM 64bit MIDR=410fd083 REVIDR=00000000
cpu0: BCM2711
cpu1: ARM 64bit MIDR=410fd083 REVIDR=00000000
cpu1: BCM2711
cpu1 initialization complete - online
cpu2: ARM 64bit MIDR=410fd083 REVIDR=00000000
cpu2: BCM2711
cpu2 initialization complete - online
cpu3: ARM 64bit MIDR=410fd083 REVIDR=00000000
cpu3: BCM2711
cpu3 initialization complete - online
Loading smf(5) service descriptions: 138/138
ERROR: svc:/system/filesystem/usr:default failed to mount remount (see 'svcs -x' for details)
Nov 10 07:01:30 svc.startd[100003]: svc:/system/filesystem/usr:default: Method "/lib/svc/method/fs-usr" failed with exit status 95.
Nov 10 07:01:30 svc.startd[100003]: system/filesystem/usr:default failed fatally: transitioned to maintenance (see 'svcs -xv' for details)
Hostname: rpi4
Requesting System Maintenance Mode
(See /lib/svc/share/README for more information.)
Console login service(s) cannot run
Enter user name for system maintenance (control-d to bypass): root
Enter root password (control-d to bypass):
single-user privilege assigned to root on /dev/console.
Entering System Maintenance Mode
Nov 10 07:02:26 su: 'su root' succeeded for root on /dev/console
The illumos Project SunOS Development Aug. 20, 2022
illumos development build: naoyuki
root@rpi4:~#
Create a Solaris partition and create slices for the Solaris partition.
You can work with shell when booting from the network.
Two partitions are required.
Create FAT partition and Solaris in an MBR partition table.
You need to mark the solaris partition as active.
fdisk /dev/rdsk/c1t0d0p0
Total disk size is 3847 cylinders
Cylinder size is 4096 (512 byte) blocks
Cylinders
Partition Status Type Start End Length %
========= ====== ============ ===== === ====== ===
1 Ext Win95 1 32 32 1
2 Active Solaris2 33 3846 3814 99
SELECT ONE OF THE FOLLOWING:
1. Create a partition
2. Specify the active partition
3. Delete a partition
4. Change between Solaris and Solaris2 Partition IDs
5. Edit/View extended partitions
6. Exit (update disk configuration and exit)
7. Cancel (exit without updating disk configuration)
Enter Selection:
format -> partition
You need to mark the tag of the root slice as root.
format
partition> p
Current partition table (original):
Total disk cylinders available: 3814 + 0 (reserved cylinders)
Part Tag Flag Cylinders Size Blocks
0 root wm 1 - 3813 7.45GB (3813/0/0) 15618048
1 unassigned wm 0 0 (0/0/0) 0
2 backup wu 0 - 3813 7.44GB (3814/0/0) 15622144
3 unassigned wm 0 0 (0/0/0) 0
4 unassigned wm 0 0 (0/0/0) 0
5 unassigned wm 0 0 (0/0/0) 0
6 unassigned wm 0 0 (0/0/0) 0
7 unassigned wm 0 0 (0/0/0) 0
8 boot wu 0 - 0 2.00MB (1/0/0) 4096
9 unassigned wm 0 0 (0/0/0) 0
In U-Boot, run run mmc_boot
command.
boot.log
NOTICE: BL31: v2.6(debug):v2.5-1362-g37fdbf565
NOTICE: BL31: Built : 01:37:39, Mar 13 2022
INFO: Changed device tree to advertise PSCI.
INFO: ARM GICv2 driver initialized
INFO: BL31: Initializing runtime services
INFO: BL31: cortex_a72: CPU workaround for 859971 was applied
WARNING: BL31: cortex_a72: CPU workaround for 1319367 was missing!
INFO: BL31: cortex_a72: CPU workaround for cve_2017_5715 was applied
INFO: BL31: cortex_a72: CPU workaround for cve_2018_3639 was applied
INFO: BL31: Preparing for EL3 exit to normal world
INFO: Entry point address = 0x80000
INFO: SPSR = 0x3c9
U-Boot 2022.01-00004-gbf745ec874-dirty (Aug 23 2022 - 00:32:40 +0900)
DRAM: 3.9 GiB
RPI 4 Model B (0xc03112)
MMC: mmc@7e340000: 0
Loading Environment from FAT... Unable to read "uboot.env" from mmc0:1... In: serial
Out: serial
Err: serial
Net: eth0: ethernet@7d580000
PCIe BRCM: link up, 5.0 Gbps x1 (SSC)
starting USB...
Bus xhci_pci: Register 5000420 NbrPorts 5
Starting the controller
USB XHCI 1.00
scanning bus xhci_pci for devices... 2 USB Device(s) found
scanning usb for storage devices... 0 Storage Device(s) found
U-Boot> run mmc_boot
607192 bytes read in 38 ms (15.2 MiB/s)
## Booting kernel from Legacy Image at 00080000 ...
Image Name: OpenSolaris
Image Type: AArch64 Linux Kernel Image (uncompressed)
Data Size: 607128 Bytes = 592.9 KiB
Load Address: 00080000
Entry Point: 00080000
Verifying Checksum ... OK
## Flattened Device Tree blob at 02600000
Booting using the fdt blob at 0x2600000
Loading Kernel Image
Using Device Tree in place at 0000000002600000, end 0000000002612fff
Starting kernel ...
phys memory add 0000000000000000 - 000000003e5fffff
phys memory add 0000000040000000 - 00000000fbffffff
memory resv 0000000000000000 - 000000000007ffff
memory resv 000000003f175000 - 000000003f175fff
bootargs=-D /emmc2bus/mmc@7e340000
bootpath=/emmc2bus/mmc@7e340000
zfs_lookup error /platform/SUNW,rpi4/boot_archive
zfs_lookup error /platform/raspberrypi,4-model-b/boot_archive
zfs_lookup error /platform/brcm,bcm2711/boot_archive
vdev_probe error
rootnex_map_regspec: fe340000 -> ffff0000fe340000
WARNING: Cannot mount /system/boot
rootnex_map_regspec: fe201000 -> ffff0000fe201000
cpu0: ARM 64bit MIDR=410fd083 REVIDR=00000000
cpu0: BCM2711
cpu1: ARM 64bit MIDR=410fd083 REVIDR=00000000
cpu1: BCM2711
cpu1 initialization complete - online
cpu2: ARM 64bit MIDR=410fd083 REVIDR=00000000
cpu2: BCM2711
cpu2 initialization complete - online
cpu3: ARM 64bit MIDR=410fd083 REVIDR=00000000
cpu3: BCM2711
cpu3 initialization complete - online
Loading smf(5) service descriptions: 138/138
Hostname: unknown
WARNING: Reboot required.
The system has updated the cache of files (boot archive) that
is used during the early boot sequence. To avoid booting and
running the system with the previously out-of-sync version of
these files, the system will be restarted.
syncing file systems... done
INFO: PSCI Power Domain Map:
INFO: Domain Node : Level 1, parent_node 4294967295, State ON (0x0)
INFO: CPU Node : MPID 0x0, parent_node 0, State ON (0x0)
INFO: CPU Node : MPID 0x1, parent_node 0, State ON (0x0)
INFO: CPU Node : MPID 0x2, parent_node 0, State ON (0x0)
INFO: CPU Node : MPID 0x3, parent_node 0, State ON (0x0)
INFO: rpi3: PSCI_SYSTEM_RESET: Invoking watchdog reset
NOTICE: BL31: v2.6(debug):v2.5-1362-g37fdbf565
NOTICE: BL31: Built : 01:37:39, Mar 13 2022
INFO: Changed device tree to advertise PSCI.
INFO: ARM GICv2 driver initialized
INFO: BL31: Initializing runtime services
INFO: BL31: cortex_a72: CPU workaround for 859971 was applied
WARNING: BL31: cortex_a72: CPU workaround for 1319367 was missing!
INFO: BL31: cortex_a72: CPU workaround for cve_2017_5715 was applied
INFO: BL31: cortex_a72: CPU workaround for cve_2018_3639 was applied
INFO: BL31: Preparing for EL3 exit to normal world
INFO: Entry point address = 0x80000
INFO: SPSR = 0x3c9
U-Boot 2022.01-00004-gbf745ec874-dirty (Aug 23 2022 - 00:32:40 +0900)
DRAM: 3.9 GiB
RPI 4 Model B (0xc03112)
MMC: mmc@7e340000: 0
Loading Environment from FAT... OK
In: serial
Out: serial
Err: serial
Net: eth0: ethernet@7d580000
PCIe BRCM: link up, 5.0 Gbps x1 (SSC)
starting USB...
Bus xhci_pci: Register 5000420 NbrPorts 5
Starting the controller
USB XHCI 1.00
scanning bus xhci_pci for devices... 2 USB Device(s) found
scanning usb for storage devices... 0 Storage Device(s) found
U-Boot> run mmc_boot
607192 bytes read in 37 ms (15.6 MiB/s)
## Booting kernel from Legacy Image at 00080000 ...
Image Name: OpenSolaris
Image Type: AArch64 Linux Kernel Image (uncompressed)
Data Size: 607128 Bytes = 592.9 KiB
Load Address: 00080000
Entry Point: 00080000
Verifying Checksum ... OK
## Flattened Device Tree blob at 02600000
Booting using the fdt blob at 0x2600000
Loading Kernel Image
Using Device Tree in place at 0000000002600000, end 0000000002612fff
Starting kernel ...
phys memory add 0000000000000000 - 000000003e5fffff
phys memory add 0000000040000000 - 00000000fbffffff
memory resv 0000000000000000 - 000000000007ffff
memory resv 000000003f175000 - 000000003f175fff
bootargs=-D /emmc2bus/mmc@7e340000
bootpath=/emmc2bus/mmc@7e340000
zfs_lookup error /platform/SUNW,rpi4/boot_archive
zfs_lookup error /platform/raspberrypi,4-model-b/boot_archive
zfs_lookup error /platform/brcm,bcm2711/boot_archive
vdev_probe error
rootnex_map_regspec: fe340000 -> ffff0000fe340000
WARNING: Cannot mount /system/boot
rootnex_map_regspec: fe201000 -> ffff0000fe201000
cpu0: ARM 64bit MIDR=410fd083 REVIDR=00000000
cpu0: BCM2711
cpu1: ARM 64bit MIDR=410fd083 REVIDR=00000000
cpu1: BCM2711
cpu1 initialization complete - online
cpu2: ARM 64bit MIDR=410fd083 REVIDR=00000000
cpu2: BCM2711
cpu2 initialization complete - online
cpu3: ARM 64bit MIDR=410fd083 REVIDR=00000000
cpu3: BCM2711
cpu3 initialization complete - online
Hostname: unknown
unknown console login: root
Nov 10 07:00:48 unknown login: Solaris_audit getaddrinfo(unknown) failed[node name or service name not known]: Error 0
Nov 10 07:00:48 unknown login: Solaris_audit adt_get_local_address failed, no Audit IP address available, faking loopback and error: Network is down
Nov 10 07:00:48 unknown login: pam_unix_cred: cannot load ttyname: Network is down, continuing.
Nov 10 07:00:48 unknown login: ROOT LOGIN /dev/console
The illumos Project SunOS Development Aug. 22, 2022
illumos development build: naoyuki
root@unknown:~#