diff -Nru flash-kernel-3.103ubuntu1~20.04.1/bootscript/arm64/bootscr.zynqmp flash-kernel-3.103ubuntu1~20.04.2/bootscript/arm64/bootscr.zynqmp --- flash-kernel-3.103ubuntu1~20.04.1/bootscript/arm64/bootscr.zynqmp 1970-01-01 01:00:00.000000000 +0100 +++ flash-kernel-3.103ubuntu1~20.04.2/bootscript/arm64/bootscr.zynqmp 2021-06-15 11:12:17.000000000 +0200 @@ -0,0 +1,119 @@ +# This is a boot script for U-Boot +# Generate boot.scr: +# mkimage -c none -A arm -T script -d boot.cmd boot.scr +# For initrd, when using a file override: +# mkimage -A arm -O linux -T ramdisk -d initrd.img rootfs.cpio.gz.u-boot +# Kernel "Image" file must be of EFI type: +# - Get vmlinuz from Ubuntu rootfs and uncompress +# system.dtb is a normal dtb file +# +################ + +@@UBOOT_ENV_EXTRA@@ + +for boot_target in ${boot_targets}; +do + if test "${boot_target}" = "jtag" ; then + booti 0x00200000 0x04000000 0x00100000 + exit; + fi + if test "${boot_target}" = "mmc0" || test "${boot_target}" = "mmc1" ; then + # Load alternative bitstream if present + if test -e ${devtype} ${devnum}:${distro_bootpart} /system.bit; then + echo "Loading alternative bitstream" + load ${devtype} ${devnum}:${distro_bootpart} 0x10000000 system.bit + fpga load 0 0x10000000 $filesize + fi + # Load different cma on zynqmp boards + setenv bootargs "earlycon console=ttyPS0,115200 console=tty1 root=/dev/mmcblk0p2 uio_pdrv_genirq.of_id=generic-uio" + fdt addr $fdtcontroladdr + # For ZCU: ZynqMP ZCU10* Rev* + # For Kria: ZynqMP K26 Rev* + fdt get value model_test / model + if setexpr model_test gsub '.*104.*' 104; then + setenv bootargs "${bootargs} cma=700M" + elif setexpr model_test gsub '.*106.*' 106; then + setenv bootargs "${bootargs} cma=1200M" + else + setenv bootargs "${bootargs} cma=1000M" + fi + # Get custom values from /etc/default/u-boot-xlnx + setenv bootargs "@@LINUX_KERNEL_CMDLINE_DEFAULTS@@ ${bootargs} @@LINUX_KERNEL_CMDLINE@@" + img_addr=- + initrd_addr=- + + # Take dtb from boot image unless Kria, where we take from FIT + if setexpr model_test gsub '.*K26.*' K26; then + dtb_addr=0x10000000 + else + dtb_addr=$fdtcontroladdr + fi + + if test -e ${devtype} ${devnum}:${distro_bootpart} /Image; then + echo "Loading Image" + img_addr=0x00200000 + load ${devtype} ${devnum}:${distro_bootpart} ${img_addr} Image; + fi + if test -e ${devtype} ${devnum}:${distro_bootpart} /system.dtb; then + echo "Loading system.dtb" + dtb_addr=0x70000000 + load ${devtype} ${devnum}:${distro_bootpart} ${dtb_addr} system.dtb; + fi + if test -e ${devtype} ${devnum}:${distro_bootpart} /rootfs.cpio.gz.u-boot; then + echo "Loading rootfs.cpio.gz.u-boot" + initrd_addr=0x04000000 + load ${devtype} ${devnum}:${distro_bootpart} ${initrd_addr} rootfs.cpio.gz.u-boot + fi + + @@UBOOT_PREBOOT_EXTRA@@ + + if test $img_addr = "-" || test $initrd_addr = "-"; then + if test -e ${devtype} ${devnum}:${distro_bootpart} /image.fit; then + echo "Loading image.fit" + load ${devtype} ${devnum}:${distro_bootpart} 0x10000000 image.fit; + if test $img_addr = "-"; then + img_addr=0x10000000 + fi + if test $initrd_addr = "-"; then + initrd_addr=0x10000000 + fi + fi + fi + if test "${img_addr}" -eq "0x10000000"; then + bootm ${img_addr} ${initrd_addr} ${dtb_addr} + elif test "${img_addr}" -eq "0x00200000"; then + booti ${img_addr} ${initrd_addr} ${dtb_addr} + fi + echo "No kernel found in ${devtype}" + exit; + fi + if test "${boot_target}" = "xspi0" || test "${boot_target}" = "qspi" || test "${boot_target}" = "qspi0"; then + sf probe 0 0 0; + if test "image.fit" = "image.fit"; then + sf read 0x10000000 0xF00000 0x6400000; + bootm 0x10000000; + exit; + fi + if test "image.fit" = "Image"; then + sf read 0x00200000 0xF00000 0x1D00000; + sf read 0x04000000 0x4000000 0x4000000 + booti 0x00200000 0x04000000 0x00100000 + exit; + fi + exit; + fi + if test "${boot_target}" = "nand" || test "${boot_target}" = "nand0"; then + nand info + if test "image.fit" = "image.fit"; then + nand read 0x10000000 0x4100000 0x6400000; + bootm 0x10000000; + exit; + fi + if test "image.fit" = "Image"; then + nand read 0x00200000 0x4100000 0x3200000; + nand read 0x04000000 0x7800000 0x3200000; + booti 0x00200000 0x04000000 0x00100000 + exit; + fi + fi +done diff -Nru flash-kernel-3.103ubuntu1~20.04.1/db/all.db flash-kernel-3.103ubuntu1~20.04.2/db/all.db --- flash-kernel-3.103ubuntu1~20.04.1/db/all.db 2020-11-22 16:32:05.000000000 +0100 +++ flash-kernel-3.103ubuntu1~20.04.2/db/all.db 2021-06-15 11:12:17.000000000 +0200 @@ -2164,3 +2164,39 @@ DTB-Id: sun6i-a31s-yones-toptech-bs1078-v2.dtb U-Boot-Script-Name: bootscr.sunxi Required-Packages: u-boot-tools + +Machine: ZynqMP *K26* +Kernel-Flavors: xilinx-zynqmp +Method: generic +Boot-Script-Path: /boot/firmware/boot.scr.uimg +U-Boot-Script-Name: bootscr.zynqmp +Boot-FIT-Path: /boot/firmware/image.fit +Boot-ITS-File-Name: image-kria.its +Required-Packages: u-boot-tools xlnx-kria-firmware + +Machine: ZynqMP ZCU102* +Kernel-Flavors: xilinx-zynqmp +Method: generic +Boot-Script-Path: /boot/firmware/boot.scr.uimg +U-Boot-Script-Name: bootscr.zynqmp +Boot-FIT-Path: /boot/firmware/image.fit +Boot-ITS-File-Name: image-zcu.its +Required-Packages: u-boot-tools xlnx-firmware + +Machine: ZynqMP ZCU104* +Kernel-Flavors: xilinx-zynqmp +Method: generic +Boot-Script-Path: /boot/firmware/boot.scr.uimg +U-Boot-Script-Name: bootscr.zynqmp +Boot-FIT-Path: /boot/firmware/image.fit +Boot-ITS-File-Name: image-zcu.its +Required-Packages: u-boot-tools xlnx-firmware + +Machine: ZynqMP ZCU106* +Kernel-Flavors: xilinx-zynqmp +Method: generic +Boot-Script-Path: /boot/firmware/boot.scr.uimg +U-Boot-Script-Name: bootscr.zynqmp +Boot-FIT-Path: /boot/firmware/image.fit +Boot-ITS-File-Name: image-zcu.its +Required-Packages: u-boot-tools xlnx-firmware diff -Nru flash-kernel-3.103ubuntu1~20.04.1/debian/changelog flash-kernel-3.103ubuntu1~20.04.2/debian/changelog --- flash-kernel-3.103ubuntu1~20.04.1/debian/changelog 2021-01-12 18:14:57.000000000 +0100 +++ flash-kernel-3.103ubuntu1~20.04.2/debian/changelog 2021-06-15 11:12:25.000000000 +0200 @@ -1,3 +1,13 @@ +flash-kernel (3.103ubuntu1~20.04.2) focal; urgency=medium + + * Backport from 3.104ubuntu4 (LP: #1931987): + * Add support for FIT images + - Support for ITS files + - New Boot-FIT-Path and Boot-ITS-File-Name DB fields + * Add Xilinx Kria SOM and ZCU10{2,4,6} boards to the devices database + + -- Alfonso Sanchez-Beato (email Canonical) Tue, 15 Jun 2021 11:12:25 +0200 + flash-kernel (3.103ubuntu1~20.04.1) focal; urgency=medium * Backport latest upstream version to groovy (LP: #1904890) diff -Nru flash-kernel-3.103ubuntu1~20.04.1/debian/rules flash-kernel-3.103ubuntu1~20.04.2/debian/rules --- flash-kernel-3.103ubuntu1~20.04.1/debian/rules 2020-11-22 16:32:05.000000000 +0100 +++ flash-kernel-3.103ubuntu1~20.04.2/debian/rules 2021-06-15 11:12:17.000000000 +0200 @@ -27,6 +27,13 @@ debian/flash-kernel/etc/flash-kernel/bootscript/ endif + install -m0755 -p -d debian/flash-kernel/usr/share/flash-kernel/its + set -ex ; for arch in all $(DEB_HOST_ARCH) ; do \ + [ -d its/$${arch} ] || continue ; \ + install -m0644 its/$${arch}/* \ + debian/flash-kernel/usr/share/flash-kernel/its/ ; \ + done + dh_auto_install override_dh_auto_clean: diff -Nru flash-kernel-3.103ubuntu1~20.04.1/functions flash-kernel-3.103ubuntu1~20.04.2/functions --- flash-kernel-3.103ubuntu1~20.04.1/functions 2020-11-22 16:32:05.000000000 +0100 +++ flash-kernel-3.103ubuntu1~20.04.2/functions 2021-06-15 11:12:17.000000000 +0200 @@ -20,6 +20,7 @@ # USA. BOOTSCRIPTS_DIR="${FK_CHECKOUT:-/etc/flash-kernel}/bootscript" +ITSFILES_DIR="${FK_CHECKOUT:-/usr/share/flash-kernel}/its" FK_ETC_MACHINE="${FK_ETC_MACHINE:-/etc/flash-kernel/machine}" FK_DEFAULTS="${FK_DEFAULTS:-/etc/default/flash-kernel}" PROC_CPUINFO="${FK_PROC_CPUINFO:-/proc/cpuinfo}" @@ -571,6 +572,58 @@ echo "done." >&2 } +mkimage_fit() { + local image_its="$1" + local image_fit="$2" + local kernel_file="$3" + local initrd_file="$4" + local dtb_file="$5" + + local its_tmp="$tmpdir/image.its" + + sed -e "s#@@LINUX_IMAGE_FILE@@#$kernel_file#g" \ + -e "s#@@INITRD_FILE@@#$initrd_file#g" \ + -e "s#@@DEVICE_TREE_FILE@@#$dtb_file#g" \ + < "$ITSFILES_DIR/$image_its" > "$its_tmp" + + printf "Generating u-boot image..." >&2 + mkimage -D "-I dts -O dtb" -f "$its_tmp" "$image_fit" >&2 1>/dev/null + echo " done." >&2 +} + +create_boot_script() { + case $usname in + bootscr*) + boot_script_path="$boot_mnt_dir/$boot_script_path" + boot_script="$tmpdir/bootscript" + for script in $usname ; do + echo "\n#\n# flash-kernel: $script\n#\n" >> "$boot_script" + cat "$BOOTSCRIPTS_DIR/$script" >> "$boot_script" + done + mkimage_script "$usaddr" "boot script" "$boot_script" \ + "$tmpdir/boot.scr" + boot_script="$tmpdir/boot.scr" + backup_and_install "$boot_script" "$boot_script_path" + ;; + uEnvtxt*) + VOLID=${VOLID:-"$(get_root_uuid)"} + boot_script_in="$BOOTSCRIPTS_DIR/$usname" + boot_script="$boot_mnt_dir/$usname" + cp $boot_script_in $boot_script + + boot_script_path="$boot_mnt_dir/uEnv.txt" + boot_script_env="$boot_mnt_dir/preEnv.txt" + env_script="$tmpdir/preEnv.txt" + + [ -e /etc/default/flash-kernel ] && . /etc/default/flash-kernel + echo "bootargs=ro $(LINUX_KERNEL_CMDLINE) root=UUID=$VOLID" > $env_script + + backup_and_install "$env_script" "$boot_script_env" + backup_and_install "$boot_script" "$boot_script_path" + ;; + esac +} + # Return a nonempty string *unless* NO_CREATE_DOT_BAK_FILES is set. get_dot_bak_preference() { . ${FK_DEFAULTS} @@ -969,6 +1022,8 @@ boot_script_path="$(get_machine_field "$machine" "Boot-Script-Path")" || : boot_dtb_path="$(get_machine_field "$machine" "Boot-DTB-Path")" || : boot_dtb_path_version="$(get_machine_field "$machine" "Boot-DTB-Path-Version")" || : +boot_fit_path="$(get_machine_field "$machine" "Boot-FIT-Path")" || : +boot_its_file_name="$(get_machine_field "$machine" "Boot-ITS-File-Name")" || : boot_multi_path="$(get_machine_field "$machine" "Boot-Multi-Path")" || : android_boot_device="$(get_machine_field "$machine" "Android-Boot-Device")" || : android_skip_initrd="$(get_machine_field "$machine" "Android-Skip-Initrd")" || : @@ -1091,6 +1146,14 @@ "$tmpdir/uImage" rm -f "$tmpdir/kernel" fi + if [ -n "$boot_fit_path" ]; then + [ -n "$ifile" ] || error "Initrd required for FIT method" + # Write tmp file in same filesystem as final destination + fit_tmp="$boot_fit_path".tmp + mkimage_fit "$boot_its_file_name" "$fit_tmp" \ + "$kfile" "$ifile" "$(find_dtb_file)" + backup_and_install "$fit_tmp" "$boot_fit_path" + fi if [ -n "$boot_device" ]; then check_block_dev "$boot_device" echo "Will use $boot_device as boot device." >&2 @@ -1146,36 +1209,7 @@ rm -f "$tmpdir/uInitrd" fi if [ -n "$boot_script_path" ]; then - case $usname in - bootscr*) - boot_script_path="$boot_mnt_dir/$boot_script_path" - boot_script="$tmpdir/bootscript" - for script in $usname ; do - echo "\n#\n# flash-kernel: $script\n#\n" >> "$boot_script" - cat "$BOOTSCRIPTS_DIR/$script" >> "$boot_script" - done - mkimage_script "$usaddr" "boot script" "$boot_script" \ - "$tmpdir/boot.scr" - boot_script="$tmpdir/boot.scr" - backup_and_install "$boot_script" "$boot_script_path" - ;; - uEnvtxt*) - VOLID=${VOLID:-"$(get_root_uuid)"} - boot_script_in="$BOOTSCRIPTS_DIR/$usname" - boot_script="$boot_mnt_dir/$usname" - cp $boot_script_in $boot_script - - boot_script_path="$boot_mnt_dir/uEnv.txt" - boot_script_env="$boot_mnt_dir/preEnv.txt" - env_script="$tmpdir/preEnv.txt" - - [ -e /etc/default/flash-kernel ] && . /etc/default/flash-kernel - echo "bootargs=ro $(LINUX_KERNEL_CMDLINE) root=UUID=$VOLID" > $env_script - - backup_and_install "$env_script" "$boot_script_env" - backup_and_install "$boot_script" "$boot_script_path" - ;; - esac + create_boot_script fi if [ -n "$boot_dtb_path" ] && [ "$dtb_append" != "no" ]; then boot_dtb_path="$boot_mnt_dir/$boot_dtb_path" diff -Nru flash-kernel-3.103ubuntu1~20.04.1/its/arm64/image-kria.its flash-kernel-3.103ubuntu1~20.04.2/its/arm64/image-kria.its --- flash-kernel-3.103ubuntu1~20.04.1/its/arm64/image-kria.its 1970-01-01 01:00:00.000000000 +0100 +++ flash-kernel-3.103ubuntu1~20.04.2/its/arm64/image-kria.its 2021-06-15 11:12:17.000000000 +0200 @@ -0,0 +1,62 @@ +/* + * Simple U-Boot uImage source file containing a single kernel, ramdisk and FDT blob + */ + +/dts-v1/; + +/ { + description = "Simple image with single Linux kernel, ramdisk and FDT blob"; + #address-cells = <1>; + + images { + kernel-1 { + description = "Ubuntu kernel"; + data = /incbin/("@@LINUX_IMAGE_FILE@@"); + type = "kernel"; + arch = "arm64"; + os = "linux"; + compression = "gzip"; + load = <0x00080000>; + entry = <0x00080000>; + hash-1 { + algo = "sha1"; + }; + }; + + ramdisk-1 { + description = "Ubuntu ramdisk"; + data = /incbin/("@@INITRD_FILE@@"); + type = "ramdisk"; + arch = "arm64"; + os = "linux"; + compression = "none"; + hash-1 { + algo = "sha1"; + }; + }; + + fdt-1 { + description = "Kria Device Tree blob"; + data = /incbin/("/usr/share/xlnx-kria-firmware/devicetree/system-top.dtb"); + type = "flat_dt"; + arch = "arm64"; + compression = "none"; + hash-1 { + algo = "sha1"; + }; + }; + }; + + configurations { + default = "kria"; + kria { + description = "Boot Ubuntu on kria SOM"; + kernel = "kernel-1"; + ramdisk = "ramdisk-1"; + fdt = "fdt-1"; + hash-1 { + algo = "sha1"; + }; + }; + }; +}; diff -Nru flash-kernel-3.103ubuntu1~20.04.1/its/arm64/image-zcu.its flash-kernel-3.103ubuntu1~20.04.2/its/arm64/image-zcu.its --- flash-kernel-3.103ubuntu1~20.04.1/its/arm64/image-zcu.its 1970-01-01 01:00:00.000000000 +0100 +++ flash-kernel-3.103ubuntu1~20.04.2/its/arm64/image-zcu.its 2021-06-15 11:12:17.000000000 +0200 @@ -0,0 +1,50 @@ +/* + * Simple U-Boot uImage source file containing a single kernel, ramdisk and FDT blob + */ + +/dts-v1/; + +/ { + description = "Simple image with single Linux kernel, ramdisk and FDT blob"; + #address-cells = <1>; + + images { + kernel-1 { + description = "Ubuntu kernel"; + data = /incbin/("@@LINUX_IMAGE_FILE@@"); + type = "kernel"; + arch = "arm64"; + os = "linux"; + compression = "gzip"; + load = <0x00080000>; + entry = <0x00080000>; + hash-1 { + algo = "sha1"; + }; + }; + + ramdisk-1 { + description = "Ubuntu ramdisk"; + data = /incbin/("@@INITRD_FILE@@"); + type = "ramdisk"; + arch = "arm64"; + os = "linux"; + compression = "none"; + hash-1 { + algo = "sha1"; + }; + }; + }; + + configurations { + default = "zcu"; + zcu { + description = "Boot Ubuntu on zcu board"; + kernel = "kernel-1"; + ramdisk = "ramdisk-1"; + hash-1 { + algo = "sha1"; + }; + }; + }; +}; diff -Nru flash-kernel-3.103ubuntu1~20.04.1/README flash-kernel-3.103ubuntu1~20.04.2/README --- flash-kernel-3.103ubuntu1~20.04.1/README 2020-11-19 10:32:49.000000000 +0100 +++ flash-kernel-3.103ubuntu1~20.04.2/README 2021-06-15 11:12:17.000000000 +0200 @@ -136,6 +136,15 @@ kernel, initrd and U-Boot script; Boot-Kernel-Path, Boot-Initrd-Path and Boot-Script-Path are then taken relative to this boot device +* Boot-FIT-Path: (optional) when present, a FIT image will be created. It + contains the path where the FIT image will be written. + +* Boot-ITS-File-Name: (optional) name of the ITS file used to describe the + content of the FIT image when a FIT image is being created. + @@LINUX_IMAGE_FILE@@, @@INITRD_FILE@@, and @@DEVICE_TREE_FILE@@ strings in + the file will be replaced by the path to the kernel, initrd, and device + tree blob respectively. + Configuration - - - - - - - diff -Nru flash-kernel-3.103ubuntu1~20.04.1/test_db flash-kernel-3.103ubuntu1~20.04.2/test_db --- flash-kernel-3.103ubuntu1~20.04.1/test_db 2020-11-22 16:32:05.000000000 +0100 +++ flash-kernel-3.103ubuntu1~20.04.2/test_db 2021-06-15 11:12:17.000000000 +0200 @@ -22,7 +22,7 @@ MACHINE_DB="$(cat "${FK_CHECKOUT:-$FK_DIR}/db/"*.db)" test_no_unknown_fields() { - local expected='Android-Boot-Device Android-Skip-Initrd Boot-Device Boot-DTB-Path Boot-Initrd-Path Boot-Kernel-Path Bootloader-Has-Broken-Ext4-Extent-Support Bootloader-Sets-Incorrect-Root Bootloader-sets-root Boot-Multi-Path Boot-Script-Path DTB-Append DTB-Append-From DTB-Id Kernel-Flavors Machine Machine-Id Method Mtd-Initrd Mtd-Kernel Optional-Packages Required-Packages U-Boot-Initrd-Address U-Boot-Kernel-Address U-Boot-Kernel-Entry-Point U-Boot-Multi-Address U-Boot-Script-Address U-Boot-Script-Name' + local expected='Android-Boot-Device Android-Skip-Initrd Boot-Device Boot-DTB-Path Boot-FIT-Path Boot-Initrd-Path Boot-ITS-File-Name Boot-Kernel-Path Bootloader-Has-Broken-Ext4-Extent-Support Bootloader-Sets-Incorrect-Root Bootloader-sets-root Boot-Multi-Path Boot-Script-Path DTB-Append DTB-Append-From DTB-Id Kernel-Flavors Machine Machine-Id Method Mtd-Initrd Mtd-Kernel Optional-Packages Required-Packages U-Boot-Initrd-Address U-Boot-Kernel-Address U-Boot-Kernel-Entry-Point U-Boot-Multi-Address U-Boot-Script-Address U-Boot-Script-Name' expected="$(echo "$expected" | sed 's/ /\n/g' | sort -u | xargs)" local fields="$(echo "$MACHINE_DB" | sed -n '/^[^#]*:/s/:.*//p' | sort -u | xargs)" if [ "$fields" != "$expected" ]; then