odroidm1: de-infest Petitboot 🔥 use Kwiboo's 2023.10 u-boot; UMS works
- using Kwiboo's `rk3568-2023.10` branch with BINMAN-handled blobs - patches (defconfig unless indicated): - boot usb first (rockchip-common) - blink leds & keep red one one on preboot; reset SPI env once after deinfesting from Petitboot - change usb_host0_xhci to otg (u-boot dtsi) - enable DM_GADGET, UMS 🔥 and RockUSB - **usage instructions**: - build & burn image to SD card - insert SD card into board - **hold the recovery (RCY) button** and power on the board - watch board boot - **de-infest Petitboot**: use `armbian-install` to install bootloader to MTD - if you don't, you'll need to hold the recovery button every boot - optionally: use `armbian-install` to install OS to eMMC/NVMe/USB - power-off board - remove SD card (new u-boot always boots SD first!) - boot into your newly de-infested machine - boot order: USB, SD, MMC, NVME, SCSI - de-infested machine can now boot (directly) from USB/SATA/NVMe, possibly via EFI: - Armbian UEFI-arm64 - Fedora 38 aarch64 - HASSOS for ODROID-M1 - Talos arm64 - others... - extra: new u-boot by Kwiboo (with GMAC patches) gives us stable MAC address - although it is based on cpuid#, doesn't match the HK sticker on the board - run `fw_setenv ethaddr XX:XX:XX:XX:XX:XX` to change eth addr in SPI flash environment if needed - `odroidm1`: update DDR/BL31 blobs (this depends on https://github.com/armbian/rkbin/pull/20)
This commit is contained in:
parent
6191627822
commit
c35adb37c7
@ -1,32 +1,72 @@
|
||||
# Rockchip RK3568 quad core 4GB-8GB GBE PCIe USB3 SATA NVMe
|
||||
BOARD_NAME="ODROID M1"
|
||||
BOARDFAMILY="rk3568-odroid" # Separate kernel, has its own family. Uses rockchip64_common for most stuff.
|
||||
BOARDFAMILY="rk3568-odroid" # Separate kernel, has its own family. Uses rockchip64_common for most stuff.
|
||||
BOARD_MAINTAINER="rpardini"
|
||||
BOOT_SOC="rk3568" # This determined BOOT_SCENARIO et al.
|
||||
KERNEL_TARGET="edge" # Only mainline based kernel
|
||||
BOOT_FDT_FILE="rockchip/rk3568-odroid-m1.dtb" # HK's DTB
|
||||
SRC_EXTLINUX="no" # NO EXTLINUX! Family defines a custom bootscript too.
|
||||
ASOUND_STATE="asound.state.station-m2" # @TODO: probably should fix this later.
|
||||
IMAGE_PARTITION_TABLE="gpt" # HK's bootloader in SPI requires GPT partition table.
|
||||
DDR_BLOB="rk35/rk3568_ddr_1560MHz_v1.10.bin" # Real blob, is actually used. in rkbin repository. HK uses 1.09, 1.10 seems to work just as well.
|
||||
BL31_BLOB="rk35/rk356x_usbplug_v1.10.bin--FAKE" # Not really used for anything, as the name proves.
|
||||
BOOT_SOC="rk3568"
|
||||
KERNEL_TARGET="edge"
|
||||
BOOT_FDT_FILE="rockchip/rk3568-odroid-m1.dtb"
|
||||
SRC_EXTLINUX="no"
|
||||
ASOUND_STATE="asound.state.station-m2"
|
||||
IMAGE_PARTITION_TABLE="gpt"
|
||||
FULL_DESKTOP="yes"
|
||||
BOOT_LOGO="desktop"
|
||||
|
||||
# Include fw_setenv, configured to point to Petitboot's u-env mtd partition, so users can re-enable Petitboot
|
||||
# with `fw_setenv skip_spiboot false` in Armbian.
|
||||
PACKAGE_LIST_BOARD="libubootenv-tool" # libubootenv-tool provides fw_printenv and fw_setenv, for talking to U-Boot environment / Petitboot
|
||||
BOOTSOURCE="https://github.com/Kwiboo/u-boot-rockchip.git"
|
||||
BOOTBRANCH_BOARD="commit:a6e84f9f5b90ff0fa3ac4e6b7e0d6e2c3ac9bb1b" # specific commit, from "branch:rk3568-2023.10" which is v2023.10-rc2 + kwiboo's patches (including GMAC)
|
||||
BOOTPATCHDIR="v2023.10"
|
||||
BOOTCONFIG="odroid-m1-rk3568_defconfig"
|
||||
BOOTDIR="u-boot-${BOARD}" # do not share u-boot directory
|
||||
|
||||
# Newer blobs...
|
||||
DDR_BLOB="rk35/rk3568_ddr_1560MHz_v1.18.bin"
|
||||
BL31_BLOB="rk35/rk3568_bl31_v1.43.elf"
|
||||
|
||||
# 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=2 # Wait for UART interrupt to enter UMS/RockUSB mode etc
|
||||
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"
|
||||
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
|
||||
|
||||
# Just use the binman-provided u-boot-rockchip.bin, which is ready-to-go
|
||||
function write_uboot_platform() {
|
||||
dd if=${1}/u-boot-rockchip.bin of=${2} bs=32k seek=1 conv=fsync
|
||||
}
|
||||
|
||||
# We don't use u-boot-rockchip-spi.bin here; instead, write SPL and u-boot individually
|
||||
# If we're deinfesting from Petitboot, clear the environment too; PREBOOT will save a new one for mainline
|
||||
function write_uboot_platform_mtd() {
|
||||
flashcp -v -p "${1}/idbloader-spi.img" /dev/mtd0 # write SPL
|
||||
flashcp -v -p "${1}/u-boot.itb" /dev/mtd2 # write u-boot
|
||||
if fw_printenv | grep -q -i petitboot; then # Petitboot leaves a horrible env behind, clear it off if so
|
||||
echo "Found traces of Petitboot in SPI u-boot environment, clearing SPI environment..." >&2
|
||||
flash_erase /dev/mtd1 0 0 # clear u-boot env
|
||||
fi
|
||||
}
|
||||
}
|
||||
|
||||
function add_host_dependencies__new_uboot_wants_python3_odroidm1() {
|
||||
declare -g EXTRA_BUILD_DEPS="${EXTRA_BUILD_DEPS} python3-pyelftools" # @TODO: convert to array later
|
||||
}
|
||||
|
||||
# Include fw_setenv, configured to point to Petitboot's u-env mtd partition
|
||||
PACKAGE_LIST_BOARD="libubootenv-tool" # libubootenv-tool provides fw_printenv and fw_setenv, for talking to U-Boot environment
|
||||
|
||||
function post_family_tweaks__config_odroidm1_fwenv() {
|
||||
display_alert "Configuring fw_printenv and fw_setenv" "for Odroid M1" "info"
|
||||
# Addresses below come from
|
||||
# - https://github.com/hardkernel/u-boot/blob/356906e6445378a45ac14ec184fc6e666b22338a/configs/odroid_rk3568_defconfig#L212-L213
|
||||
# - https://github.com/torvalds/linux/blob/master/arch/arm64/boot/dts/rockchip/rk3568-odroid-m1.dts#L637-L662
|
||||
# - (we use mainline, not vendor, so this is only for reference)
|
||||
# https://github.com/hardkernel/u-boot/blob/356906e6445378a45ac14ec184fc6e666b22338a/configs/odroid_rk3568_defconfig#L212-L213
|
||||
# - (armbian's uboot patches try to keep this mtd partition layout valid)
|
||||
# https://github.com/torvalds/linux/blob/master/arch/arm64/boot/dts/rockchip/rk3568-odroid-m1.dts#L637-L662
|
||||
# The kernel DT has a convenient partition table, so mtd1 is ready to use, just gotta set the size.
|
||||
|
||||
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
|
||||
/dev/mtd1 0x0000 0x20000
|
||||
FW_ENV_CONFIG
|
||||
}
|
||||
|
||||
@ -8,12 +8,6 @@
|
||||
#
|
||||
source "${BASH_SOURCE%/*}/include/rockchip64_common.inc"
|
||||
|
||||
# Disable uboot compilation; this board boots from HK stuff in SPI first.
|
||||
# We apply a bootscript, and use GPT partitions, so HK-stuff-in-SPI loads our boot.scr.
|
||||
unset BOOTSOURCE
|
||||
BOOTCONFIG="none"
|
||||
BOOTSCRIPT='boot-rockchip64-vendor.cmd:boot.cmd' # Use ramaddr_r for loading fdt and armbianEnv; more flexible with overlays
|
||||
|
||||
LINUXFAMILY="rk3568-odroid" # a separate family for this (separate kernel deb)
|
||||
LINUXCONFIG='linux-rk3568-odroid-'$BRANCH
|
||||
WIREGUARD="no"
|
||||
|
||||
@ -0,0 +1,28 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Martin Ayotte <martinayotte@yahoo.ca>
|
||||
Date: Wed, 5 Dec 2018 15:00:44 -0500
|
||||
Subject: add overlays framework for rockchip (scripts/Makefile.lib only)
|
||||
|
||||
- rpardini: real overlays are now bare in "overlay" directory and are handled
|
||||
directly by the patching scripts. No more null-patching of overlays.
|
||||
---
|
||||
scripts/Makefile.lib | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
|
||||
index 9ea801a22569..3cde7d57e261 100644
|
||||
--- a/scripts/Makefile.lib
|
||||
+++ b/scripts/Makefile.lib
|
||||
@@ -88,6 +88,9 @@ base-dtb-y := $(foreach m, $(multi-dtb-y), $(firstword $(call suffix-search, $m,
|
||||
|
||||
always-y += $(dtb-y)
|
||||
|
||||
+# Overlay targets
|
||||
+extra-y += $(dtbo-y) $(scr-y) $(dtbotxt-y)
|
||||
+
|
||||
# Add subdir path
|
||||
|
||||
ifneq ($(obj),.)
|
||||
--
|
||||
Armbian
|
||||
|
||||
@ -1,69 +1 @@
|
||||
This document describes overlays provided in the kernel packages
|
||||
For generic Armbian overlays documentation please see
|
||||
https://docs.armbian.com/User-Guide_Allwinner_overlays/
|
||||
|
||||
### Platform:
|
||||
|
||||
rockchip (Rockchip)
|
||||
|
||||
### Provided overlays:
|
||||
|
||||
- i2c0, i2c1, spi-spidev, uart0, uart1, pwm1, pwm2, pwm9
|
||||
|
||||
### Overlay details:
|
||||
|
||||
### i2c0
|
||||
|
||||
Activates TWI/I2C bus I2C3 but it will be named as I2C0 on the userspace
|
||||
|
||||
I2C3/I2C0 pins (SCL, SDA): GPIO3B.5, GPIO3B.6
|
||||
|
||||
### i2c1
|
||||
|
||||
Activates TWI/I2C bus I2C1
|
||||
|
||||
I2C1 pins (SCL, SDA): GPIO0B.3, GPIO0B.4
|
||||
|
||||
### spi-spidev
|
||||
|
||||
Activates SPIdev device node (/dev/spidev0.0) for userspace SPI access,
|
||||
|
||||
SPI 0 pins (MOSI, MISO, SCK, CS): GPIO2D.1, GPIO2D.0, GPIO2D.3, GPIO2D.2
|
||||
|
||||
Parameters:
|
||||
|
||||
param_spidev_max_freq (int)
|
||||
Maximum SPIdev frequency
|
||||
Optional
|
||||
Default: 1000000
|
||||
Range: 3000 - 100000000
|
||||
|
||||
### uart0
|
||||
|
||||
Activates UART0 (alias to serial1)
|
||||
|
||||
UART0 pins (RX, TX): GPIO3D.7, GPIO3D.6
|
||||
|
||||
### uart1
|
||||
|
||||
Activates UART1 (alias to serial0)
|
||||
|
||||
UART1 pins (RX, TX): GPIO0C.0, GPIO0C.1
|
||||
|
||||
### pwm1
|
||||
|
||||
Activates PWM1 (pwm1_m1)
|
||||
|
||||
PWM1 pins: GPIO0B.5
|
||||
|
||||
### pwm2
|
||||
|
||||
Activates PWM2 (pwm2_m1)
|
||||
|
||||
PWM2 pins: GPIO0B.6
|
||||
|
||||
### pwm9
|
||||
|
||||
Activates PWM9 (pwm9_m0)
|
||||
|
||||
PWM9 pins: GPIO3B.2
|
||||
Overlays for the ODROID-M1, from HardKernel
|
||||
|
||||
@ -0,0 +1,26 @@
|
||||
From 469ec598330cc46b01bd1f33a9fe422b9230d22c Mon Sep 17 00:00:00 2001
|
||||
From: Ricardo Pardini <ricardo@pardini.net>
|
||||
Date: Wed, 16 Aug 2023 13:54:31 +0200
|
||||
Subject: [PATCH 1/4] rockchip-common: boot USB devices first, then mmc's,
|
||||
nvme, scsi
|
||||
|
||||
---
|
||||
include/configs/rockchip-common.h | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/include/configs/rockchip-common.h b/include/configs/rockchip-common.h
|
||||
index 9121bba3738..1204113f63e 100644
|
||||
--- a/include/configs/rockchip-common.h
|
||||
+++ b/include/configs/rockchip-common.h
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
#ifndef CONFIG_SPL_BUILD
|
||||
|
||||
-#define BOOT_TARGETS "mmc1 mmc0 nvme scsi usb pxe dhcp spi"
|
||||
+#define BOOT_TARGETS "usb mmc1 mmc0 nvme scsi pxe dhcp spi"
|
||||
|
||||
#ifdef CONFIG_ARM64
|
||||
#define ROOT_UUID "B921B045-1DF0-41C3-AF44-4C6F280D3FAE;\0"
|
||||
--
|
||||
2.41.0
|
||||
|
||||
@ -0,0 +1,25 @@
|
||||
From 1b476772c1e8559e8acc0f50361e90ee0e8355fa Mon Sep 17 00:00:00 2001
|
||||
From: Ricardo Pardini <ricardo@pardini.net>
|
||||
Date: Fri, 18 Aug 2023 00:22:23 +0200
|
||||
Subject: [PATCH 2/4] board: rockchip: ODROID-M1: override kernel DT for xhci
|
||||
otg dr_mode
|
||||
|
||||
---
|
||||
arch/arm/dts/rk3568-odroid-m1-u-boot.dtsi | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/arch/arm/dts/rk3568-odroid-m1-u-boot.dtsi b/arch/arm/dts/rk3568-odroid-m1-u-boot.dtsi
|
||||
index 0fc360b06df..b4dec9d7a60 100644
|
||||
--- a/arch/arm/dts/rk3568-odroid-m1-u-boot.dtsi
|
||||
+++ b/arch/arm/dts/rk3568-odroid-m1-u-boot.dtsi
|
||||
@@ -35,3 +35,7 @@
|
||||
clock-frequency = <24000000>;
|
||||
status = "okay";
|
||||
};
|
||||
+
|
||||
+&usb_host0_xhci {
|
||||
+ dr_mode = "otg";
|
||||
+};
|
||||
--
|
||||
2.41.0
|
||||
|
||||
@ -0,0 +1,51 @@
|
||||
From e888d156c517613984d3cba08a8abaf48dc1c209 Mon Sep 17 00:00:00 2001
|
||||
From: Ricardo Pardini <ricardo@pardini.net>
|
||||
Date: Fri, 18 Aug 2023 00:38:03 +0200
|
||||
Subject: [PATCH 3/4] board: rockchip: ODROID-M1: enable DM_USB_GADGET & UMS &
|
||||
RockUSB
|
||||
|
||||
---
|
||||
configs/odroid-m1-rk3568_defconfig | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
|
||||
diff --git a/configs/odroid-m1-rk3568_defconfig b/configs/odroid-m1-rk3568_defconfig
|
||||
index 96b4e9ecdaf..f1dee2e0e24 100644
|
||||
--- a/configs/odroid-m1-rk3568_defconfig
|
||||
+++ b/configs/odroid-m1-rk3568_defconfig
|
||||
@@ -52,6 +52,8 @@ CONFIG_CMD_MMC=y
|
||||
CONFIG_CMD_MTD=y
|
||||
CONFIG_CMD_PCI=y
|
||||
CONFIG_CMD_USB=y
|
||||
+CONFIG_CMD_ROCKUSB=y
|
||||
+CONFIG_CMD_USB_MASS_STORAGE=y
|
||||
# CONFIG_CMD_SETEXPR is not set
|
||||
CONFIG_CMD_INI=y
|
||||
CONFIG_CMD_PMIC=y
|
||||
@@ -68,6 +70,7 @@ CONFIG_SPL_SYSCON=y
|
||||
CONFIG_AHCI_PCI=y
|
||||
CONFIG_DWC_AHCI=y
|
||||
CONFIG_SPL_CLK=y
|
||||
+# CONFIG_USB_FUNCTION_FASTBOOT is not set
|
||||
CONFIG_ROCKCHIP_GPIO=y
|
||||
CONFIG_SYS_I2C_ROCKCHIP=y
|
||||
CONFIG_MISC=y
|
||||
@@ -103,6 +106,7 @@ CONFIG_SYS_NS16550_MEM32=y
|
||||
CONFIG_ROCKCHIP_SFC=y
|
||||
CONFIG_SYSRESET=y
|
||||
CONFIG_USB=y
|
||||
+CONFIG_DM_USB_GADGET=y
|
||||
CONFIG_USB_XHCI_HCD=y
|
||||
CONFIG_USB_EHCI_HCD=y
|
||||
CONFIG_USB_EHCI_GENERIC=y
|
||||
@@ -110,5 +114,8 @@ CONFIG_USB_OHCI_HCD=y
|
||||
CONFIG_USB_OHCI_GENERIC=y
|
||||
CONFIG_USB_DWC3=y
|
||||
CONFIG_USB_DWC3_GENERIC=y
|
||||
+CONFIG_USB_GADGET=y
|
||||
+CONFIG_USB_GADGET_DOWNLOAD=y
|
||||
+CONFIG_USB_FUNCTION_ROCKUSB=y
|
||||
CONFIG_FS_CRAMFS=y
|
||||
CONFIG_ERRNO_STR=y
|
||||
--
|
||||
2.41.0
|
||||
|
||||
@ -0,0 +1,54 @@
|
||||
From bb3fa48c0b803c8d42ad5b38279062ef4cfaa2d6 Mon Sep 17 00:00:00 2001
|
||||
From: Ricardo Pardini <ricardo@pardini.net>
|
||||
Date: Fri, 18 Aug 2023 00:40:38 +0200
|
||||
Subject: [PATCH 4/4] 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
|
||||
|
||||
---
|
||||
configs/odroid-m1-rk3568_defconfig | 8 ++++++++
|
||||
1 file changed, 8 insertions(+)
|
||||
|
||||
diff --git a/configs/odroid-m1-rk3568_defconfig b/configs/odroid-m1-rk3568_defconfig
|
||||
index f1dee2e0e24..9b79fb77883 100644
|
||||
--- a/configs/odroid-m1-rk3568_defconfig
|
||||
+++ b/configs/odroid-m1-rk3568_defconfig
|
||||
@@ -10,6 +10,8 @@ CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
|
||||
CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0xc00000
|
||||
CONFIG_SF_DEFAULT_SPEED=24000000
|
||||
CONFIG_SF_DEFAULT_MODE=0x1000
|
||||
+CONFIG_ENV_SIZE=0x20000
|
||||
+CONFIG_ENV_OFFSET=0xe0000
|
||||
CONFIG_DEFAULT_DEVICE_TREE="rk3568-odroid-m1"
|
||||
CONFIG_ROCKCHIP_RK3568=y
|
||||
CONFIG_SPL_ROCKCHIP_COMMON_BOARD=y
|
||||
@@ -31,6 +33,8 @@ CONFIG_FIT_VERBOSE=y
|
||||
CONFIG_SPL_FIT_SIGNATURE=y
|
||||
CONFIG_SPL_LOAD_FIT=y
|
||||
CONFIG_LEGACY_IMAGE_FORMAT=y
|
||||
+CONFIG_USE_PREBOOT=y
|
||||
+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 \"${armbian}\" = \"once\"; then echo armbian env already set once; else echo armbian resetting environment once; setenv armbian once; saveenv; fi"
|
||||
CONFIG_DEFAULT_FDT_FILE="rockchip/rk3568-odroid-m1.dtb"
|
||||
# CONFIG_DISPLAY_CPUINFO is not set
|
||||
CONFIG_DISPLAY_BOARDINFO_LATE=y
|
||||
@@ -64,6 +68,8 @@ CONFIG_MTDPARTS_DEFAULT="nor0:0x100000(reserved),0x200000(uboot),0x100000(splash
|
||||
CONFIG_SPL_OF_CONTROL=y
|
||||
CONFIG_OF_LIVE=y
|
||||
CONFIG_OF_SPL_REMOVE_PROPS="clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents"
|
||||
+CONFIG_ENV_IS_IN_SPI_FLASH=y
|
||||
+CONFIG_VERSION_VARIABLE=y
|
||||
CONFIG_SPL_DM_SEQ_ALIAS=y
|
||||
CONFIG_SPL_REGMAP=y
|
||||
CONFIG_SPL_SYSCON=y
|
||||
@@ -73,6 +79,8 @@ CONFIG_SPL_CLK=y
|
||||
# CONFIG_USB_FUNCTION_FASTBOOT is not set
|
||||
CONFIG_ROCKCHIP_GPIO=y
|
||||
CONFIG_SYS_I2C_ROCKCHIP=y
|
||||
+CONFIG_LED=y
|
||||
+CONFIG_LED_GPIO=y
|
||||
CONFIG_MISC=y
|
||||
CONFIG_SUPPORT_EMMC_RPMB=y
|
||||
CONFIG_MMC_DW=y
|
||||
--
|
||||
2.41.0
|
||||
|
||||
Loading…
Reference in New Issue
Block a user