khadas-vim4/khadas-vim1s: very early wip; meson-s4t7/legacy 5.4 Amlogic kernel
- only "boot from SD" supported right now - building uboot with xPack riscv-none-embed-gcc **external** toolchain setup in hooks - kvim4: very high kernel logging + systemd debug logging to console - kvim4/kvim1s: add uEnv.txt and ROOT_FS_LABEL="ROOTFS" and Khadas-esque extlinux - meson-s4t7: unify khadas-vim1s and khadas-vim4 u-boot building - kernel .config: - s4t7: original Khadas vendor config - s4t7: CONFIG_BINFMT_MISC=y - s4t7: make NFS/sunrpc stuff =y - s4t7: enable USB wifi drivers from Armbian network_drivers - firmware: at https://github.com/armbian/firmware/pull/56 - extlinux tricks require https://github.com/armbian/build/pull/5462 - status: - kvim1s: boots from SD and works as server/CLI - kvim4: kernel panic during systemd-udevd
This commit is contained in:
parent
c44ed98005
commit
7a61093df4
32
config/boards/khadas-vim1s.wip
Normal file
32
config/boards/khadas-vim1s.wip
Normal file
@ -0,0 +1,32 @@
|
||||
# Amlogic S905Y4 4C 2GHz Cortex-A35 Mali-G31 MP2 2GB LPDDR4 16GB eMMC AP6256
|
||||
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
|
||||
|
||||
# Lets 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
|
||||
}
|
||||
32
config/boards/khadas-vim4.wip
Normal file
32
config/boards/khadas-vim4.wip
Normal file
@ -0,0 +1,32 @@
|
||||
# Amlogic A311D2 8GB
|
||||
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?
|
||||
|
||||
# Lets 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
|
||||
}
|
||||
7532
config/kernel/linux-meson-s4t7-legacy.config
Normal file
7532
config/kernel/linux-meson-s4t7-legacy.config
Normal file
File diff suppressed because it is too large
Load Diff
87
config/sources/families/meson-s4t7.conf
Normal file
87
config/sources/families/meson-s4t7.conf
Normal file
@ -0,0 +1,87 @@
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
# Copyright (c) 2023 Ricardo Pardini <ricardo@pardini.net>
|
||||
# This file is a part of the Armbian Build Framework https://github.com/armbian/build/
|
||||
#
|
||||
|
||||
declare -g LINUXFAMILY="meson-s4t7"
|
||||
declare -g ARCH="arm64"
|
||||
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
|
||||
enable_extension "u-boot-menu" # this generates the extlinux.conf
|
||||
|
||||
# use Khadas-expected ROOTFS label for older uboot on SPI
|
||||
declare -g ROOT_FS_LABEL="ROOTFS"
|
||||
|
||||
# Determine kernel
|
||||
case $BRANCH in
|
||||
|
||||
legacy)
|
||||
declare -g KERNEL_MAJOR_MINOR="5.4" # Major and minor versions of this kernel. For mainline caching.
|
||||
declare -g KERNELSOURCE="https://github.com/khadas/linux.git" # Khadas kernel
|
||||
declare -g KERNELBRANCH="branch:khadas-vims-5.4.y" # Branch or tag to build from. It should match MAJOR_MINOR
|
||||
declare -g KERNELPATCHDIR='archive/meson-s4t7-5.4'
|
||||
;;
|
||||
|
||||
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"
|
||||
|
||||
## funny enough, the uboot+fip blobs go in the same spot as normal meson64...
|
||||
function write_uboot_platform() {
|
||||
dd if="$1/u-boot.bin.sd.bin.signed" of="$2" conv=fsync,notrunc bs=442 count=1 #> /dev/null 2>&1
|
||||
dd if="$1/u-boot.bin.sd.bin.signed" of="$2" conv=fsync,notrunc bs=512 skip=1 seek=1 #> /dev/null 2>&1
|
||||
}
|
||||
|
||||
# We'll need xxd to build the fip blobs
|
||||
function add_host_dependencies__khadas_fips_needs_xxd() {
|
||||
display_alert "Adding xxd to host dependencies" "for khadas bootloader compile" "debug"
|
||||
declare -g EXTRA_BUILD_DEPS="${EXTRA_BUILD_DEPS} xxd"
|
||||
}
|
||||
|
||||
# To be able to build the fip blobs, we need a riscv toolchain.
|
||||
function pre_config_uboot_target__prepare_riscv_toolchain() {
|
||||
display_alert "$BOARD" "preparing riscv toolchain for bootloader fip" "info"
|
||||
|
||||
declare tos="x64"
|
||||
[[ "${HOSTARCH}" == "arm64" ]] && tos="arm64"
|
||||
[[ "${HOSTARCH}" == "armhf" ]] && tos="arm"
|
||||
declare tversion="8.3.0-1.2"
|
||||
declare tbasedir="${SRC}/cache/toolchain"
|
||||
declare tdir="${tbasedir}/xpack-riscv-none-embed-gcc-${tversion}"
|
||||
declare tfile="xpack-riscv-none-embed-gcc-${tversion}-linux-${tos}.tar.gz"
|
||||
declare turl="https://github.com/xpack-dev-tools/riscv-none-embed-gcc-xpack/releases/download/v${tversion}/${tfile}"
|
||||
|
||||
mkdir -p "${tbasedir}"
|
||||
|
||||
if [[ ! -d "${tdir}" ]]; then
|
||||
run_host_command_logged wget --progress=dot:giga -O "${tbasedir}/${tfile}" "${turl}"
|
||||
run_host_command_logged tar -C "${tbasedir}" -xzf "${tbasedir}/${tfile}"
|
||||
run_host_command_logged rm -fv "${tbasedir}/${tfile}"
|
||||
fi
|
||||
|
||||
# Symlinks are not enough: riscv-none-embed-ld: cannot find -lgcc, So we need to add the toolchain to the PATH
|
||||
declare -g -r PRE_TOOLCHAIN_PATH="${PATH}"
|
||||
export PATH="${tdir}/bin:${PATH}"
|
||||
}
|
||||
|
||||
function post_config_uboot_target__downgrade_errors_to_warnings() {
|
||||
uboot_cflags_array+=("-Wno-error=array-bounds")
|
||||
return 0
|
||||
}
|
||||
|
||||
# Invoke fip build script after the u-boot target
|
||||
function post_uboot_custom_postprocess__build_fip() {
|
||||
: "${uboot_work_dir:?uboot_work_dir not set}"
|
||||
: "${KHADAS_BOARD_ID:?KHADAS_BOARD_ID not set}"
|
||||
display_alert "$BOARD" "building fip" "info"
|
||||
cd "${uboot_work_dir}" || exit_with_error "cray-cray about ${uboot_work_dir}"
|
||||
run_host_command_logged bash fip/mk_script.sh "${KHADAS_BOARD_ID}" "${uboot_work_dir}"
|
||||
return 0
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user