diff --git a/config/boards/odroidn2.conf b/config/boards/odroidn2.conf index 4778012ecf..05e9030c7c 100644 --- a/config/boards/odroidn2.conf +++ b/config/boards/odroidn2.conf @@ -5,15 +5,14 @@ KERNEL_TARGET="current,edge" FULL_DESKTOP="yes" FORCE_BOOTSCRIPT_UPDATE="yes" BOOT_LOGO="desktop" - -# Odroid N2 requires Odroid's u-boot for legacy kernel booting. -# These vars will be handled by the family (meson-g12b.conf) -USE_ODROID_UBOOT="legacy" BOOTCONFIG="odroid-n2_defconfig" # For mainline uboot -BOOTCONFIG_ODROID="odroidn2_config" # For odroid uboot -BOOTSCRIPT_ODROID="boot-odroid-n2.ini:boot.ini" # For odroid uboot, default BOOTSCRIPT is boot-meson64.cmd for mainline (in meson64_common.inc) + +# Newer u-boot for the N2/N2+, less patches: a single boot order patch +BOOTBRANCH_BOARD="tag:v2022.10" +BOOTPATCHDIR="v2022.10" # Enable writing u-boot to SPI on the N2(+) for current and edge +# @TODO: replace this with an overlay, after meson64 overlay revamp # To enable the SPI NOR the -spi .dtb is required, because eMMC shares a pin with SPI on the N2(+). To use it: # fdtfile=amlogic/meson-g12b-odroid-n2-plus-spi.dtb # in armbianEnv.txt and reboot, then run nand-sata-install UBOOT_TARGET_MAP="u-boot-dtb.img;;u-boot.bin.sd.bin:u-boot.bin u-boot-dtb.img u-boot.bin:u-boot-spi.bin" @@ -22,6 +21,7 @@ write_uboot_platform_mtd() { } # MAX might be different for N2/N2+, for now use N2+'s +# @TODO: remove? cpufreq is not used anymore, instead DT should be patched CPUMIN=1000000 CPUMAX=2400000 GOVERNOR=performance # some people recommend performance to avoid random hangs after 24+ hours running. @@ -30,3 +30,5 @@ GOVERNOR=performance # some people recommend performance to avoid random hangs a # https://github.com/u-boot/u-boot/blob/v2021.04/board/amlogic/odroid-n2/odroid-n2.c#L35-L106 # Unfortunately it uses n2_plus instead of n2-plus as the Kernel expects it. # So there is a hack at and around config/bootscripts/boot-meson64.cmd L90 +# If needed (eg for extlinux) you can specify the N2/N2+/ DTB in BOOT_FDT_FILE, example for the N2+: +# BOOT_FDT_FILE="amlogic/meson-g12b-odroid-n2-plus.dtb" diff --git a/config/sources/families/meson-g12b.conf b/config/sources/families/meson-g12b.conf index eeb59e44e6..3d9a27a176 100644 --- a/config/sources/families/meson-g12b.conf +++ b/config/sources/families/meson-g12b.conf @@ -9,47 +9,25 @@ source "${BASH_SOURCE%/*}/include/meson64_common.inc" ASOUND_STATE="asound.state.meson64" -if [[ -n ${USE_ODROID_UBOOT} ]] && [[ "${USE_ODROID_UBOOT}" == *"${BRANCH}"* ]]; then - # Current BRANCH is listed in USE_ODROID_UBOOT; use _ODROID variants if set. - BOOTCONFIG="${BOOTCONFIG_ODROID:-${BOOTCONFIG}}" - BOOTSCRIPT="${BOOTSCRIPT_ODROID:-${BOOTSCRIPT}}" +# Mainline u-boot, everything is done by meson64_common.inc, we just need to handle FIP blobs - # Enable Odroid's legacy u-boot building. This requires old toolchains etc, but does NOT require FIP trees. - UBOOT_TARGET_MAP=';;sd_fuse/u-boot.bin' - UBOOT_USE_GCC='< 4.9' - UBOOT_TOOLCHAIN2="arm-none-eabi-:< 5.0" - UBOOT_COMPILER="aarch64-none-elf-" - - BOOTSOURCE='https://github.com/hardkernel/u-boot.git' - BOOTBRANCH='branch:odroidg12-v2015.01' - BOOTPATCHDIR='u-boot-odroid' - BOOTDIR='u-boot-odroid' - - write_uboot_platform() { - dd if=$1/u-boot.bin of=$2 bs=512 seek=1 conv=fsync > /dev/null 2>&1 - } - -else - # Mainline u-boot, everything is done by meson64_common.inc, we just need to handle FIP blobs - - # Handling of FIP blobs - uboot_custom_postprocess() { - # @TODO: these should come from FIP_TREE_BOARD/FIP_TREE_FAMILY vars in board.conf instead of hardcoded here - if [[ $BOARD == odroidn2* ]]; then - # FIP trees 'odroid-n2-plus' and 'odroid-n2' are identical. - uboot_g12_postprocess "$SRC"/cache/sources/amlogic-boot-fip/odroid-n2 g12b - elif [[ $BOARD == khadas-vim3 ]]; then - # 'khadas-vim3' FIP tree contains 'lpddr3_1d.fw' which will trigger '--ddrfw9' in uboot_g12_postprocess - uboot_g12_postprocess "$SRC"/cache/sources/amlogic-boot-fip/khadas-vim3 g12b - elif [[ $BOARD == radxa-zero2 ]]; then - uboot_g12_postprocess "$SRC"/cache/sources/amlogic-boot-fip/radxa-zero2 g12b - elif [[ $BOARD == bananapim2s ]]; then - uboot_g12_postprocess "$SRC"/cache/sources/amlogic-boot-fip/bananapi-m2s g12b - elif [[ $BOARD == bananapicm4io ]]; then - uboot_g12_postprocess "$SRC"/cache/sources/amlogic-boot-fip/bananapi-m2s g12b - else - echo "Don't know how to handle FIP trees for board '${BOARD}'" - exit 2 - fi - } -fi +# Handling of FIP blobs +function uboot_custom_postprocess() { + # @TODO: these should come from FIP_TREE_BOARD/FIP_TREE_FAMILY vars in board.conf instead of hardcoded here + if [[ $BOARD == odroidn2* ]]; then + # FIP trees 'odroid-n2-plus' and 'odroid-n2' are identical. + uboot_g12_postprocess "$SRC"/cache/sources/amlogic-boot-fip/odroid-n2 g12b + elif [[ $BOARD == khadas-vim3 ]]; then + # 'khadas-vim3' FIP tree contains 'lpddr3_1d.fw' which will trigger '--ddrfw9' in uboot_g12_postprocess + uboot_g12_postprocess "$SRC"/cache/sources/amlogic-boot-fip/khadas-vim3 g12b + elif [[ $BOARD == radxa-zero2 ]]; then + uboot_g12_postprocess "$SRC"/cache/sources/amlogic-boot-fip/radxa-zero2 g12b + elif [[ $BOARD == bananapim2s ]]; then + uboot_g12_postprocess "$SRC"/cache/sources/amlogic-boot-fip/bananapi-m2s g12b + elif [[ $BOARD == bananapicm4io ]]; then + uboot_g12_postprocess "$SRC"/cache/sources/amlogic-boot-fip/bananapi-m2s g12b + else + echo "Don't know how to handle FIP trees for board '${BOARD}'" + exit 2 + fi +}