From 5784aa48231bc7b2a26af692e198db856250dd97 Mon Sep 17 00:00:00 2001 From: Alexandru M Stan Date: Tue, 16 Mar 2021 22:34:19 -0700 Subject: [PATCH] core/linux-aarch64-rc to 5.12.rc3-3 Changed logic for gathering dtb list to just use a wildcard for boards that we're interested in. Changed generate_chromebook_its.sh logic to just take in scattered dtb files. Compressed all input files that go into the .its Here are some comparisons: none: 37M lz4: 17M < chosen in this commit lzma: ~10M but boots 1 second slower Since it's compressed the .its now had to include external compatible properties, used `fdtget .dtb / compatible`. --- core/linux-aarch64-rc/PKGBUILD | 34 ++++++++------- .../generate_chromebook_its.sh | 42 ++++++++++--------- 2 files changed, 42 insertions(+), 34 deletions(-) diff --git a/core/linux-aarch64-rc/PKGBUILD b/core/linux-aarch64-rc/PKGBUILD index 629fde860..3b892f713 100644 --- a/core/linux-aarch64-rc/PKGBUILD +++ b/core/linux-aarch64-rc/PKGBUILD @@ -11,7 +11,7 @@ _srcname=linux-${_rcver}-rc${_rcrel} _kernelname=${pkgbase#linux} _desc="AArch64 multi-platform (release candidate)" pkgver=${_rcver}.rc${_rcrel} -pkgrel=2 +pkgrel=3 arch=('aarch64') url="http://www.kernel.org/" license=('GPL2') @@ -35,7 +35,7 @@ md5sums=('dc4fe4b1427b7223386205250988f55a' '1553fe4abbe675ed8abd4644561d8e8c' '9844db3484f4d4fa3e63c7e083f656f7' '47c62c814000ad515ab71213c00734bf' - 'beb35c282bbdadc0aab851d0ad4efd22' + 'cb97c1ab32e0165cde8fb5eb68302225' '61c5ff73c136ed07a7aadbf58db3d96a' '584777ae88bce2c5659960151b64c7d8' '41cb5fef62715ead2dd109dbea8413d6' @@ -230,19 +230,23 @@ _package-chromebook() { mkdir -p "${pkgdir}/boot" - ../generate_chromebook_its.sh ${srcdir} > kernel.its << DT_END - rk3399-gru-bob - rk3399-gru-kevin - rk3399-gru-scarlet-inx - rk3399-gru-scarlet-kd - sc7180-trogdor-lazor-r0 - sc7180-trogdor-lazor-r1 - sc7180-trogdor-lazor-r1-kb - sc7180-trogdor-lazor-r1-lte - sc7180-trogdor-lazor-r3 - sc7180-trogdor-lazor-r3-kb - sc7180-trogdor-lazor-r3-lte -DT_END + KARCH=arm64 + image=arch/${KARCH}/boot/Image + + chromeos_boards=( + 'elm' + 'gru' + 'kukui' + 'trogdor' + 'asurada' + ) + chromebook_dtbs=($(for b in ${chromeos_boards[@]}; do find arch/${KARCH}/boot -name "*${b}*.dtb" | LC_COLLATE=C sort; done)) + + for to_compress in ${chromebook_dtbs[@]} ${image}; do + #lzma -9 -z -f -k ${to_compress} # This is 40% smaller but takes ~1 sec longer to boot + lz4 -20 -z -f ${to_compress} + done + echo ${chromebook_dtbs[@]/%/.lz4} | ../generate_chromebook_its.sh ${image}.lz4 ${KARCH} lz4 > kernel.its mkimage -D "-I dts -O dtb -p 2048" -f kernel.its vmlinux.uimg dd if=/dev/zero of=bootloader.bin bs=512 count=1 diff --git a/core/linux-aarch64-rc/generate_chromebook_its.sh b/core/linux-aarch64-rc/generate_chromebook_its.sh index b5f296b46..b8ea3c3f4 100755 --- a/core/linux-aarch64-rc/generate_chromebook_its.sh +++ b/core/linux-aarch64-rc/generate_chromebook_its.sh @@ -1,7 +1,9 @@ #!/bin/bash -srcdir=$1 -read -r -d '' dt_list +image=$1 +arch=$2 +compression=$3 +read -a dtb_list cat <<-ITS_HEADER_END /dts-v1/; @@ -11,34 +13,30 @@ cat <<-ITS_HEADER_END images { kernel@1{ description = "kernel"; - data = /incbin/("arch/arm64/boot/Image"); + data = /incbin/("${image}"); type = "kernel_noload"; - arch = "arm64"; + arch = "${arch}"; os = "linux"; - compression = "none"; + compression = "${compression}"; load = <0>; entry = <0>; }; ITS_HEADER_END -its_entry_count=1 -for dt in ${dt_list}; do - dts_path=${srcdir}/*/arch/arm64/boot/dts/*/${dt}.dts - ! ls $dts_path >/dev/null && { echo "Error: dt not found $dt" >&2; exit 1; } - dt_dir=$(basename $(dirname ${dts_path})) +for i in ${!dtb_list[@]}; do + dtb=${dtb_list[${i}]} cat <<-FDT_END - fdt@${its_entry_count}{ - description = "${dt}.dtb"; - data = /incbin/("arch/arm64/boot/dts/${dt_dir}/${dt}.dtb"); + fdt@$(expr ${i} + 1){ + description = "$(basename ${dtb})"; + data = /incbin/("${dtb}"); type = "flat_dt"; - arch = "arm64"; - compression = "none"; + arch = "${arch}"; + compression = "${compression}"; hash@1{ algo = "sha1"; }; }; FDT_END - let its_entry_count=${its_entry_count}+1 done cat <<-ITS_MIDDLE_END @@ -47,11 +45,17 @@ cat <<-ITS_MIDDLE_END default = "conf@1"; ITS_MIDDLE_END -for((i=1;i<${its_entry_count};i++)); do +for i in "${!dtb_list[@]}"; do + compat_line="" + dtb_uncompressed=$(echo ${dtb_list[${i}]} | sed "s/\(\.dtb\).*/\1/g") + for compat in $(fdtget "${dtb_uncompressed}" / compatible); do + compat_line+="\"${compat}\"," + done cat <<-ITS_CONF_END - conf@${i}{ + conf@$(expr ${i} + 1){ kernel = "kernel@1"; - fdt = "fdt@${i}"; + fdt = "fdt@$(expr ${i} + 1)"; + compatible = ${compat_line%,}; }; ITS_CONF_END done