Skip to content

Commit 268c2e8

Browse files
committed
odroidm1: bump to u-boot v2024.07; replace defconfig patches with hook
- bump "armbian" env to reset env in SPI on first run
1 parent 4232661 commit 268c2e8

5 files changed

+52
-112
lines changed

config/boards/odroidm1.conf

Lines changed: 50 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ IMAGE_PARTITION_TABLE="gpt"
1111
FULL_DESKTOP="yes"
1212
BOOT_LOGO="desktop"
1313

14-
BOOTBRANCH_BOARD="tag:v2024.04"
15-
BOOTPATCHDIR="v2024.04"
14+
BOOTBRANCH_BOARD="tag:v2024.07"
15+
BOOTPATCHDIR="v2024.07"
1616

1717
BOOTCONFIG="odroid-m1-rk3568_defconfig"
1818
BOOTDIR="u-boot-${BOARD}" # do not share u-boot directory
1919

20-
# The overlays for this board are prefixed by 'rockchip-rk3568-hk' (see for example patch/kernel/archive/rockchip64-6.x/overlay/rockchip-rk3328-i2c0.dts)
20+
# The overlays for this board are prefixed by 'rockchip-rk3568-hk' (see for example patch/kernel/archive/rockchip64-6.6/overlay/rockchip-rk3568-hk-i2c0.dts)
2121
OVERLAY_PREFIX="rockchip-rk3568-hk"
2222

2323
# HK's SPI partition on MTD:
@@ -26,7 +26,7 @@ OVERLAY_PREFIX="rockchip-rk3568-hk"
2626
# mtd2: start 1.048.576 size 2.097.152 end 3.145.728 : U-Boot == start 0x100000 size 0x200000 : U-Boot
2727
function post_family_config__uboot_config() {
2828
display_alert "$BOARD" "u-boot ${BOOTBRANCH_BOARD} overrides" "info"
29-
BOOTDELAY=2 # Wait for UART interrupt to enter UMS/RockUSB mode etc
29+
BOOTDELAY=1 # Wait for UART interrupt to enter UMS/RockUSB mode etc
3030
UBOOT_TARGET_MAP="BL31=${RKBIN_DIR}/$BL31_BLOB ROCKCHIP_TPL=${RKBIN_DIR}/${DDR_BLOB};;u-boot-rockchip.bin u-boot-rockchip-spi.bin u-boot.itb idbloader.img idbloader-spi.img"
3131
unset uboot_custom_postprocess write_uboot_platform write_uboot_platform_mtd # disable stuff from rockchip64_common; we're using binman here which does all the work already
3232

@@ -64,9 +64,8 @@ function post_family_tweaks__config_odroidm1_fwenv() {
6464
# Addresses below come from
6565
# - (we use mainline, not vendor, so this is only for reference)
6666
# https://github.com/hardkernel/u-boot/blob/356906e6445378a45ac14ec184fc6e666b22338a/configs/odroid_rk3568_defconfig#L212-L213
67-
# - (armbian's uboot patches try to keep this mtd partition layout valid)
68-
# https://github.com/torvalds/linux/blob/master/arch/arm64/boot/dts/rockchip/rk3568-odroid-m1.dts#L637-L662
6967
# The kernel DT has a convenient partition table, so mtd1 is ready to use, just gotta set the size.
68+
# https://github.com/torvalds/linux/blob/master/arch/arm64/boot/dts/rockchip/rk3568-odroid-m1.dts#L637-L662
7069

7170
cat <<- 'FW_ENV_CONFIG' > "${SDCARD}"/etc/fw_env.config
7271
# MTD on the SPI for the Odroid-M1; this requires the MTD partition table in the board kernel DTS
@@ -82,3 +81,48 @@ function post_family_tweaks__config_odroidm1_fwenv() {
8281
EOF
8382

8483
}
84+
85+
# A better equivalent to patching a defconfig, do changes to .config via code.
86+
# For UMS/RockUSB to work in u-boot, &usb_host0_xhci { dr_mode = "otg" } is required. See 0002-board-rockchip-ODROID-M1-override-kernel-DT-for-xhci-otg-dr_mode.patch
87+
function post_config_uboot_target__extra_configs_for_nanopi-r5s() {
88+
[[ "${BRANCH}" == "edge" || "${BRANCH}" == "current" ]] || return 0
89+
90+
display_alert "u-boot for ${BOARD}" "u-boot: store ENV in SPI, matching Petitboot size/offset" "info"
91+
run_host_command_logged scripts/config --set-val CONFIG_ENV_IS_NOWHERE "n"
92+
run_host_command_logged scripts/config --set-val CONFIG_ENV_IS_IN_SPI_FLASH "y"
93+
run_host_command_logged scripts/config --set-val CONFIG_ENV_SIZE "0x20000"
94+
run_host_command_logged scripts/config --set-val CONFIG_ENV_OFFSET "0xe0000"
95+
run_host_command_logged scripts/config --enable CONFIG_VERSION_VARIABLE
96+
97+
display_alert "u-boot for ${BOARD}" "u-boot: enable preboot & reset environment once in preboot" "info"
98+
run_host_command_logged scripts/config --enable CONFIG_USE_PREBOOT
99+
run_host_command_logged scripts/config --set-str CONFIG_PREBOOT "'echo armbian leds; led led-0 on; led led-1 on; sleep 0.1; led led-0 off; led led-1 off; sleep 0.1; led led-0 on; if test a\${armbian}a = atwicea; then echo armbian env already set once; else echo armbian resetting environment once; env default -f -a; setenv armbian twice; saveenv; fi'" # double quote
100+
101+
display_alert "u-boot for ${BOARD}" "u-boot: enable EFI debugging command" "info"
102+
run_host_command_logged scripts/config --enable CMD_EFIDEBUG
103+
run_host_command_logged scripts/config --enable CMD_NVEDIT_EFI
104+
105+
display_alert "u-boot for ${BOARD}" "u-boot: enable more compression support" "info"
106+
run_host_command_logged scripts/config --enable CONFIG_LZO
107+
run_host_command_logged scripts/config --enable CONFIG_BZIP2
108+
run_host_command_logged scripts/config --enable CONFIG_ZSTD
109+
110+
display_alert "u-boot for ${BOARD}" "u-boot: enable gpio LED support" "info"
111+
run_host_command_logged scripts/config --enable CONFIG_LED
112+
run_host_command_logged scripts/config --enable CONFIG_LED_GPIO
113+
114+
display_alert "u-boot for ${BOARD}" "u-boot: enable networking cmds" "info"
115+
run_host_command_logged scripts/config --enable CONFIG_CMD_NFS
116+
run_host_command_logged scripts/config --enable CONFIG_CMD_WGET
117+
run_host_command_logged scripts/config --enable CONFIG_CMD_DNS
118+
run_host_command_logged scripts/config --enable CONFIG_PROT_TCP
119+
run_host_command_logged scripts/config --enable CONFIG_PROT_TCP_SACK
120+
121+
display_alert "u-boot for ${BOARD}/${BRANCH}" "u-boot: enabling UMS/RockUSB Gadget functionality" "info"
122+
declare -a enable_configs=("CONFIG_CMD_USB_MASS_STORAGE" "CONFIG_USB_GADGET" "USB_GADGET_DOWNLOAD" "CONFIG_USB_FUNCTION_ROCKUSB" "CONFIG_USB_FUNCTION_ACM" "CONFIG_CMD_ROCKUSB" "CONFIG_CMD_USB_MASS_STORAGE")
123+
for config in "${enable_configs[@]}"; do
124+
run_host_command_logged scripts/config --enable "${config}"
125+
done
126+
# Auto-enabled by the above, force off...
127+
run_host_command_logged scripts/config --disable USB_FUNCTION_FASTBOOT
128+
}

patch/u-boot/v2024.04/board_odroidm1/0003-board-rockchip-ODROID-M1-enable-DM_USB_GADGET-UMS-RockUSB.patch

Lines changed: 0 additions & 50 deletions
This file was deleted.

patch/u-boot/v2024.04/board_odroidm1/0004-board-rockchip-ODROID-M1-use-env-in-SPI-use-HK-s-offset-size-for-SPI-env-enable-LED_GPIO-use-preboot-to-blink-all-leds-leave-red-one-on-clear-env-once.patch

Lines changed: 0 additions & 54 deletions
This file was deleted.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ diff --git a/arch/arm/dts/rk3568-odroid-m1-u-boot.dtsi b/arch/arm/dts/rk3568-odr
1111
index 111111111111..222222222222 100644
1212
--- a/arch/arm/dts/rk3568-odroid-m1-u-boot.dtsi
1313
+++ b/arch/arm/dts/rk3568-odroid-m1-u-boot.dtsi
14-
@@ -22,3 +22,7 @@
15-
bootph-pre-ram;
14+
@@ -21,3 +21,7 @@
15+
bootph-some-ram;
1616
};
1717
};
1818
+

0 commit comments

Comments
 (0)