ODROID C2 - n-hys/illumos-gate GitHub Wiki

ODROID-C2

The Hardkernel ODROID-C2 is a low cost development board.
Currently, GbE, uSD, UART and RTC Shield are supported on OpenSolaris. eMMC is not supported.

How to make a bootable uSD

Getting the source

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
git clone -b hardkernel/odroidc2-v2015.01 https://github.com/n-hys/u-boot.git u-boot-odroid
git clone https://github.com/n-hys/meson-tools.git

Building and flashing

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
uboot_odroid_dir=${base_dir}/u-boot-odroid
atf_dir=${base_dir}/arm-trusted-firmware
fiptool_dir=${atf_dir}/tools/fiptool
mesontools_dir=${base_dir}/meson-tools
platform_dir=/data/proto/root_aarch64/platform/SUNW,meson-gxbb

# u-boot
CROSS_COMPILE=${illumos_dir}/usr/src/cross/bin/aarch64-solaris2.11- \
    ARCH=arm \
    make -C ${uboot_dir} odroid-c2_defconfig || exit 1

CROSS_COMPILE=${illumos_dir}/usr/src/cross/bin/aarch64-solaris2.11- \
    ARCH=arm \
    make -C ${uboot_dir} -j || exit 1

# arm trusted firmware
CROSS_COMPILE=${illumos_dir}/usr/src/cross/bin/aarch64-solaris2.11- \
    make -C ${atf_dir} -j DEBUG=0 PLAT=gxbb bl31 || exit 1
make -C ${fiptool_dir} || exit 1

# meson-tools
make -C ${mesontools_dir} || exit 1

${fiptool_dir}/fiptool create --align 16384 \
    --scp-fw ${uboot_odroid_dir}/fip/gxb/bl30.bin \
    --amlogic-scp-task-fw ${uboot_odroid_dir}/fip/gxb/bl301.bin \
    --soc-fw  ${atf_dir}/build/gxbb/release/bl31.bin \
    --nt-fw  ${uboot_dir}/u-boot.bin \
    ${base_dir}/fip.bin

cat ${uboot_odroid_dir}/fip/gxb/bl2.package ${base_dir}/fip.bin > ${base_dir}/boot_new.bin
${mesontools_dir}/amlbootsig ${base_dir}/boot_new.bin ${base_dir}/u-boot.img
dd if=${base_dir}/u-boot.img of=${base_dir}/u-boot.gxbb bs=512 skip=96

# 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 mcopy -i ${vfat_img} ${platform_dir}/inetboot ::inetboot
MTOOLS_SKIP_CHECK=1 mcopy -i ${vfat_img} ${platform_dir}/meson-gxbb-odroidc2.dtb ::meson-gxbb-odroidc2.dtb

dd conv=notrunc if=${vfat_img} of=${DISK} bs=512 seek=${VFAT_START}

BL1=${uboot_odroid_dir}/sd_fuse/bl1.bin.hardkernel
dd if=$BL1 of=$DISK conv=fsync bs=1 count=442
dd if=$BL1 of=$DISK conv=fsync bs=512 skip=1 seek=1
dd if=${base_dir}/u-boot.gxbb of=$DISK conv=fsync bs=512 seek=97

Booting from network

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
GXBB:BL1:08dafd:0a8993;FEAT:EDFC318C;POC:3;RCY:0;EMMC:800;NAND:81;SD:0;READ:0;CHK:0;
TE: 303437
no sdio debug board detected 

BL2 Built : 11:44:26, Nov 25 2015. 
gxb gfb13a3b-c2 - jcao@wonton

Board ID = 8
set vcck to 1100 mv
set vddee to 1050 mv
CPU clk: 1536MHz
DDR channel setting: DDR0 Rank0+1 same
DDR0: 2048MB(auto) @ 912MHz(2T)-13
DataBus test pass!
AddrBus test pass!
Load fip header from SD, src: 0x0000c200, des: 0x01400000, size: 0x000000b0
Load bl30 from SD, src: 0x00010200, des: 0x01000000, size: 0x00009ef0
Sending bl30........................................OK. 
Run bl30...
Load bl301 from SD, src: 0x0001c200, des: 0x01000000, size: 0x000018c0
Wait bl30...Done
Sending bl301.......OK. 
Run bl301...
D, src: 0x00020200, des: 0x10100000, size: 0x00007200


--- UART initialized after reboot ---
[Reset cause: uLoad bl33 from SD, src: 0x00028200, des: 0x01000000, size: 0x000a19b0
nknown]
[Image: unknown, amlogic_v1.1.3046-00db630-dirty 2016-08-31 09:24:14 tao.zeng@droid04]
bl30: check_permit, count is 1
bl30: check_permit: ok!
chipid: ef be ad de d f0 ad ba ef be ad de not ES chip
[0.418228 Inits done]
secure task start!
high task start!
low task start!
NOTICE:  BL31: v2.6(release):v2.5-1362-g37fdbf565
NOTICE:  BL31: Built : 00:30:40, Aug 18 2022


U-Boot 2022.01-00003-g2f4cb3bb0f-dirty (Aug 19 2022 - 13:48:12 +0900) odroid-c2

Model: Hardkernel ODROID-C2
SoC:   Amlogic Meson GXBB (S905) Revision 1f:b (0:1)
DRAM:  2 GiB
MMC:   mmc@72000: 0, mmc@74000: 1
Loading Environment from FAT... OK
In:    serial
Out:   serial
Err:   serial
Net:   eth0: ethernet@c9410000
=> run enet_boot
Speed: 1000, full duplex
BOOTP broadcast 1
DHCP client bound to address 192.168.5.53 (0 ms)
Using ethernet@c9410000 device
TFTP from server 192.168.5.35; our IP address is 192.168.5.53
Filename '/root_aarch64/platform/SUNW,meson-gxbb/inetboot'.
Load address: 0x8080000
Loading: ###########################################
	 10.7 MiB/s
done
Bytes transferred = 628704 (997e0 hex)
Speed: 1000, full duplex
Using ethernet@c9410000 device
TFTP from server 192.168.5.35; our IP address is 192.168.5.53
Filename '/root_aarch64/platform/SUNW,meson-gxbb/meson-gxbb-odroidc2.dtb'.
Load address: 0x8008000
Loading: #
	 5.2 MiB/s
done
Bytes transferred = 10898 (2a92 hex)
## Booting kernel from Legacy Image at 08080000 ...
   Image Name:   OpenSolaris
   Image Type:   AArch64 Linux Kernel Image (uncompressed)
   Data Size:    628640 Bytes = 613.9 KiB
   Load Address: 11000000
   Entry Point:  11000000
   Verifying Checksum ... OK
## Flattened Device Tree blob at 08008000
   Booting using the fdt blob at 0x8008000
   Loading Kernel Image
   Loading Device Tree to 000000007bf46000, end 000000007bf4ba91 ... OK
Cannot setup simplefb: node not found

Starting kernel ...

phys memory add 0000000000000000 - 000000007fffffff
memory resv 0000000000000000 - 0000000000ffffff
memory resv 0000000010000000 - 00000000101fffff
memory resv 000000007fe5b000 - 000000007fffffff
bootargs=-D /soc/ethernet@c9410000
bootpath=/soc/ethernet@c9410000
vdev_probe error
rootnex_map_regspec: c9410000 -> ffff0000c9410000
rootnex_map_regspec: c8834540 -> ffff0000c8834540
WARNING: Cannot mount /system/boot
rootnex_map_regspec: c81004c0 -> ffff0000c81004c0
cpu0: ARM 64bit MIDR=410fd034 REVIDR=00000080
cpu0: Amlogic S905
cpu1: ARM 64bit MIDR=410fd034 REVIDR=00000080
cpu1: Amlogic S905
cpu1 initialization complete - online
cpu2: ARM 64bit MIDR=410fd034 REVIDR=00000080
cpu2: Amlogic S905
cpu2 initialization complete - online
cpu3: ARM 64bit MIDR=410fd034 REVIDR=00000080
cpu3: Amlogic S905
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)
May 24 17:44:48 svc.startd[100003]: svc:/system/filesystem/usr:default: Method "/lib/svc/method/fs-usr" failed with exit status 95.
May 24 17:44:48 svc.startd[100003]: system/filesystem/usr:default failed fatally: transitioned to maintenance (see 'svcs -xv' for details)
Hostname: meson
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

May 24 17:47:08 su: 'su root' succeeded for root on /dev/console
The illumos Project	SunOS Development	Aug. 20, 2022
illumos development build: naoyuki
root@meson:~# 

Partitioning

Create a Solaris partition and create slices for the Solaris partition.
You can work with shell when booting from the network.

Createing partitions

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: 

Createing slices

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

Booting from uSD

In U-Boot, run run mmc_boot command.

boot.log
GXBB:BL1:08dafd:0a8993;FEAT:EDFC318C;POC:3;RCY:0;EMMC:800;NAND:81;SD:0;READ:0;CHK:0;
TE: 285335
no sdio debug board detected 

BL2 Built : 11:44:26, Nov 25 2015. 
gxb gfb13a3b-c2 - jcao@wonton

Board ID = 8
set vcck to 1100 mv
set vddee to 1050 mv
CPU clk: 1536MHz
DDR channel setting: DDR0 Rank0+1 same
DDR0: 2048MB(auto) @ 912MHz(2T)-13
DataBus test pass!
AddrBus test pass!
Load fip header from SD, src: 0x0000c200, des: 0x01400000, size: 0x000000b0
Load bl30 from SD, src: 0x00010200, des: 0x01000000, size: 0x00009ef0
Sending bl30........................................OK. 
Run bl30...
Load bl301 from SD, src: 0x0001c200, des: 0x01000000, size: 0x000018c0
Wait bl30...Done
Sending bl301.......OK. 
Run bl301...
31 from SD, src: 0x00020200, des: 0x10100000, size: 0x00007200


--- UART initialized after reboot ---
[Reset cause: uLoad bl33 from SD, src: 0x00028200, des: 0x01000000, size: 0x000a19a0
nknown]
[Image: unknown, amlogic_v1.1.3046-00db630-dirty 2016-08-31 09:24:14 tao.zeng@droid04]
bl30: check_permit, count is 1
bl30: check_permit: ok!
chipid: ef be ad de d f0 ad ba ef be ad de not ES chip
[0.400211 Inits done]
secure task start!
high task start!
low task start!
NOTICE:  BL31: v2.6(release):v2.5-1362-g37fdbf565
NOTICE:  BL31: Built : 00:30:40, Aug 18 2022


U-Boot 2022.01-00004-gbf745ec874 (Aug 20 2022 - 23:08:17 +0900) odroid-c2

Model: Hardkernel ODROID-C2
SoC:   Amlogic Meson GXBB (S905) Revision 1f:b (0:1)
DRAM:  2 GiB
MMC:   mmc@72000: 0, mmc@74000: 1
Loading Environment from FAT... OK
In:    serial
Out:   serial
Err:   serial
Net:   eth0: ethernet@c9410000
=> run mmc_boot
628704 bytes read in 29 ms (20.7 MiB/s)
10898 bytes read in 2 ms (5.2 MiB/s)
## Booting kernel from Legacy Image at 08080000 ...
   Image Name:   OpenSolaris
   Image Type:   AArch64 Linux Kernel Image (uncompressed)
   Data Size:    628640 Bytes = 613.9 KiB
   Load Address: 11000000
   Entry Point:  11000000
   Verifying Checksum ... OK
## Flattened Device Tree blob at 08008000
   Booting using the fdt blob at 0x8008000
   Loading Kernel Image
   Loading Device Tree to 000000007bf46000, end 000000007bf4ba91 ... OK
Cannot setup simplefb: node not found

Starting kernel ...

phys memory add 0000000000000000 - 000000007fffffff
memory resv 0000000000000000 - 0000000000ffffff
memory resv 0000000010000000 - 00000000101fffff
memory resv 000000007fe5b000 - 000000007fffffff
bootargs=-D /soc/sd@d0072000
bootpath=/soc/sd@d0072000
zfs_lookup error /platform/SUNW,meson-gxbb/boot_archive
zfs_lookup error /platform/hardkernel,odroid-c2/boot_archive
zfs_lookup error /platform/amlogic,meson-gxbb/boot_archive
vdev_probe error
rootnex_map_regspec: d0072000 -> ffff0000d0072000
WARNING: Cannot mount /system/boot
rootnex_map_regspec: c81004c0 -> ffff0000c81004c0
cpu0: ARM 64bit MIDR=410fd034 REVIDR=00000080
cpu0: Amlogic S905
cpu1: ARM 64bit MIDR=410fd034 REVIDR=00000080
cpu1: Amlogic S905
cpu1 initialization complete - online
cpu2: ARM 64bit MIDR=410fd034 REVIDR=00000080
cpu2: Amlogic S905
cpu2 initialization complete - online
cpu3: ARM 64bit MIDR=410fd034 REVIDR=00000080
cpu3: Amlogic S905
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
NOTICE:  BL31: Reboot reason: 0x1
GXBB:BL1:08dafd:0a8993;FEAT:EDFC318C;POC:3;RCY:0;EMMC:800;NAND:81;SD:0;READ:0;CHK:0;
TE: 105470
no sdio debug board detected 

BL2 Built : 11:44:26, Nov 25 2015. 
gxb gfb13a3b-c2 - jcao@wonton

Board ID = 8
set vcck to 1100 mv
set vddee to 1050 mv
CPU clk: 1536MHz
DDR channel setting: DDR0 Rank0+1 same
DDR0: 2048MB(auto) @ 912MHz(2T)-13
DataBus test pass!
AddrBus test pass!
Load fip header from SD, src: 0x0000c200, des: 0x01400000, size: 0x000000b0
Load bl30 from SD, src: 0x00010200, des: 0x01000000, size: 0x00009ef0
Sending bl30........................................OK. 
Run bl30...
Load bl301 from SD, src: 0x0001c200, des: 0x01000000, size: 0x000018c0
Wait bl30...Done
Sending bl301.......OK. 
Run bl301...
l31 from SD, src: 0x00020200, des: 0x10100000, size: 0x00007200


--- UART initialized after reboot ---
[Reset cause: uLoad bl33 from SD, src: 0x00028200, des: 0x01000000, size: 0x000a19a0
nknown]
[Image: unknown, amlogic_v1.1.3046-00db630-dirty 2016-08-31 09:24:14 tao.zeng@droid04]
bl30: check_permit, count is 1
bl30: check_permit: ok!
chipid: ef be ad de d f0 ad ba ef be ad de not ES chip
[0.220267 Inits done]
secure task start!
high task start!
low task start!
NOTICE:  BL31: v2.6(release):v2.5-1362-g37fdbf565
NOTICE:  BL31: Built : 00:30:40, Aug 18 2022


U-Boot 2022.01-00004-gbf745ec874 (Aug 20 2022 - 23:08:17 +0900) odroid-c2

Model: Hardkernel ODROID-C2
SoC:   Amlogic Meson GXBB (S905) Revision 1f:b (0:1)
DRAM:  2 GiB
MMC:   mmc@72000: 0, mmc@74000: 1
Loading Environment from FAT... OK
In:    serial
Out:   serial
Err:   serial
Net:   eth0: ethernet@c9410000
=> run mmc_boot
628704 bytes read in 28 ms (21.4 MiB/s)
10898 bytes read in 1 ms (10.4 MiB/s)
## Booting kernel from Legacy Image at 08080000 ...
   Image Name:   OpenSolaris
   Image Type:   AArch64 Linux Kernel Image (uncompressed)
   Data Size:    628640 Bytes = 613.9 KiB
   Load Address: 11000000
   Entry Point:  11000000
   Verifying Checksum ... OK
## Flattened Device Tree blob at 08008000
   Booting using the fdt blob at 0x8008000
   Loading Kernel Image
   Loading Device Tree to 000000007bf46000, end 000000007bf4ba91 ... OK
Cannot setup simplefb: node not found

Starting kernel ...

phys memory add 0000000000000000 - 000000007fffffff
memory resv 0000000000000000 - 0000000000ffffff
memory resv 0000000010000000 - 00000000101fffff
memory resv 000000007fe5b000 - 000000007fffffff
bootargs=-D /soc/sd@d0072000
bootpath=/soc/sd@d0072000
zfs_lookup error /platform/SUNW,meson-gxbb/boot_archive
zfs_lookup error /platform/hardkernel,odroid-c2/boot_archive
zfs_lookup error /platform/amlogic,meson-gxbb/boot_archive
vdev_probe error
rootnex_map_regspec: d0072000 -> ffff0000d0072000
WARNING: Cannot mount /system/boot
rootnex_map_regspec: c81004c0 -> ffff0000c81004c0
cpu0: ARM 64bit MIDR=410fd034 REVIDR=00000080
cpu0: Amlogic S905
cpu1: ARM 64bit MIDR=410fd034 REVIDR=00000080
cpu1: Amlogic S905
cpu1 initialization complete - online
cpu2: ARM 64bit MIDR=410fd034 REVIDR=00000080
cpu2: Amlogic S905
cpu2 initialization complete - online
cpu3: ARM 64bit MIDR=410fd034 REVIDR=00000080
cpu3: Amlogic S905
cpu3 initialization complete - online
Hostname: unknown

unknown console login: May 24 18:24:49 unknown rootnex: rootnex_map_regspec: c9410000 -> ffff0000c9410000
May 24 18:24:49 unknown rootnex: rootnex_map_regspec: c8834540 -> ffff0000c8834540

unknown console login: root
May 24 18:25:30 unknown login: Solaris_audit getaddrinfo(unknown) failed[node name or service name not known]: Error 0
May 24 18:25:30 unknown login: Solaris_audit adt_get_local_address failed, no Audit IP address available, faking loopback and error: Network is down
May 24 18:25:30 unknown login: pam_unix_cred: cannot load ttyname: Network is down, continuing.
May 24 18:25:30 unknown login: ROOT LOGIN /dev/console
The illumos Project     SunOS Development       Aug. 20, 2022
illumos development build: naoyuki
root@unknown:~# 
⚠️ **GitHub.com Fallback** ⚠️