meson-s4t7: Enable dtbo support

The support is implemented by using dtbo files supplied by Khadas directly
in the linux-dtb package. The files are not compiled just copied.
This commit is contained in:
Gunjan Gupta 2023-08-10 19:45:17 +05:30 committed by Ricardo Pardini
parent 72883cb07c
commit 02051676b0
24 changed files with 108 additions and 13 deletions

View File

@ -12,5 +12,10 @@ KHADAS_BOARD_ID="kvim1s" # used to compile the fip blobs
declare -g KHADAS_OOWOW_BOARD_ID="VIM1S" # for use with EXT=output-image-oowow
# Use extlinux and u-boot-menu extension
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} partition_type=generic"
OVERLAY_PREFIX='s4-s905y4'
function image_specific_armbian_env_ready__set_vim1s_specific_parameters() {
display_alert "Writing vim1s parameters in /boot/armbianEnv.txt"
run_host_command_logged echo "earlycon=on" >>${SDCARD}/boot/armbianEnv.txt
run_host_command_logged echo "extraboardargs=meson-gx-mmc.caps2_quirks=mmc-hs400" >>${SDCARD}/boot/armbianEnv.txt
}

View File

@ -12,5 +12,4 @@ KHADAS_BOARD_ID="kvim4" # used to compile the fip blobs
declare -g KHADAS_OOWOW_BOARD_ID="VIM4" # for use with EXT=output-image-oowow
# Use extlinux and u-boot-menu extension
SRC_CMDLINE="console=tty0 console=ttyS0,921600 no_console_suspend earlycon=aml-uart,0xfe078000 mac=\\\${eth_mac} khadas.serial=\\\${usid} partition_type=generic"
OVERLAY_PREFIX='t7-a311d2'

View File

@ -0,0 +1,78 @@
# DO NOT EDIT THIS FILE
#
# Please edit /boot/armbianEnv.txt to set supported parameters
#
setenv overlay_error "false"
setenv console "both"
setenv verbosity "1"
setenv earlycon "off"
setenv bootlogo "false"
setenv earlyconuart "0xfe078000"
if test "${board_name}" = "kvim1s"; then setenv earlyconuart "0xfe07a000"; fi
# Show what uboot default fdtfile is
echo "U-boot default fdtfile: ${fdtfile}"
if test -e ${devtype} ${devnum} ${prefix}armbianEnv.txt; then
load ${devtype} ${devnum} ${loadaddr} ${prefix}armbianEnv.txt
env import -t ${loadaddr} ${filesize}
fi
if test "${console}" = "both"; then setenv console_serial "true"; setenv console_display "true"; fi
if test "${console}" = "serial"; then setenv console_serial "true"; fi
if test "${console}" = "display"; then setenv console_display "true"; fi
if test "${console_serial}" = "true"; then setenv consoleargs "console=ttyS0,921600"; fi
if test "${console_display}" = "true"; then setenv consoleargs "console=tty1 ${consoleargs}"; fi
if test "${earlycon}" = "on"; then setenv consoleargs "earlycon=aml-uart,${earlyconuart} ${consoleargs}"; fi
if test "${bootlogo}" = "true"; then
setenv consoleargs "splash plymouth.ignore-serial-consoles ${consoleargs}"
else
setenv consoleargs "splash=verbose ${consoleargs}"
fi
setenv bootargs "root=${rootdev} rootwait rootfstype=${rootfstype} ${consoleargs} no_console_suspend loglevel=${verbosity} mac=${eth_mac} khadas.serial=${usid} partition_type=generic ${extraargs} ${extraboardargs}"
load ${devtype} ${devnum} ${fdt_addr_r} ${prefix}dtb/${fdtfile}
fdt addr ${fdt_addr_r}
fdt resize 65536
for overlay_file in ${overlays}; do
if load ${devtype} ${devnum} ${scriptaddr} ${prefix}dtb/amlogic/overlay/${overlay_prefix}-${overlay_file}.dtbo; then
echo "Applying kernel provided DT overlay ${overlay_prefix}-${overlay_file}.dtbo"
fdt apply ${scriptaddr} || setenv overlay_error "true"
fi
done
for overlay_file in ${user_overlays}; do
if load ${devtype} ${devnum} ${scriptaddr} ${prefix}overlay-user/${overlay_file}.dtbo; then
echo "Applying user provided DT overlay ${overlay_file}.dtbo"
fdt apply ${scriptaddr} || setenv overlay_error "true"
fi
done
if test "${overlay_error}" = "true"; then
echo "Error applying DT overlays, restoring original DT"
load ${devtype} ${devnum} ${fdt_addr_r} ${prefix}dtb/${fdtfile}
else
if load ${devtype} ${devnum} ${scriptaddr} ${prefix}dtb/amlogic/overlay/${overlay_prefix}-fixup.scr; then
echo "Applying kernel provided DT fixup script (${overlay_prefix}-fixup.scr)"
source ${scriptaddr}
fi
if test -e ${devtype} ${devnum} ${prefix}fixup.scr; then
load ${devtype} ${devnum} ${scriptaddr} ${prefix}fixup.scr
echo "Applying user provided fixup script (fixup.scr)"
source ${scriptaddr}
fi
fi
load ${devtype} ${devnum} ${kernel_addr_r} /vmlinuz
load ${devtype} ${devnum} ${ramdisk_addr_r} /initrd.img
booti ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr_r}
# Recompile with:
# mkimage -C none -A arm -T script -d /boot/boot.cmd /boot/boot.scr

View File

@ -8,15 +8,6 @@ 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
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
declare -g ROOT_FS_LABEL="ROOTFS"
# Determine kernel
case $BRANCH in
@ -32,6 +23,8 @@ esac
# Lets build uboot from source
BOOTSOURCE="https://github.com/khadas/u-boot.git"
BOOTBRANCH="branch:khadas-vims-v2019.01"
BOOTENV_FILE='meson.txt'
BOOTSCRIPT="boot-meson-s4t7.cmd:boot.cmd"
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...
@ -86,3 +79,23 @@ function post_uboot_custom_postprocess__build_fip() {
run_host_command_logged bash fip/mk_script.sh "${KHADAS_BOARD_ID}" "${uboot_work_dir}"
return 0
}
function pre_package_kernel_image__copy_meson_s4t7_overlays(){
display_alert "Copy meson s4t7 overlays"
declare dtbo_destination="${tmp_kernel_install_dirs[INSTALL_DTBS_PATH]}"/amlogic
run_host_command_logged cp -r ${SRC}/patch/kernel/${KERNELPATCHDIR}/overlay ${dtbo_destination}/
display_alert "Enable Device Tree Overlays"
run_host_command_logged ln -sf amlogic/overlay "${tmp_kernel_install_dirs[INSTALL_DTBS_PATH]}"/overlay
}
function post_family_tweaks_bsp__disable_uinitrd_generation(){
if [[ -f "${destination}"/etc/initramfs/post-update.d/99-uboot ]] ; then
run_host_command_logged rm "${destination}"/etc/initramfs/post-update.d/99-uboot
fi
}
function pre_update_initramfs__change_initrd_compression(){
run_host_command_logged sed -i 's/COMPRESS=.*/COMPRESS=xz/g' $MOUNT/etc/initramfs-tools/initramfs.conf
}