-
--- 3.103/debian/flash-kernel.postinst 2018-08-10 19:22:02.000000000 +0000
+++ 3.103ubuntu1/debian/flash-kernel.postinst 2020-11-22 15:32:05.000000000 +0000
@@ -24,20 +24,20 @@ case "$1" in
. /usr/share/debconf/confmodule
tmp_default_fk="$(mktemp -t flash-kernel.XXXXXXXXXX)"
- trap "rm -f ${tmp_default_fk}" EXIT
+ tmp_default_fk_old_md5s="$(mktemp -t flash-kernel.md5sums.XXXXXXXXXX)"
+ trap "rm -f ${tmp_default_fk} ${tmp_default_fk_old_md5s}" EXIT
cp -p /usr/share/flash-kernel/default/flash-kernel \
${tmp_default_fk}
+ echo "6d73d0418e01f86e006d590e4b1ca85e" > ${tmp_default_fk_old_md5s}
merge_debconf_into_conf "$tmp_default_fk" \
LINUX_KERNEL_CMDLINE flash-kernel/linux_cmdline
- ucf --three-way --debconf-ok ${tmp_default_fk} \
+ ucf --three-way --debconf-ok --sum-file ${tmp_default_fk_old_md5s} \
+ ${tmp_default_fk} \
/etc/default/flash-kernel
ucfr flash-kernel /etc/default/flash-kernel
;;
- triggered)
- FLASH_KERNEL_NOTRIGGER=y flash-kernel
- ;;
- abort-upgrade|abort-remove|abort-deconfigure)
+ triggered|abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
@@ -45,4 +45,12 @@ case "$1" in
;;
esac
+if [ "x$1" = xtriggered ]; then
+ # this forces flash-kernel to run rather than setting our trigger to
+ # cause a later run (as happens without _NOTRIGGER being set)
+ FLASH_KERNEL_NOTRIGGER=y flash-kernel
+else
+ flash-kernel
+fi
+
#DEBHELPER#
-
--- 3.103/bootscript/armhf/uEnvtxt.omap 1970-01-01 00:00:00.000000000 +0000
+++ 3.103ubuntu1/bootscript/armhf/uEnvtxt.omap 2020-11-22 15:32:05.000000000 +0000
@@ -0,0 +1,2 @@
+bootcmd=fatload mmc 0:1 0x80000000 uImage;fatload mmc 0:1 0x81600000 uInitrd; bootm 0x80000000 0x81600000
+uenvcmd=boot
-
--- 3.103/debian/flash-kernel-installer.isinstallable 2019-02-28 06:52:45.000000000 +0000
+++ 3.103ubuntu1/debian/flash-kernel-installer.isinstallable 2020-11-22 15:32:05.000000000 +0000
@@ -2,6 +2,18 @@
set -e
case "`archdetect`" in
+ arm*/armadaxp)
+ exit 0
+ ;;
+ arm*/exynos5)
+ exit 0
+ ;;
+ arm*/generic-lpae)
+ exit 0
+ ;;
+ arm*/keystone)
+ exit 0
+ ;;
arm*/kirkwood)
exit 0
;;
@@ -14,6 +26,15 @@ case "`archdetect`" in
arm*/s3c24xx)
exit 0
;;
+ arm*/omap)
+ exit 0
+ ;;
+ arm*/omap4)
+ exit 0
+ ;;
+ arm64/xgene)
+ exit 0
+ ;;
arm*/generic)
FK_DIR="/usr/share/flash-kernel"
-
--- 3.103/initramfs-tools/hooks/flash_kernel_set_root 2018-08-10 19:22:02.000000000 +0000
+++ 3.103ubuntu1/initramfs-tools/hooks/flash_kernel_set_root 2020-11-22 15:32:05.000000000 +0000
@@ -55,6 +55,21 @@ FK_DIR="/usr/share/flash-kernel"
. /usr/share/initramfs-tools/hook-functions
+get_machine
+
+# Should we override the root device or merely provide a default root
+# device?
+blsr="$(get_machine_field "$machine" "Bootloader-sets-root")"
+
+if [ "$blsr" = "yes" ]; then
+ exit 0
+fi
+
+# Do not run inside an LXC container
+if systemd-detect-virt --quiet --container; then
+ exit 0
+fi
+
# Record the root filesystem device for use during boot
rootdev=$(egrep '^[^# ]+[ ]+/[ ]' /etc/fstab | awk '{print $1}') || true
-
--- 3.103/debian/rules 2020-02-01 06:40:57.000000000 +0000
+++ 3.103ubuntu1/debian/rules 2020-11-22 15:32:05.000000000 +0000
@@ -19,7 +19,7 @@ override_dh_auto_install:
install -m0755 -p -d debian/flash-kernel/etc/flash-kernel/bootscript
set -ex ; for arch in all $(DEB_HOST_ARCH) ; do \
[ -d bootscript/$${arch} ] || continue ; \
- install -m0644 bootscript/$${arch}/bootscr.* \
+ install -m0644 bootscript/$${arch}/* \
debian/flash-kernel/etc/flash-kernel/bootscript/ ; \
done
ifeq (armhf,$(DEB_HOST_ARCH))
-
--- 3.103/post-base-installer.d/01flash-kernel-diversion 1970-01-01 00:00:00.000000000 +0000
+++ 3.103ubuntu1/post-base-installer.d/01flash-kernel-diversion 2020-11-22 15:32:05.000000000 +0000
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+set -e
+
+# divert update-initramfs
+file=usr/sbin/update-initramfs
+
+in-target dpkg-divert --add --local --divert /${file}.flash-kernel-diverted --rename /${file}
+cp /target/bin/true /target/$file
-
--- 3.103/test_db 2018-08-10 19:22:02.000000000 +0000
+++ 3.103ubuntu1/test_db 2020-11-22 15:32:05.000000000 +0000
@@ -22,7 +22,7 @@
MACHINE_DB="$(cat "${FK_CHECKOUT:-$FK_DIR}/db/"*.db)"
test_no_unknown_fields() {
- local expected='Android-Boot-Device Boot-Device Boot-DTB-Path Boot-Initrd-Path Boot-Kernel-Path Boot-Multi-Path Boot-Script-Path Bootloader-Sets-Incorrect-Root 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-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'
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
-
--- 3.103/debian/control 2019-04-22 07:11:45.000000000 +0000
+++ 3.103ubuntu1/debian/control 2020-11-22 15:32:05.000000000 +0000
@@ -1,7 +1,8 @@
Source: flash-kernel
Section: utils
Priority: optional
-Maintainer: Debian Install System Team <debian-boot@lists.debian.org>
+Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
+XSBC-Original-Maintainer: Debian Install System Team <debian-boot@lists.debian.org>
Uploaders: Vagrant Cascadian <vagrant@debian.org>,
Karsten Merker <merker@debian.org>
Build-Depends: debhelper (>= 9), devio, linux-base (>= 3.2), dash
@@ -15,9 +16,11 @@ Architecture: arm64 armel armhf
Depends: ${misc:Depends},
devio,
initramfs-tools (>= 0.92f),
+ systemd,
linux-base (>= 3.2),
mtd-utils,
- ucf
+ ucf,
+ awk
Recommends: u-boot-tools
Description: utility to make certain embedded devices bootable
flash-kernel is a script which will put the kernel and initramfs in
@@ -31,7 +34,7 @@ Section: debian-installer
Priority: standard
Package-Type: udeb
Architecture: arm64 armel armhf
-XB-Subarchitecture: kirkwood orion5x s3c24xx mx5 generic
+XB-Subarchitecture: armadaxp exynos5 generic-lpae keystone kirkwood orion5x s3c24xx mx5 omap omap4 xgene generic
Provides: bootable-system
Depends: cdebconf-udeb, installed-base
XB-Installer-Menu-Item: 7300
-
--- 3.103/bootscript/all/bootscr.rpi 1970-01-01 00:00:00.000000000 +0000
+++ 3.103ubuntu1/bootscript/all/bootscr.rpi 2020-11-22 15:32:05.000000000 +0000
@@ -0,0 +1,109 @@
+# Ubuntu Classic RPi U-Boot script (for armhf and arm64)
+
+# Expects to be called with the following environment variables set:
+#
+# devtype e.g. mmc/scsi etc
+# devnum The device number of the given type
+# distro_bootpart The partition containing the boot files
+# (introduced in u-boot mainline 2016.01)
+# prefix Prefix within the boot partiion to the boot files
+# kernel_addr_r Address to load the kernel to
+# fdt_addr_r Address to load the FDT to
+# ramdisk_addr_r Address to load the initrd to.
+
+# Take fdt addr from the prior stage boot loader, if available
+if test -n "$fdt_addr"; then
+ fdt addr ${fdt_addr}
+ fdt move ${fdt_addr} ${fdt_addr_r} # implicitly sets fdt active
+else
+ fdt addr ${fdt_addr_r}
+fi
+fdt get value bootargs /chosen bootargs
+
+setenv bootargs "@@LINUX_KERNEL_CMDLINE_DEFAULTS@@ ${bootargs} @@LINUX_KERNEL_CMDLINE@@"
+@@UBOOT_ENV_EXTRA@@
+
+@@UBOOT_PREBOOT_EXTRA@@
+
+setenv kernel_filename vmlinuz
+setenv core_state "/uboot/ubuntu/boot.sel"
+setenv kernel_bootpart ${distro_bootpart}
+
+if test -z "${fk_image_locations}"; then
+ setenv fk_image_locations ${prefix}
+fi
+
+for pathprefix in ${fk_image_locations}; do
+ if load ${devtype} ${devnum}:${distro_bootpart} ${kernel_addr_r} ${pathprefix}${core_state}; then
+ # Core image; set defaults for core's state then import from the first
+ # boot.sel file. Then load the mutable boot.sel file from the next
+ # partition
+ setenv kernel_filename kernel.img
+ setenv kernel_vars "snap_kernel snap_try_kernel kernel_status"
+ setenv recovery_vars "snapd_recovery_mode snapd_recovery_system snapd_recovery_kernel"
+ setenv snapd_recovery_mode "install"
+ setenv snapd_standard_params "panic=-1 systemd.gpt_auto=0 rd.systemd.unit=basic.target"
+
+ env import -c ${kernel_addr_r} ${filesize} ${recovery_vars}
+ setenv bootargs "${bootargs} snapd_recovery_mode=${snapd_recovery_mode} snapd_recovery_system=${snapd_recovery_system} ${snapd_standard_params}"
+
+ if test "${snapd_recovery_mode}" = "run"; then
+ setexpr kernel_bootpart ${distro_bootpart} + 1
+ load ${devtype} ${devnum}:${kernel_bootpart} ${kernel_addr_r} ${pathprefix}${core_state}
+ env import -c ${kernel_addr_r} ${filesize} ${kernel_vars}
+ setenv kernel_name "${snap_kernel}"
+
+ if test -n "${kernel_status}"; then
+ if test "${kernel_status}" = "try"; then
+ if test -n "${snap_try_kernel}"; then
+ setenv kernel_status trying
+ setenv kernel_name "${snap_try_kernel}"
+ fi
+ elif test "${kernel_status}" = "trying"; then
+ setenv kernel_status ""
+ fi
+ env export -c ${kernel_addr_r} ${kernel_vars}
+ save ${devtype} ${devnum}:${kernel_bootpart} ${kernel_addr_r} ${pathprefix}${core_state} ${filesize}
+ fi
+ setenv kernel_prefix "${pathprefix}uboot/ubuntu/${kernel_name}/"
+ else
+ setenv kernel_prefix "${pathprefix}systems/${snapd_recovery_system}/kernel/"
+ fi
+ else
+ # Classic image; the kernel prefix is unchanged, nothing special to do
+ setenv kernel_prefix "${pathprefix}"
+ fi
+
+ # Store the gzip header (1f 8b) in the kernel area for comparison to the
+ # header of the image we load. Load "$kernel_filename" into the portion of
+ # memory for the RAM disk (because we want to uncompress to the kernel area
+ # if it's compressed) and compare the word at the start
+ mw.w ${kernel_addr_r} 0x8b1f # little endian
+ if load ${devtype} ${devnum}:${kernel_bootpart} ${ramdisk_addr_r} ${kernel_prefix}${kernel_filename}; then
+ kernel_size=${filesize}
+ if cmp.w ${kernel_addr_r} ${ramdisk_addr_r} 1; then
+ # gzip compressed image (NOTE: *not* a self-extracting gzip compressed
+ # kernel, just a kernel image that has been gzip'd)
+ echo "Decompressing kernel..."
+ unzip ${ramdisk_addr_r} ${kernel_addr_r}
+ setenv kernel_size ${filesize}
+ setenv try_boot "booti"
+ else
+ # Possibly self-extracting or uncompressed; copy data into the kernel area
+ # and attempt launch with bootz then booti
+ echo "Copying kernel..."
+ cp.b ${ramdisk_addr_r} ${kernel_addr_r} ${kernel_size}
+ setenv try_boot "bootz booti"
+ fi
+
+ if load ${devtype} ${devnum}:${kernel_bootpart} ${ramdisk_addr_r} ${kernel_prefix}initrd.img; then
+ setenv ramdisk_param "${ramdisk_addr_r}:${filesize}"
+ else
+ setenv ramdisk_param "-"
+ fi
+ for cmd in ${try_boot}; do
+ echo "Booting Ubuntu (with ${cmd}) from ${devtype} ${devnum}:${partition}..."
+ ${cmd} ${kernel_addr_r} ${ramdisk_param} ${fdt_addr_r}
+ done
+ fi
+done
-
test_functions
-
--- 3.103/bootscript/armhf/bootscr.highbank 2018-08-10 19:22:02.000000000 +0000
+++ 3.103ubuntu1/bootscript/armhf/bootscr.highbank 2020-11-22 15:32:05.000000000 +0000
@@ -1,5 +1,7 @@
-setenv bootargs @@LINUX_KERNEL_CMDLINE_DEFAULTS@@ ${bootargs} @@LINUX_KERNEL_CMDLINE@@
-@@UBOOT_ENV_EXTRA@@
-ext2load scsi 0 ${kernel_addr_r} vmlinuz
-ext2load scsi 0 ${ramdisk_addr_r} initrd.img
-bootz ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr}
+echo Starting Ubuntu...
+setenv bootargs console=ttyAMA0 nosplash
+mw.l 800000 0 10000
+scsi scan
+ext2load scsi 0 0x800000 vmlinuz
+ext2load scsi 0 0x2000000 initrd.img
+bootz 0x800000 0x2000000:${filesize} 0x1000
-
--- 3.103/bootscript/armhf/bootscr.keystone2 1970-01-01 00:00:00.000000000 +0000
+++ 3.103ubuntu1/bootscript/armhf/bootscr.keystone2 2020-11-22 15:32:05.000000000 +0000
@@ -0,0 +1,5 @@
+setenv bootargs "console=ttyS0,${baudrate}n8r ro pci=firmware rio-scan.static_enum=1 rio-scan.scan=0"
+@@UBOOT_ENV_EXTRA@@
+load scsi 0 ${kernel_addr_r} vmlinuz
+load scsi 0 ${ramdisk_addr_r} initrd.img
+bootz ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr_r}
-
--- 3.103/debian/flash-kernel-installer.postinst.in 2018-08-10 19:22:02.000000000 +0000
+++ 3.103ubuntu1/debian/flash-kernel-installer.postinst.in 2020-11-22 15:32:05.000000000 +0000
@@ -28,6 +28,12 @@ tac () {
sed '1!G;h;$!d'
}
+# check if live-installer diverted update-initramfs, revert before we move on
+if [ -e /target/usr/sbin/update-initramfs.flash-kernel-diverted ];then
+ rm -f /target/usr/sbin/update-initramfs
+ in-target dpkg-divert --remove --local --rename /usr/sbin/update-initramfs
+fi
+
get_machine
if machine_uses_flash "$machine"; then
@@ -91,7 +97,10 @@ case "$machine" in
:
;;
*)
- in-target update-initramfs -u || true
+ latest_version=$(in-target --pass-stdout sh -c 'linux-version list | linux-version sort | tail -n1')
+ mount -o bind /dev /target/dev
+ in-target update-initramfs -c -k $latest_version
+ umount /target/dev || true
;;
esac
@@ -121,6 +130,14 @@ fi
trap - EXIT HUP INT QUIT TERM
mv /target/tmp/flash-kernel.$$ /target/usr/sbin/flash-kernel
+# set ubuntu defaults
+if echo $(get_machine_field "$machine" "U-Boot-Script-Name") | grep -q "uEnvtxt"; then
+ export VOLID=$(blkid -o value -s UUID $(findfs /))
+ # hide the boot partition from udisks automounting
+ bootdev=$(get_machine_field "$machine" "Boot-Device")
+ [ -b $bootdev ] && in-target dosfslabel $bootdev "SERVICEV001"
+fi
+
# We need the udev /dev which has the MTD devices
mount -o bind /dev /target/dev
if ! in-target flash-kernel; then
-
--- 3.103/bootscript/all/bootscr.xgene 1970-01-01 00:00:00.000000000 +0000
+++ 3.103ubuntu1/bootscript/all/bootscr.xgene 2020-11-22 15:32:05.000000000 +0000
@@ -0,0 +1,5 @@
+setenv bootargs "console=ttyS0,${baudrate}n8r ro"
+@@UBOOT_ENV_EXTRA@@
+load scsi 0 ${kernel_addr_r} uImage
+load scsi 0 ${ramdisk_addr_r} uInitrd
+bootm ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr_r}
-
db/all.db
-
--- 3.103/debian/flash-kernel-installer.install 2018-08-10 19:22:02.000000000 +0000
+++ 3.103ubuntu1/debian/flash-kernel-installer.install 2020-11-22 15:32:05.000000000 +0000
@@ -1,2 +1,3 @@
db usr/share/flash-kernel
functions usr/share/flash-kernel
+post-base-installer.d usr/lib/
-
--- 3.103/bootscript/armhf/bootscr.omap 2018-08-10 19:22:02.000000000 +0000
+++ 3.103ubuntu1/bootscript/armhf/bootscr.omap 2020-11-22 15:32:05.000000000 +0000
@@ -1,4 +1,4 @@
fatload mmc 0:1 0x82000000 uImage
fatload mmc 0:1 0x83000000 uInitrd
-setenv bootargs ro
+setenv bootargs ro quiet splash
bootm 0x82000000 0x83000000
-
bootscript/armhf/uEnvtxt.wandboard
--- 3.103/bootscript/armhf/uEnvtxt.wandboard 1970-01-01 00:00:00.000000000 +0000
+++ 3.103ubuntu1/bootscript/armhf/uEnvtxt.wandboard 2020-11-22 15:32:05.000000000 +0000
@@ -0,0 +1,6 @@
+loadpreenv=load mmc ${mmcdev}:${mmcpart} 0x12000000 preenv.txt; env import -t 0x12000000 ${filesize}
+loadkernel=load mmc ${mmcdev}:${mmcpart} 0x12000000 uImage
+loadinitrd=load mmc ${mmcdev}:${mmcpart} 0x12A00000 uInitrd
+
+bootcmd=run loadpreenv; run loadkernel; run loadinitrd; bootm 0x12000000 0x12A00000
+uenvcmd=boot
-
--- 3.103/bootscript/armhf/bootscr.armadaxp 1970-01-01 00:00:00.000000000 +0000
+++ 3.103ubuntu1/bootscript/armhf/bootscr.armadaxp 2020-11-22 15:32:05.000000000 +0000
@@ -0,0 +1,42 @@
+echo Starting Ubuntu...
+if test -n ${fs} && test -n ${interface} && test -n ${device} && test -n ${prefix}; then
+ ${fs}load ${interface} ${device} 0x02000000 ${prefix}uImage
+ ${fs}load ${interface} ${device} 0x20000000 ${prefix}uInitrd
+ setenv bootargs ro quiet splash
+ bootm 0x02000000 0x20000000
+fi
+
+echo boot information not recieved from u-boot, scanning for startup device
+
+if test -e ${reinitalize_devices}; then
+ usb start;
+ ide reset;
+fi
+
+for i in usb ide; do
+ for j in 0 1; do
+ for l in / /boot/; do
+ for m in fat ext2; do
+ setenv interface $i;
+ setenv device $j;
+ setenv prefix $l;
+ setenv fs $m;
+
+ echo Scanning ${fs} ${interface} ${device} on prefix ${prefix} ...;
+
+ # This "if" avoids loading an old image but
+ # doesn't work in stock u-boot 1.3.4 and is
+ # only fixed in Canonical u-boot from October
+ # 1st or later
+
+ if ${fs}load ${interface} ${device} 0x1000 ${prefix}boot.scr; then
+ if imi 0x1000; then
+ echo boot.scr found! Executing ...;
+ autoscr 0x1000;
+ fi;
+ fi
+ done;
+ done;
+ done;
+done
+echo No boot device found.;
-
--- 3.103/bootscript/all/bootscr.exynos5 1970-01-01 00:00:00.000000000 +0000
+++ 3.103ubuntu1/bootscript/all/bootscr.exynos5 2020-11-22 15:32:05.000000000 +0000
@@ -0,0 +1,10 @@
+echo Starting Ubuntu...
+setenv bootargs console=ttySAC0,115200 nosplash mem=2048M@0x80000000 mem=6144M@0x100000000
+sata init
+test -n "$kernel_addr_r" || setenv kernel_addr_r 0x80007000
+test -n "$ramdisk_addr_r" || setenv ramdisk_addr_r 0x81000000
+test -n "$fdt_addr_r" || setenv fdt_addr_r 0x82000000
+ext2load sata 0 $kernel_addr_r uImage
+ext2load sata 0 $ramdisk_addr_r uInitrd
+imi $ramdisk_addr_r || setenv ramdisk_addr_r -
+bootm $kernel_addr_r $ramdisk_addr_r
-
--- 3.103/bootscript/all/bootscr.xgene-mustang 1970-01-01 00:00:00.000000000 +0000
+++ 3.103ubuntu1/bootscript/all/bootscr.xgene-mustang 2020-11-22 15:32:05.000000000 +0000
@@ -0,0 +1,6 @@
+setenv bootargs 'console=ttyS0,115200n8 ro'
+@@UBOOT_ENV_EXTRA@@
+ext4load scsi 0 ${kernel_addr_r} uImage
+ext4load scsi 0 ${ramdisk_addr_r} uInitrd
+ext4load scsi 0 ${fdt_addr_r} apm-mustang.dtb
+bootm ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr_r}
-
functions