mirror of
https://github.com/armbian/build
synced 2025-09-24 19:47:06 +07:00
khadas-vim4/khadas-vim1s: some fixes; VIM4/VIM4N now boots; workaround eMMC/oowow partition trouble for now
- vim1s/vim4: remove uEnv.txt and default extlinux args, use simple arguments instead
- meson-s4t7.conf: hack: rereadpt (re-read partition table) in initrd local-top (for eMMC boot of oowow'ed image)
- meson-s4t7.conf: include both `u-boot.bin.sd.bin.signed` and `u-boot.bin.signed` in uboot package
- meson-s4t7: patch kernel for different dt "model" across VIM4 and "New VIM4"
- meson-s4t7.conf: set `EXTLINUX_SPECIFIC_FDT=no`, so u-boot auto-determines which DTB to use
- don't specify DTB; this way both the "original VIM4" and the "new VIM4" can boot with the same image
This commit is contained in:
@@ -3,30 +3,12 @@ BOARD_NAME="Khadas VIM1S" # don't confuse with VIM1 (S905X)
|
||||
BOARDFAMILY="meson-s4t7"
|
||||
KERNEL_TARGET="legacy"
|
||||
BOARD_MAINTAINER="rpardini"
|
||||
SERIALCON="ttyS0" # for vendor kernel
|
||||
BOOT_FDT_FILE="amlogic/kvim1s.dtb" # vendor kernel dtb
|
||||
SERIALCON="ttyS0" # for vendor kernel
|
||||
# BOOT_FDT_FILE="amlogic/kvim1s.dtb" # unset on purpose: uboot auto-determines the DTB to use
|
||||
|
||||
# Lets build uboot from source
|
||||
# build uboot from source
|
||||
BOOTCONFIG="kvim1s_defconfig"
|
||||
KHADAS_BOARD_ID="kvim1s" # used to compile the fip blobs
|
||||
|
||||
# Use extlinux and u-boot-menu extension
|
||||
SRC_CMDLINE="\\\${bootargs} \\\${partitiontype} \\\${boot_user_args}" # Khdas-specific uboot variables.... double-escaped, so they survive u-boot-menu's processing
|
||||
|
||||
# Use uEnv.txt to conform to Khadas' documentation
|
||||
function pre_umount_final_image__khadas_s4t7_uenv() {
|
||||
display_alert "$BOARD" "creating uEnv.txt; UUID=${ROOT_PART_UUID}" "info"
|
||||
cat <<- UENV_KHADAS > "${SDCARD}/boot/uEnv.txt"
|
||||
#############################DO NOT TOUCH THIS OPTION#############################
|
||||
rootdev=root=UUID=${ROOT_PART_UUID}
|
||||
partitiontype=partition_type=generic
|
||||
#############################DO NOT TOUCH THIS OPTION#############################
|
||||
fan_mode=auto
|
||||
## Add user args here, spilt with space.
|
||||
## e.g. Add bootargs 'test1=111 test2=222'
|
||||
## boot_user_args=test1=111 test2=222
|
||||
boot_user_args=
|
||||
UENV_KHADAS
|
||||
|
||||
return 0
|
||||
}
|
||||
SRC_CMDLINE="console=tty0 console=ttyS0,921600 no_console_suspend earlycon=aml-uart,0xfe078000 meson-gx-mmc.caps2_quirks=mmc-hs400 mac=\\\${eth_mac} khadas.serial=\\\${usid}"
|
||||
|
||||
@@ -3,30 +3,12 @@ BOARD_NAME="Khadas VIM4"
|
||||
BOARDFAMILY="meson-s4t7"
|
||||
KERNEL_TARGET="legacy"
|
||||
BOARD_MAINTAINER="rpardini"
|
||||
SERIALCON="ttyS0" # for vendor kernel
|
||||
BOOT_FDT_FILE="amlogic/kvim4.dtb" # vendor kernel dtb; kvim4n.dtb for npu?
|
||||
SERIALCON="ttyS0" # for vendor kernel
|
||||
# BOOT_FDT_FILE="amlogic/kvim4.dtb" # not set on purpose; u-boot auto-selects kvim4.dtb or kvim4n.dtb for "new VIM4"
|
||||
|
||||
# Lets build uboot from source
|
||||
# build uboot from source
|
||||
BOOTCONFIG="kvim4_defconfig"
|
||||
KHADAS_BOARD_ID="kvim4" # used to compile the fip blobs
|
||||
|
||||
# Use extlinux and u-boot-menu extension
|
||||
SRC_CMDLINE="loglevel=7 systemd.log_level=debug systemd.log_target=console systemd.journald.forward_to_console=1 \\\${bootargs} \\\${partitiontype} fan=\\\${fan_mode} \\\${boot_user_args} " # Khdas-specific uboot variables.... double-escaped, so they survive u-boot-menu's processing
|
||||
|
||||
# Use uEnv.txt to conform to Khadas' documentation
|
||||
function pre_umount_final_image__khadas_s4t7_uenv() {
|
||||
display_alert "$BOARD" "creating uEnv.txt; UUID=${ROOT_PART_UUID}" "info"
|
||||
cat <<- UENV_KHADAS > "${SDCARD}/boot/uEnv.txt"
|
||||
#############################DO NOT TOUCH THIS OPTION#############################
|
||||
rootdev=root=UUID=${ROOT_PART_UUID}
|
||||
partitiontype=partition_type=generic
|
||||
#############################DO NOT TOUCH THIS OPTION#############################
|
||||
fan_mode=auto
|
||||
## Add user args here, spilt with space.
|
||||
## e.g. Add bootargs 'test1=111 test2=222'
|
||||
## boot_user_args=test1=111 test2=222
|
||||
boot_user_args=
|
||||
UENV_KHADAS
|
||||
|
||||
return 0
|
||||
}
|
||||
SRC_CMDLINE="console=tty0 console=ttyS0,921600 no_console_suspend earlycon=aml-uart,0xfe078000 mac=\\\${eth_mac} khadas.serial=\\\${usid}"
|
||||
|
||||
@@ -11,6 +11,7 @@ declare -g ATF_COMPILE="no"
|
||||
# Use extlinux and u-boot-menu extension
|
||||
SRC_EXTLINUX="yes"
|
||||
EXTLINUX_UINITRD="no" # Use normal initrd, not uInitrd; we're using vendor uboot and that does not support uInitrd
|
||||
EXTLINUX_SPECIFIC_FDT="no" # Do NOT use extlinux's "FDT" with BOOT_FDT_FILE; instead just the FDTDIR
|
||||
enable_extension "u-boot-menu" # this generates the extlinux.conf
|
||||
|
||||
# use Khadas-expected ROOTFS label for older uboot on SPI
|
||||
@@ -31,7 +32,7 @@ esac
|
||||
# Lets build uboot from source
|
||||
BOOTSOURCE="https://github.com/khadas/u-boot.git"
|
||||
BOOTBRANCH="branch:khadas-vims-v2019.01"
|
||||
UBOOT_TARGET_MAP=";;build/u-boot.bin.sd.bin.signed:u-boot.bin.sd.bin.signed"
|
||||
UBOOT_TARGET_MAP=";;build/u-boot.bin.sd.bin.signed:u-boot.bin.sd.bin.signed build/u-boot.bin.signed:u-boot.bin.signed"
|
||||
|
||||
## funny enough, the uboot+fip blobs go in the same spot as normal meson64...
|
||||
function write_uboot_platform() {
|
||||
@@ -85,3 +86,25 @@ function post_uboot_custom_postprocess__build_fip() {
|
||||
run_host_command_logged bash fip/mk_script.sh "${KHADAS_BOARD_ID}" "${uboot_work_dir}"
|
||||
return 0
|
||||
}
|
||||
|
||||
# Inject "reload partition table" to workaround evil xxx from vendor kernel vs eMMC
|
||||
# This probably can be avoided when we understand the "offset" needed for oowow/krescue emmc images
|
||||
pre_customize_image__inject_initramfs_rereadpt() {
|
||||
display_alert "$BOARD" "injecting initramfs rereadpt" "warn"
|
||||
local script_file_dst="${SDCARD}/etc/initramfs-tools/scripts/local-top/rereadpt.sh"
|
||||
cat <<- 'EOD' > "${script_file_dst}"
|
||||
#!/bin/sh
|
||||
PREREQ=""
|
||||
case $1 in
|
||||
prereqs)
|
||||
echo "$PREREQ"
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
echo 'Re-reading mmc partition table to workaround aml_emmc_partition_ops' 1>&2
|
||||
blockdev --rereadpt /dev/mmcblk0 || true
|
||||
blockdev --rereadpt /dev/mmcblk1 || true
|
||||
exit 0
|
||||
EOD
|
||||
run_host_command_logged chmod -v +x "${script_file_dst}"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Ricardo Pardini <ricardo@pardini.net>
|
||||
Date: Tue, 8 Aug 2023 12:29:37 +0200
|
||||
Subject: kvim4/kvim4n: use different model names in DT
|
||||
|
||||
So we can tell them apart in userspace.
|
||||
I wasted a month booting the wrong DT, since Khadas's upstream didn't differentiate them.
|
||||
---
|
||||
arch/arm64/boot/dts/amlogic/kvim4.dts | 2 +-
|
||||
arch/arm64/boot/dts/amlogic/kvim4n.dts | 2 +-
|
||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/kvim4.dts b/arch/arm64/boot/dts/amlogic/kvim4.dts
|
||||
index d9e4ac48ee55..1599d39ebcfb 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/kvim4.dts
|
||||
+++ b/arch/arm64/boot/dts/amlogic/kvim4.dts
|
||||
@@ -12,7 +12,7 @@
|
||||
#include "khadas-panel.dtsi"
|
||||
|
||||
/ {
|
||||
- model = "Khadas VIM4";
|
||||
+ model = "Khadas VIM4 Classic (without NPU, A311D2 Revision B, T7 family)";
|
||||
amlogic-dt-id = "t7_a311d2_vim4";
|
||||
compatible = "amlogic, t7";
|
||||
interrupt-parent = <&gic>;
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/kvim4n.dts b/arch/arm64/boot/dts/amlogic/kvim4n.dts
|
||||
index 666ca5733331..8441b7f3dd6a 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/kvim4n.dts
|
||||
+++ b/arch/arm64/boot/dts/amlogic/kvim4n.dts
|
||||
@@ -12,7 +12,7 @@
|
||||
#include "khadas-panel.dtsi"
|
||||
|
||||
/ {
|
||||
- model = "Khadas VIM4";
|
||||
+ model = "Khadas VIM4 New (with NPU, A311D2 Revision C A311D2-N0D, T7C family)";
|
||||
amlogic-dt-id = "t7c_a311d2_vim4";
|
||||
compatible = "amlogic, t7c";
|
||||
interrupt-parent = <&gic>;
|
||||
--
|
||||
Armbian
|
||||
|
||||
Reference in New Issue
Block a user