From 4b1d39b87dc826643b3bed7817091f8bbdb2b068 Mon Sep 17 00:00:00 2001 From: Kamil Dziezyk Date: Thu, 3 Dec 2020 11:59:24 +0000 Subject: [PATCH] arm-autonomy/juno-firmware: add compressed kernel support This patch adds support for lzma compressed kernel, by setting KERNEL_ALT_IMAGETYPE to 'Image.lzma' and adding additional decompression step during u-boot boot stage. U-boot automatic Image decompression cannot be used here, because if xen binary is the target of 'booti' command, Image is not being decompressed neither by u-boot nor by xen. Lzma compression is supported in u-boot with 'lzmadec' command, and does not require setting additional dependencies inside kernel recipe. Change-Id: I51b9aea962f8905f88b60ac28e71017c7d500189 Issue-Id: SCM-1769 Signed-off-by: Kamil Dziezyk Signed-off-by: Diego Sueiro Signed-off-by: Jon Mason --- .../conf/machine/juno-extra-settings.inc | 1 + .../images/firmware-image-juno.bbappend | 8 +++ .../firmware-image-juno/add-xen-support.patch | 69 ++++++++++++++----- 3 files changed, 60 insertions(+), 18 deletions(-) diff --git a/meta-arm-autonomy/dynamic-layers/meta-arm-bsp/conf/machine/juno-extra-settings.inc b/meta-arm-autonomy/dynamic-layers/meta-arm-bsp/conf/machine/juno-extra-settings.inc index ec7ed357..f8a16f40 100644 --- a/meta-arm-autonomy/dynamic-layers/meta-arm-bsp/conf/machine/juno-extra-settings.inc +++ b/meta-arm-autonomy/dynamic-layers/meta-arm-bsp/conf/machine/juno-extra-settings.inc @@ -1,4 +1,5 @@ # Extra machine settings for juno +KERNEL_ALT_IMAGETYPE = "Image.lzma" # Juno board has 2 network interfaces, add both of them to the bridge XENGUEST_NETWORK_BRIDGE_MEMBERS ?= "eth0 eth1" diff --git a/meta-arm-autonomy/dynamic-layers/meta-arm-bsp/recipes-bsp/images/firmware-image-juno.bbappend b/meta-arm-autonomy/dynamic-layers/meta-arm-bsp/recipes-bsp/images/firmware-image-juno.bbappend index 847e2527..6b94dc9b 100644 --- a/meta-arm-autonomy/dynamic-layers/meta-arm-bsp/recipes-bsp/images/firmware-image-juno.bbappend +++ b/meta-arm-autonomy/dynamic-layers/meta-arm-bsp/recipes-bsp/images/firmware-image-juno.bbappend @@ -39,4 +39,12 @@ do_deploy_prepend_xen() { done bbnote "Xen binaries added under SOFTWARE/XEN directory" + + if [ "${INITRAMFS_IMAGE_BUNDLE}" != "1" -a "${KERNEL_ALT_IMAGETYPE}" = "Image.lzma" ]; then + # KERNEL_ALT_IMAGETYPE is expected to be Image.lzma, + # however NOR flash filesystem is DOS compatible with 8.3 naming, + # so we need to replace ".lzma" with ".lzm" + cp -L -f ${DEPLOY_DIR_IMAGE}/${KERNEL_ALT_IMAGETYPE} \ + ${D}/${UNPACK_DIR}/SOFTWARE/Image.lzm + fi } diff --git a/meta-arm-autonomy/dynamic-layers/meta-arm-bsp/recipes-bsp/images/firmware-image-juno/add-xen-support.patch b/meta-arm-autonomy/dynamic-layers/meta-arm-bsp/recipes-bsp/images/firmware-image-juno/add-xen-support.patch index 04098e11..29f1e06f 100644 --- a/meta-arm-autonomy/dynamic-layers/meta-arm-bsp/recipes-bsp/images/firmware-image-juno/add-xen-support.patch +++ b/meta-arm-autonomy/dynamic-layers/meta-arm-bsp/recipes-bsp/images/firmware-image-juno/add-xen-support.patch @@ -9,9 +9,9 @@ It also adds customization for uEnv.txt file, that allows to autoboot xen. Upstream-Status: Inappropriate [configuration] Signed-off-by: Kamil Dziezyk -diff -r -u a/images-r0.txt b/images-r0.txt ---- a/images-r0.txt 2020-11-13 17:26:27.945942230 +0100 -+++ b/images-r0.txt 2020-11-13 17:26:43.221881902 +0100 +diff -u a/images-r0.txt b/images-r0.txt +--- a/images-r0.txt 2020-11-25 20:25:38.677687712 +0100 ++++ b/images-r0.txt 2020-11-25 20:36:55.482194294 +0100 @@ -1,7 +1,7 @@ TITLE: Versatile Express Images Configuration File @@ -21,7 +21,16 @@ diff -r -u a/images-r0.txt b/images-r0.txt NOR0UPDATE: AUTO ;Image Update:NONE/AUTO/FORCE NOR0ADDRESS: 0x00000000 ;Image Flash Address -@@ -24,7 +24,7 @@ +@@ -17,14 +17,14 @@ + + NOR2UPDATE: AUTO ;Image Update:NONE/AUTO/FORCE + NOR2ADDRESS: 0x00500000 ;Image Flash Address +-NOR2FILE: \SOFTWARE\Image ;Image File Name +-NOR2NAME: norkern ;Rename kernel to norkern ++NOR2FILE: \SOFTWARE\Image.lzm ;Image File Name ++NOR2NAME: norkern.lzm ;Rename kernel to norkern.lzm + NOR2LOAD: 00000000 ;Image Load Address + NOR2ENTRY: 00000000 ;Image Entry Point NOR3UPDATE: AUTO ;Image Update:NONE/AUTO/FORCE NOR3ADDRESS: 0x02900000 ;Image Flash Address @@ -46,9 +55,9 @@ diff -r -u a/images-r0.txt b/images-r0.txt +NOR10NAME: xen +NOR10LOAD: 00000000 ;Image Load Address +NOR10ENTRY: 00000000 ;Image Entry Point -diff -r -u a/images-r1.txt b/images-r1.txt ---- a/images-r1.txt 2020-11-13 17:26:27.945942230 +0100 -+++ b/images-r1.txt 2020-11-13 17:26:43.221881902 +0100 +diff -u a/images-r1.txt b/images-r1.txt +--- a/images-r1.txt 2020-11-25 20:40:19.005177152 +0100 ++++ b/images-r1.txt 2020-11-25 20:41:17.500886263 +0100 @@ -1,7 +1,7 @@ TITLE: Versatile Express Images Configuration File @@ -58,7 +67,16 @@ diff -r -u a/images-r1.txt b/images-r1.txt NOR0UPDATE: AUTO ;Image Update:NONE/AUTO/FORCE NOR0ADDRESS: 0x00000000 ;Image Flash Address -@@ -24,7 +24,7 @@ +@@ -17,14 +17,14 @@ + + NOR2UPDATE: AUTO ;Image Update:NONE/AUTO/FORCE + NOR2ADDRESS: 0x00500000 ;Image Flash Address +-NOR2FILE: \SOFTWARE\Image ;Image File Name +-NOR2NAME: norkern ;Rename kernel to norkern ++NOR2FILE: \SOFTWARE\Image.lzm ;Image File Name ++NOR2NAME: norkern.lzm ;Rename kernel to norkern.lzm + NOR2LOAD: 00000000 ;Image Load Address + NOR2ENTRY: 00000000 ;Image Entry Point NOR3UPDATE: AUTO ;Image Update:NONE/AUTO/FORCE NOR3ADDRESS: 0x02900000 ;Image Flash Address @@ -83,9 +101,9 @@ diff -r -u a/images-r1.txt b/images-r1.txt +NOR10NAME: xen +NOR10LOAD: 00000000 ;Image Load Address +NOR10ENTRY: 00000000 ;Image Entry Point -diff -r -u a/images-r2.txt b/images-r2.txt ---- a/images-r2.txt 2020-11-13 17:26:27.949942214 +0100 -+++ b/images-r2.txt 2020-11-13 17:26:43.221881902 +0100 +diff -u a/images-r2.txt b/images-r2.txt +--- a/images-r2.txt 2020-11-25 20:40:30.625119321 +0100 ++++ b/images-r2.txt 2020-11-25 20:41:30.720820597 +0100 @@ -1,7 +1,7 @@ TITLE: Versatile Express Images Configuration File @@ -95,7 +113,16 @@ diff -r -u a/images-r2.txt b/images-r2.txt NOR0UPDATE: AUTO ;Image Update:NONE/AUTO/FORCE NOR0ADDRESS: 0x00000000 ;Image Flash Address -@@ -24,7 +24,7 @@ +@@ -17,14 +17,14 @@ + + NOR2UPDATE: AUTO ;Image Update:NONE/AUTO/FORCE + NOR2ADDRESS: 0x00500000 ;Image Flash Address +-NOR2FILE: \SOFTWARE\Image ;Image File Name +-NOR2NAME: norkern ;Rename kernel to norkern ++NOR2FILE: \SOFTWARE\Image.lzm ;Image File Name ++NOR2NAME: norkern.lzm ;Rename kernel to norkern.lzm + NOR2LOAD: 00000000 ;Image Load Address + NOR2ENTRY: 00000000 ;Image Entry Point NOR3UPDATE: AUTO ;Image Update:NONE/AUTO/FORCE NOR3ADDRESS: 0x02900000 ;Image Flash Address @@ -120,21 +147,27 @@ diff -r -u a/images-r2.txt b/images-r2.txt +NOR10NAME: xen +NOR10LOAD: 00000000 ;Image Load Address +NOR10ENTRY: 00000000 ;Image Entry Point -diff -r -u a/uEnv.txt b/uEnv.txt ---- a/uEnv.txt 2020-11-13 17:26:27.949942214 +0100 -+++ b/uEnv.txt 2020-11-13 17:26:43.221881902 +0100 -@@ -1,3 +1,5 @@ +diff -u a/uEnv.txt b/uEnv.txt +--- a/uEnv.txt 2020-11-20 13:48:31.845078690 +0100 ++++ b/uEnv.txt 2020-11-25 20:30:00.572306675 +0100 +@@ -1,11 +1,16 @@ +xen_name=xen +xen_addr=0x84000000 uenvcmd=run mybootcmd ++kernel_alt_name=norkern.lzm ++kernel_comp_addr_r=0x88080000 mybootcmd=echo Loading custom boot command; \ echo Loading kernel; \ -@@ -7,5 +9,7 @@ + afs load ${kernel_name} ${kernel_addr_r} ; \ +-if test $? -eq 1; then echo Loading ${kernel_alt_name} instead of ${kernel_name}; afs load ${kernel_alt_name} ${kernel_addr_r}; fi; \ ++if test $? -eq 1; then echo Loading ${kernel_alt_name} instead of ${kernel_name}; afs load ${kernel_alt_name} ${kernel_comp_addr_r}; lzmadec ${kernel_comp_addr_r} ${kernel_addr_r}; fi; \ + echo Loading device tree; \ afs load ${fdtfile} ${fdt_addr_r}; \ if test $? -eq 1; then echo Loading ${fdt_alt_name} instead of ${fdtfile}; \ afs load ${fdt_alt_name} ${fdt_addr_r}; fi; fdt addr ${fdt_addr_r}; fdt resize; \ -booti ${kernel_addr_r} - ${fdt_addr_r}; +- +echo Loading Xen; \ +afs load ${xen_name} ${xen_addr}; \ +if test $? -eq 0; then echo Booting Xen; bootefi ${xen_addr} ${fdt_addr_r}; fi; - +