Skip to content

Commit

Permalink
odroid/hc4: new configuration package
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Stewart <[email protected]>
  • Loading branch information
paralin committed Jun 8, 2022
1 parent 09fba4e commit 180a53a
Show file tree
Hide file tree
Showing 24 changed files with 441 additions and 7 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ Here are the boards/systems currently supported:
| [Odroid C4] | [odroid/c4] | ✔ U-Boot 2022.04 | ✔ tb-5.18.1 | |
| [Odroid HC1] | [odroid/xu] | ✔ U-Boot 2017.07 | ✔ tb-5.18.1 | ⚠ Obsolete |
| [Odroid HC2] | [odroid/xu] | ✔ U-Boot 2017.07 | ✔ tb-5.18.1 | ✔ Tested |
| [Odroid HC4] | [odroid/hc4] | ✔ U-Boot 2022.07 | ✔ tb-5.18.1 | |
| [Odroid N2]+ | [odroid/n2] | ✔ U-Boot 2022.04 | ✔ tb-5.18.1 | ✔ Tested |
| [Odroid M1] | [odroid/m1] | ✔ U-Boot 2017.09 | ✔ tb-5.18.1 | |
| [Odroid U] | [odroid/u] | ✔ U-Boot 2022.04 | ✔ tb-5.18.1 | ⚠ Obsolete |
Expand Down Expand Up @@ -203,6 +204,7 @@ Here are the boards/systems currently supported:
[Odroid C4]: https://wiki.odroid.com/odroid-c4/odroid-c4
[Odroid HC1]: https://www.hardkernel.com/shop/odroid-hc1-home-cloud-one/
[Odroid HC2]: https://www.hardkernel.com/shop/odroid-hc2-home-cloud-two/
[Odroid HC4]: https://www.hardkernel.com/shop/odroid-hc4/
[Odroid M1]: https://wiki.odroid.com/odroid-m1/odroid-m1
[Odroid N2]: https://wiki.odroid.com/odroid-n2/odroid-n2
[Odroid U]: https://wiki.odroid.com/old_product/odroid-x_u_q/odroid_u3/odroid-u3
Expand Down Expand Up @@ -248,6 +250,7 @@ Here are the boards/systems currently supported:
[odroid/c2]: ./configs/odroid
[odroid/c4]: ./configs/odroid
[odroid/m1]: ./configs/odroid
[odroid/hc4]: ./configs/odroid
[odroid/n2]: ./configs/odroid
[odroid/u]: ./configs/odroid
[odroid/xu]: ./configs/odroid
Expand Down
20 changes: 17 additions & 3 deletions configs/odroid/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Reference:
Set the comma-separated `SKIFF_CONFIG` variable:

```sh
$ export SKIFF_CONFIG=odroid/xu
$ export SKIFF_CONFIG=odroid/n2,skiff/core
$ make configure # configure the system
$ make compile # build the system
```
Expand Down Expand Up @@ -46,6 +46,7 @@ tested by the developers unless otherwise noted.
| [c2] | odroid/c2 | |
| [c4] | odroid/c4 | Reboot issue |
| [hc2] | odroid/xu | |
| [hc4] | odroid/hc4 | Reboot issue |
| [m1] | odroid/m1 | |
| [n2] | odroid/n2 | Includes n2+ |
| [u] + u2 | odroid/u | Discontinued |
Expand All @@ -60,6 +61,7 @@ tested by the developers unless otherwise noted.
[m1]: https://www.hardkernel.com/shop/odroid-m1-with-8gbyte-ram/
[c2]: https://www.hardkernel.com/shop/odroid-c2/
[c4]: https://www.hardkernel.com/shop/odroid-c4/
[hc4]: https://www.hardkernel.com/shop/odroid-hc4/

## SD Card Compatibility

Expand All @@ -78,14 +80,26 @@ Some SD cards may not work as well with the Odroid hardware.

## Bootup Process

**If using the n2, set the boot switch to MMC.**

All Odroid boards use u-boot. U-boot is flashed to the beginning of the SD card,
before the first partition. It loads and executes a boot.ini configuration.

Note: there may be some binary bootloader blobs used that are provided by the
vendor & signed, and cannot be compiled by Skiff, depending on the board.

## Odroid N2

**If using the n2, set the boot switch to MMC.**

## Odroid HC4

**If using the hc4, petitboot must be bypassed.**

See the details in the [odroid/hc4](./hc4) docs.

On default, the HC4 boots from SPI, which contains petitboot. If the black
button on the bottom of the device (the "boot select" switch) is pressed, the
board will use u-boot from the MicroSD card.

## Acknowledgments

Thank you to [tobetter] for patching / testing the latest Linux kernels for the
Expand Down
2 changes: 1 addition & 1 deletion configs/odroid/c4/metadata/description
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Base configuration for the ODROID C4 board (aarch64).
Base configuration for the ODROID C4 board.
2 changes: 1 addition & 1 deletion configs/odroid/c4/resources/boot-scripts/boot.txt
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ if test "${hdmi_forcergb}" = "1"; then setenv hdmitx "${hdmitx},forcergb"; fi
if test "${disable_vu7}" = "false"; then setenv hid_quirks "usbhid.quirks=0x0eef:0x0005:0x0004"; fi

# Boot Args
setenv bootargs "coherent_pool=2M ${bootmem} ${condev} ${amlogic} no_console_suspend fsck.repair=yes net.ifnames=0 elevator=noop hdmimode=${hdmimode} cvbsmode=576cvbs max_freq_a55=${max_freq_a55} maxcpus=${maxcpus} voutmode=${voutmode} ${cmode} disablehpd=${disablehpd} cvbscable=${cvbscable} overscan=${overscan} ${hid_quirks} monitor_onoff=${monitor_onoff} ${hdmitx} ${bootsplash} sdrmode=${sdrmode} enable_wol=${enable_wol}"
setenv bootargs "coherent_pool=2M ${bootmem} ${condev} ${amlogic} no_console_suspend fsck.repair=yes net.ifnames=0 elevator=noop hdmimode=${hdmimode} cvbsmode=576cvbs max_freq_a55=${max_freq_a55} maxcpus=${maxcpus} voutmode=${voutmode} ${cmode} disablehpd=${disablehpd} cvbscable=${cvbscable} overscan=${overscan} ${hid_quirks} monitor_onoff=${monitor_onoff} ${hdmitx} sdrmode=${sdrmode} enable_wol=${enable_wol}"

fatload mmc ${devnum}:1 ${kernel_addr_r} Image
fatload mmc ${devnum}:1 ${initramfs_addr_r} rootfs.cpio.uboot
Expand Down
4 changes: 2 additions & 2 deletions configs/odroid/common/buildroot/kernel
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ BR2_LINUX_KERNEL_CUSTOM_TARBALL=y
# BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION="$(call github,skiffos,linux,22e1b9192fcd3407eea8ceca4e14dc3291ff6af1)/linux-skiff-odroid-5.18.0-rc5-r1.tar.gz"
# BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_17=y

# skiff-odroid-5.18.y-4
BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION="$(call github,skiffos,linux,d302139224b22e1363532d001b9b82b460cc51b1)/linux-skiff-odroid-5.18.1-r1.tar.gz"
# skiff-odroid-5.18.y-5
BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION="$(call github,skiffos,linux,ce44f4f5c25366a6a89ab482bf433d1e6ebcb6c0)/linux-skiff-odroid-5.18.1-r2.tar.gz"
BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_17=y

BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=y
Expand Down
60 changes: 60 additions & 0 deletions configs/odroid/hc4/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Odroid HC4

This configuration targets the Odroid HC4.

**Petitboot must be bypassed to boot this board.**

See the [common config](../) for more information.

## Getting Started

Set the comma-separated `SKIFF_CONFIG` variable:

```sh
$ export SKIFF_CONFIG=odroid/hc4,skiff/core
$ make configure # configure the system
$ make compile # build the system
```

Once the build is complete, we will flash to a MicroSD card to boot. You will
need to `sudo bash` for this on most systems.

```sh
$ sudo bash # switch to root
$ export ODROID_SD=/dev/sdz # make sure this is right! (usually sdb)
$ make cmd/odroid/common/format # tell skiff to format the device
$ make cmd/odroid/common/install # tell skiff to install the os
```

You only need to run the `format` step once. It will create the partition table.
The `install` step will overwrite the current Skiff installation on the card,
taking care to not touch any persistent data (from the persist partition). It's
safe to upgrade Skiff independently from your persistent data.

You will then need to disable Petitboot:

## Disabling Petitboot

On default, the HC4 boots from SPI, which contains petitboot. If the black
button on the bottom of the device (the "boot select" switch) is pressed, the
board will use u-boot from the MicroSD card.

To permanently disable petitboot:

1. Attach a display & keyboard to the device.
2. Power on the board.
3. Go to "Exit to shell" and enter these commands:

```sh
flash_eraseall /dev/mtd0
flash_eraseall /dev/mtd1
flash_eraseall /dev/mtd2
flash_eraseall /dev/mtd3
```

Alternatively, boot to SkiffOS using the black button on the bottom of the
device while booting, then use the following command to erase the SPI:

```sh
flash_erase /dev/mtd0 0 0
```
3 changes: 3 additions & 0 deletions configs/odroid/hc4/buildroot/arch
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
BR2_aarch64=y
BR2_cortex_a55=y
BR2_ARM_FPU_FP_ARMV8=y
1 change: 1 addition & 0 deletions configs/odroid/hc4/buildroot/dts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
BR2_LINUX_KERNEL_INTREE_DTS_NAME="amlogic/meson-sm1-odroid-hc4"
3 changes: 3 additions & 0 deletions configs/odroid/hc4/buildroot/serial
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
BR2_TARGET_GENERIC_GETTY=y
BR2_TARGET_GENERIC_GETTY_BAUDRATE_115200=y
BR2_TARGET_GENERIC_GETTY_PORT="ttyAML0"
8 changes: 8 additions & 0 deletions configs/odroid/hc4/buildroot/uboot
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
BR2_TARGET_UBOOT_CUSTOM_VERSION=y
BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2022.07-rc4"

BR2_TARGET_UBOOT_BOARD_DEFCONFIG="odroid-hc4"

# Closed source blobs for amlogic fip
BR2_PACKAGE_AMLOGIC_BOOT_FIP=y
BR2_PACKAGE_AMLOGIC_BOOT_FIP_BOARD="odroid-hc4"
2 changes: 2 additions & 0 deletions configs/odroid/hc4/busybox/flash
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# enable flash_eraseall tool
CONFIG_FLASH_ERASEALL=y
1 change: 1 addition & 0 deletions configs/odroid/hc4/cflags/01-arch
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-march=armv8.2-a+crypto+fp16+rcpc+dotprod -mtune=cortex-a55
90 changes: 90 additions & 0 deletions configs/odroid/hc4/hooks/pre.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
#!/bin/bash

IMAGES_DIR=${SKIFF_BUILDROOT_DIR}/output/images

echo "Copying sd_fuse script..."
rsync -rav $SKIFF_CURRENT_CONF_DIR/resources/sd_fuse/ $IMAGES_DIR/hk_sd_fuse/

# this helper function includes postprocess for u200 and its variants.
# $1 PATH for uboot blob repo
# $2 family g12a or g12b
# source: https://raw.githubusercontent.com/armbian/build/master/config/sources/families/include/meson64_common.inc
uboot_g12_postprocess()
{
$1/blx_fix.sh $1/bl30.bin \
zero_tmp \
bl30_zero.bin \
$1/bl301.bin \
bl301_zero.bin \
bl30_new.bin bl30

$1/blx_fix.sh $1/bl2.bin \
zero_tmp \
bl2_zero.bin \
$1/acs.bin \
bl21_zero.bin \
bl2_new.bin bl2

$1/aml_encrypt_$2 --bl30sig \
--input bl30_new.bin \
--output bl30_new.bin.g12.enc \
--level v3
$1/aml_encrypt_$2 --bl3sig \
--input bl30_new.bin.g12.enc \
--output bl30_new.bin.enc \
--level v3 --type bl30
$1/aml_encrypt_$2 --bl3sig \
--input $1/bl31.img \
--output bl31.img.enc \
--level v3 --type bl31
$1/aml_encrypt_$2 --bl3sig \
--input bl33.bin \
--compress lz4 \
--output bl33.bin.enc \
--level v3 --type bl33
$1/aml_encrypt_$2 --bl2sig \
--input bl2_new.bin \
--output bl2.n.bin.sig
if [ -e $1/lpddr3_1d.fw ]
then
$1/aml_encrypt_$2 --bootmk --output u-boot-signed.bin \
--bl2 bl2.n.bin.sig \
--bl30 bl30_new.bin.enc \
--bl31 bl31.img.enc \
--bl33 bl33.bin.enc \
--ddrfw1 $1/ddr4_1d.fw \
--ddrfw2 $1/ddr4_2d.fw \
--ddrfw3 $1/ddr3_1d.fw \
--ddrfw4 $1/piei.fw \
--ddrfw5 $1/lpddr4_1d.fw \
--ddrfw6 $1/lpddr4_2d.fw \
--ddrfw7 $1/diag_lpddr4.fw \
--ddrfw8 $1/aml_ddr.fw \
--ddrfw9 $1/lpddr3_1d.fw \
--level v3
else
$1/aml_encrypt_$2 --bootmk --output u-boot-signed.bin \
--bl2 bl2.n.bin.sig \
--bl30 bl30_new.bin.enc \
--bl31 bl31.img.enc \
--bl33 bl33.bin.enc \
--ddrfw1 $1/ddr4_1d.fw \
--ddrfw2 $1/ddr4_2d.fw \
--ddrfw3 $1/ddr3_1d.fw \
--ddrfw4 $1/piei.fw \
--ddrfw5 $1/lpddr4_1d.fw \
--ddrfw6 $1/lpddr4_2d.fw \
--ddrfw7 $1/diag_lpddr4.fw \
--ddrfw8 $1/aml_ddr.fw \
--level v3
fi
}

echo "Building u-boot fip..."
cd ${IMAGES_DIR}
mkdir -p ./boot-fip
cd ./boot-fip
cp ../u-boot.bin bl33.bin
uboot_g12_postprocess ${IMAGES_DIR}/amlogic-boot-fip/ g12a
cp u-boot-signed.bin.sd.bin ${IMAGES_DIR}/
echo "Built u-boot fip for odroid hc4."
85 changes: 85 additions & 0 deletions configs/odroid/hc4/kernel/base
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# CONFIG_CLK_QORIQ is not set
# CONFIG_COMMON_CLK_CDCE706 is not set
# CONFIG_COMMON_CLK_CDCE925 is not set
# CONFIG_COMMON_CLK_CS2000_CP is not set
# CONFIG_COMMON_CLK_NXP is not set
# CONFIG_COMMON_CLK_PIC32 is not set
# CONFIG_COMMON_CLK_PWM is not set
# CONFIG_COMMON_CLK_PXA is not set
# CONFIG_COMMON_CLK_SCPI is not set
# CONFIG_COMMON_CLK_SI514 is not set
# CONFIG_COMMON_CLK_SI5351 is not set
# CONFIG_COMMON_CLK_SI570 is not set
# CONFIG_COMMON_CLK_VERSATILE is not set
# CONFIG_FTL is not set
# CONFIG_IIO_BUFFER_CB is not set
# CONFIG_INFTL is not set
# CONFIG_LEDS_TRIGGER_MTD is not set
# CONFIG_MTD_ABSENT is not set
# CONFIG_MTD_AFS_PARTS is not set
# CONFIG_MTD_AR7_PARTS is not set
# CONFIG_MTD_CFI is not set
# CONFIG_MTD_CFI_I4 is not set
# CONFIG_MTD_CFI_I8 is not set
# CONFIG_MTD_DOCG3 is not set
# CONFIG_MTD_JEDECPROBE is not set
# CONFIG_MTD_LPDDR is not set
# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
# CONFIG_MTD_MT81xx_NOR is not set
# CONFIG_MTD_NAND_BRCMNAND is not set
# CONFIG_MTD_NAND_CAFE is not set
# CONFIG_MTD_NAND_DENALI_DT is not set
# CONFIG_MTD_NAND_DENALI_PCI is not set
# CONFIG_MTD_NAND_DISKONCHIP is not set
# CONFIG_MTD_NAND_DOCG4 is not set
# CONFIG_MTD_NAND_ECC_BCH is not set
# CONFIG_MTD_NAND_ECC_SMC is not set
# CONFIG_MTD_NAND_GPIO is not set
# CONFIG_MTD_NAND_HISI504 is not set
# CONFIG_MTD_NAND_MTK is not set
# CONFIG_MTD_NAND_NANDSIM is not set
# CONFIG_MTD_NAND_OMAP_BCH_BUILD is not set
# CONFIG_MTD_NAND_PLATFORM is not set
# CONFIG_MTD_NAND_RICOH is not set
# CONFIG_MTD_ONENAND is not set
# CONFIG_MTD_PARTITIONED_MASTER is not set
# CONFIG_MTD_RAM is not set
# CONFIG_MTD_REDBOOT_PARTS is not set
# CONFIG_MTD_ROM is not set
# CONFIG_MTD_SM_COMMON is not set
# CONFIG_MTD_SPINAND_MT29F is not set
# CONFIG_MTD_SWAP is not set
# CONFIG_MTD_TESTS is not set
# CONFIG_MTD_UBI_BLOCK is not set
# CONFIG_MTD_UBI_FASTMAP is not set
# CONFIG_MTD_UBI_GLUEBI is not set
# CONFIG_NFTL is not set
# CONFIG_RFD_FTL is not set
# CONFIG_SM_FTL is not set
# CONFIG_SSFDC is not set

CONFIG_COMMON_CLK_XGENE=y
CONFIG_IIO=y
CONFIG_IIO_BUFFER=y
CONFIG_IIO_KFIFO_BUF=y
CONFIG_MTD=y
CONFIG_MTD_BLKDEVS=y
CONFIG_MTD_BLOCK=y
CONFIG_MTD_CFI_I1=y
CONFIG_MTD_CFI_I2=y
CONFIG_MTD_CMDLINE_PARTS=y
CONFIG_MTD_MAP_BANK_WIDTH_1=y
CONFIG_MTD_MAP_BANK_WIDTH_2=y
CONFIG_MTD_MAP_BANK_WIDTH_4=y
CONFIG_MTD_NAND=y
CONFIG_MTD_NAND_ECC=y
CONFIG_MTD_NAND_IDS=y
CONFIG_MTD_OF_PARTS=y
CONFIG_MTD_OOPS=y
CONFIG_MTD_SPI_NOR=y
CONFIG_MTD_SPI_NOR_USE_4K_SECTORS=y
CONFIG_MTD_UBI=y
CONFIG_MTD_UBI_BEB_LIMIT=20
CONFIG_MTD_UBI_WL_THRESHOLD=4096
1 change: 1 addition & 0 deletions configs/odroid/hc4/kernel/cmdline
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CONFIG_CMDLINE=""
Loading

0 comments on commit 180a53a

Please sign in to comment.