Skip to content

Commit

Permalink
odroidm1: u-boot: bump to 2025.01
Browse files Browse the repository at this point in the history
- convert patches to bash append/sed
- split post_family_tweaks hook for gmac rename / fwenv config
  • Loading branch information
rpardini authored and igorpecovnik committed Jan 11, 2025
1 parent 87a38d8 commit 92ed088
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 56 deletions.
32 changes: 25 additions & 7 deletions config/boards/odroidm1.conf
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,15 @@ IMAGE_PARTITION_TABLE="gpt"
FULL_DESKTOP="yes"
BOOT_LOGO="desktop"

BOOTBRANCH_BOARD="tag:v2024.07"
BOOTPATCHDIR="v2024.07"
BOOTBRANCH_BOARD="tag:v2025.01"
BOOTPATCHDIR="v2025.01" # but all changes are done in this board file, not patches

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

# 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)
OVERLAY_PREFIX="rockchip-rk3568-hk"

# HK's SPI partition on MTD:
# mtd0: start 0 size 917.504 end 917.504 : SPL == start 0x0 size 0xe0000 : SPL
# mtd1: start 917.504 size 131.072 end 1.048.576 : U-Boot Env == start 0xe0000 size 0x20000 : U-Boot Env
# mtd2: start 1.048.576 size 2.097.152 end 3.145.728 : U-Boot == start 0x100000 size 0x200000 : U-Boot
function post_family_config__uboot_config() {
display_alert "$BOARD" "u-boot ${BOOTBRANCH_BOARD} overrides" "info"
BOOTDELAY=1 # Wait for UART interrupt to enter UMS/RockUSB mode etc
Expand Down Expand Up @@ -67,14 +63,20 @@ function post_family_tweaks__config_odroidm1_fwenv() {
# https://github.com/hardkernel/u-boot/blob/356906e6445378a45ac14ec184fc6e666b22338a/configs/odroid_rk3568_defconfig#L212-L213
# The kernel DT has a convenient partition table, so mtd1 is ready to use, just gotta set the size.
# https://github.com/torvalds/linux/blob/master/arch/arm64/boot/dts/rockchip/rk3568-odroid-m1.dts#L637-L662
# HK's SPI partition on MTD:
# mtd0: start 0 size 917.504 end 917.504 : SPL == start 0x0 size 0xe0000 : SPL
# mtd1: start 917.504 size 131.072 end 1.048.576 : U-Boot Env == start 0xe0000 size 0x20000 : U-Boot Env
# mtd2: start 1.048.576 size 2.097.152 end 3.145.728 : U-Boot == start 0x100000 size 0x200000 : U-Boot

cat <<- 'FW_ENV_CONFIG' > "${SDCARD}"/etc/fw_env.config
# MTD on the SPI for the Odroid-M1; this requires the MTD partition table in the board kernel DTS
# MTD device name Device offset Env. size Flash sector size Number of sectors
/dev/mtd1 0x0000 0x20000
FW_ENV_CONFIG
}

# add a network rule to rename default name
# add a network rule to rename default name
function post_family_tweaks__odroidm1_rename_gmac_eth0() {
display_alert "Creating network rename rule for Odroid M1"
mkdir -p "${SDCARD}"/etc/udev/rules.d/
cat <<- EOF > "${SDCARD}"/etc/udev/rules.d/70-rename-lan.rules
Expand All @@ -83,6 +85,22 @@ function post_family_tweaks__config_odroidm1_fwenv() {

}

function pre_config_uboot_target__odroidm1_patch_uboot_dtsi_for_ums() {
display_alert "u-boot for ${BOARD}" "u-boot: add to u-boot dtsi for UMS" "info" # avoid a patch, just append to the dtsi file
cat <<- UBOOT_BOARD_DTSI_OTG >> arch/arm/dts/rk3568-odroid-m1-u-boot.dtsi
&usb_host0_xhci { dr_mode = "otg"; };
UBOOT_BOARD_DTSI_OTG
}

# "rockchip-common: boot SD card first, then NVMe, then SATA, then USB, then mmc"
# On odroidm1, mmc0 is the eMMC, mmc1 is the SD card slot
function pre_config_uboot_target__odroidm1_patch_rockchip_common_boot_order() {
declare -a rockchip_uboot_targets=("mmc1" "nvme" "scsi" "usb" "mmc0" "pxe" "dhcp" "spi") # for future make-this-generic delight
display_alert "u-boot for ${BOARD}/${BRANCH}" "u-boot: adjust boot order to '${rockchip_uboot_targets[*]}'" "info"
sed -i -e "s/#define BOOT_TARGETS.*/#define BOOT_TARGETS \"${rockchip_uboot_targets[*]}\"/" include/configs/rockchip-common.h
regular_git diff -u include/configs/rockchip-common.h || true
}

# A better equivalent to patching a defconfig, do changes to .config via code.
# 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
function post_config_uboot_target__extra_configs_for_odroid-m1() {
Expand Down

This file was deleted.

This file was deleted.

0 comments on commit 92ed088

Please sign in to comment.