diffstat for flash-kernel-3.0~rc.4 flash-kernel-3.0~rc.4ubuntu62 README | 24 + bootscript/bootscr.armadaxp | 42 ++ bootscript/bootscr.exynos5 | 10 bootscript/bootscr.highbank | 7 bootscript/bootscr.keystone2 | 5 bootscript/bootscr.omap | 2 bootscript/bootscr.xgene | 5 bootscript/bootscr.xgene-mustang | 6 bootscript/uEnvtxt.omap | 2 bootscript/uEnvtxt.wandboard | 6 bootscript/uboot.env.rpi2 | 7 db/all.db | 153 ++++++++ debian/changelog | 468 +++++++++++++++++++++++++ debian/control | 9 debian/dirs | 2 debian/flash-kernel-installer.install | 1 debian/flash-kernel-installer.isinstallable | 24 + debian/flash-kernel-installer.postinst | 19 - debian/flash-kernel.default | 1 debian/flash-kernel.postinst | 9 functions | 222 +++++++++-- initramfs-hook/flash-kernel | 11 initramfs-tools/hooks/flash_kernel_set_root | 36 + kernel-hook/zz-flash-kernel | 11 post-base-installer.d/01flash-kernel-diversion | 9 test_functions | 18 26 files changed, 1044 insertions(+), 65 deletions(-) diff -Nru flash-kernel-3.0~rc.4/README flash-kernel-3.0~rc.4ubuntu62/README --- flash-kernel-3.0~rc.4/README 2012-03-09 15:11:01.000000000 +0000 +++ flash-kernel-3.0~rc.4ubuntu62/README 2014-09-29 22:21:38.000000000 +0000 @@ -22,15 +22,19 @@ - Genesi Efika Smartbook - GLAN Tank - GuruPlug + - Calxeda Highbank Server architecture - HP t5325 Thin Client - HP Media Vault mv2120 - Intel SS4000-E - Linksys NSLU2 + - Marvell Armada XP Development Board (Ubuntu) - Marvell DB-78x00-BP Development Board - Marvell OpenRD-Base - Marvell OpenRD-Client - Marvell OpenRD-Ultimate - Neo FreeRunner (GTA02) + - OMAP3 Beagle Board + - OMAP4 Panda board - QNAP TS-109 - QNAP TS-110 Turbo NAS - QNAP TS-119 Turbo NAS @@ -102,6 +106,9 @@ Boot-Initrd-Path but for an U-Boot boot script; see also U-Boot-Script-Name and Boot-Device +* Boot-Dtb-Path: (optional) where to put the DTB file on the filesystem; + see also DTB-Id + * Required-packages: (optional) list of packages which must be added during installer phase for flash-kernel to work properly; failure to add these packages aborts the installation @@ -124,3 +131,20 @@ kernel, initrd and U-Boot script; Boot-Kernel-Path, Boot-Initrd-Path and Boot-Script-Path are then taken relative to this boot device +* DTB-Kernel-Version: (optional) minimal kernel version for DTB concatenation + +* DTB-Id: (optional) specifies the name of the DTB file for this device + + +Adding U-Boot Commands for Pre-Boot Execution +- - - - - - - - - - - - - - - - - - - - - - - + +Packages can drop in files containing U-Boot commands to be executed by a +platform's bootscript before starting the OS. These files should be +dropped in /usr/share/flash-kernel/ubootenv.d. Users can add additional +stubs, or override stubs provided by packages, by adding files to +/etc/flash-kernel/ubootenv.d. Files in the /etc path that have the same +name as files in the /usr path will override the /usr counterparts. + +Platform bootscripts must contain the @@UBOOT_ENV_EXTRA@@ macro for the +contents of these stubs to be incorporated. diff -Nru flash-kernel-3.0~rc.4/bootscript/bootscr.armadaxp flash-kernel-3.0~rc.4ubuntu62/bootscript/bootscr.armadaxp --- flash-kernel-3.0~rc.4/bootscript/bootscr.armadaxp 1970-01-01 00:00:00.000000000 +0000 +++ flash-kernel-3.0~rc.4ubuntu62/bootscript/bootscr.armadaxp 2014-09-29 22:21:38.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.; diff -Nru flash-kernel-3.0~rc.4/bootscript/bootscr.exynos5 flash-kernel-3.0~rc.4ubuntu62/bootscript/bootscr.exynos5 --- flash-kernel-3.0~rc.4/bootscript/bootscr.exynos5 1970-01-01 00:00:00.000000000 +0000 +++ flash-kernel-3.0~rc.4ubuntu62/bootscript/bootscr.exynos5 2014-09-29 22:21:38.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 diff -Nru flash-kernel-3.0~rc.4/bootscript/bootscr.highbank flash-kernel-3.0~rc.4ubuntu62/bootscript/bootscr.highbank --- flash-kernel-3.0~rc.4/bootscript/bootscr.highbank 1970-01-01 00:00:00.000000000 +0000 +++ flash-kernel-3.0~rc.4ubuntu62/bootscript/bootscr.highbank 2014-09-29 22:21:38.000000000 +0000 @@ -0,0 +1,7 @@ +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 diff -Nru flash-kernel-3.0~rc.4/bootscript/bootscr.keystone2 flash-kernel-3.0~rc.4ubuntu62/bootscript/bootscr.keystone2 --- flash-kernel-3.0~rc.4/bootscript/bootscr.keystone2 1970-01-01 00:00:00.000000000 +0000 +++ flash-kernel-3.0~rc.4ubuntu62/bootscript/bootscr.keystone2 2014-09-29 22:21:38.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} diff -Nru flash-kernel-3.0~rc.4/bootscript/bootscr.omap flash-kernel-3.0~rc.4ubuntu62/bootscript/bootscr.omap --- flash-kernel-3.0~rc.4/bootscript/bootscr.omap 2012-03-09 15:11:01.000000000 +0000 +++ flash-kernel-3.0~rc.4ubuntu62/bootscript/bootscr.omap 2014-09-29 22:21:38.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 diff -Nru flash-kernel-3.0~rc.4/bootscript/bootscr.xgene flash-kernel-3.0~rc.4ubuntu62/bootscript/bootscr.xgene --- flash-kernel-3.0~rc.4/bootscript/bootscr.xgene 1970-01-01 00:00:00.000000000 +0000 +++ flash-kernel-3.0~rc.4ubuntu62/bootscript/bootscr.xgene 2014-09-29 22:21:38.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} diff -Nru flash-kernel-3.0~rc.4/bootscript/bootscr.xgene-mustang flash-kernel-3.0~rc.4ubuntu62/bootscript/bootscr.xgene-mustang --- flash-kernel-3.0~rc.4/bootscript/bootscr.xgene-mustang 1970-01-01 00:00:00.000000000 +0000 +++ flash-kernel-3.0~rc.4ubuntu62/bootscript/bootscr.xgene-mustang 2014-09-29 22:21:38.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} diff -Nru flash-kernel-3.0~rc.4/bootscript/uEnvtxt.omap flash-kernel-3.0~rc.4ubuntu62/bootscript/uEnvtxt.omap --- flash-kernel-3.0~rc.4/bootscript/uEnvtxt.omap 1970-01-01 00:00:00.000000000 +0000 +++ flash-kernel-3.0~rc.4ubuntu62/bootscript/uEnvtxt.omap 2014-09-29 22:21:38.000000000 +0000 @@ -0,0 +1,2 @@ +bootcmd=fatload mmc 0:1 0x80000000 uImage;fatload mmc 0:1 0x81600000 uInitrd; bootm 0x80000000 0x81600000 +uenvcmd=boot diff -Nru flash-kernel-3.0~rc.4/bootscript/uEnvtxt.wandboard flash-kernel-3.0~rc.4ubuntu62/bootscript/uEnvtxt.wandboard --- flash-kernel-3.0~rc.4/bootscript/uEnvtxt.wandboard 1970-01-01 00:00:00.000000000 +0000 +++ flash-kernel-3.0~rc.4ubuntu62/bootscript/uEnvtxt.wandboard 2014-09-29 22:21:38.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 diff -Nru flash-kernel-3.0~rc.4/bootscript/uboot.env.rpi2 flash-kernel-3.0~rc.4ubuntu62/bootscript/uboot.env.rpi2 --- flash-kernel-3.0~rc.4/bootscript/uboot.env.rpi2 1970-01-01 00:00:00.000000000 +0000 +++ flash-kernel-3.0~rc.4ubuntu62/bootscript/uboot.env.rpi2 2016-02-12 19:43:23.000000000 +0000 @@ -0,0 +1,7 @@ +bootcmd=run boot_ubuntu +boot_ubuntu=run setup; run loadkernel; run loadinitrd; bootz ${kernel_addr_r} ${ramdisk_addr_r}:${initrdsize} 0x100 +setup=fdt addr 0x100; fdt get value bootargs /chosen bootargs +loadkernel=fatload mmc 0:1 ${kernel_addr_r} vmlinuz +loadinitrd=fatload mmc 0:1 ${ramdisk_addr_r} initrd.img; setenv initrdsize $filesize +kernel_addr_r=0x01000000 +ramdisk_addr_r=0x02100000 diff -Nru flash-kernel-3.0~rc.4/db/all.db flash-kernel-3.0~rc.4ubuntu62/db/all.db --- flash-kernel-3.0~rc.4/db/all.db 2012-03-10 00:14:30.000000000 +0000 +++ flash-kernel-3.0~rc.4ubuntu62/db/all.db 2016-02-12 01:31:51.000000000 +0000 @@ -1,5 +1,17 @@ # somewhat RFC2822 based, but case sensitive, not tolerant to spaces etc. +Machine: APM X-Gene Mustang board +U-Boot-Kernel-Address: 0x80000 +U-Boot-Initrd-Address: 0x0 +U-Boot-Script-Address: 0x4004000000 +U-Boot-Script-Name: bootscr.xgene-mustang +Required-Packages: u-boot-tools +Boot-Kernel-Path: /boot/uImage +Boot-Initrd-Path: /boot/uInitrd +Boot-Dtb-Path: /boot/apm-mustang.dtb +Boot-Script-Path: /boot/boot.scr +DTB-Id: apm-mustang.dtb + Machine: Buffalo Linkstation LiveV3 (LS-CHL) Kernel-Flavors: orion5x Machine-Id: 2913 @@ -97,6 +109,18 @@ Required-packages: u-boot-tools Bootloader-sets-root: yes +Machine: Calxeda Highbank +Kernel-Flavors: generic highbank +Required-Packages: u-boot-tools +Boot-Script-Path: /boot/boot.scr +U-Boot-Script-Name: bootscr.highbank + +Machine: Calxeda ECX-2000 +Kernel-Flavors: generic-lpae generic highbank +Required-Packages: u-boot-tools +Boot-Script-Path: /boot/boot.scr +U-Boot-Script-Name: bootscr.highbank + Machine: HP Media Vault mv2120 Kernel-Flavors: orion5x Machine-Id: 1693 @@ -108,6 +132,23 @@ Required-packages: u-boot-tools Bootloader-sets-root: yes +Machine: HP ProLiant m400 Server Cartridge +U-Boot-Kernel-Address: 0x80000 +U-Boot-Initrd-Address: 0x0 +U-Boot-Script-Address: 0x4004000000 +U-Boot-Script-Name: bootscr.xgene +Required-Packages: u-boot-tools +Boot-Kernel-Path: /boot/uImage +Boot-Initrd-Path: /boot/uInitrd +Boot-Script-Path: /boot/boot.scr + +Machine: HP ProLiant m800 Server Cartridge +Kernel-Flavors: keystone +U-Boot-Script-Address: 0x0 +U-Boot-Script-Name: bootscr.keystone2 +Required-Packages: u-boot-tools +Boot-Script-Path: /boot/boot.scr + Machine: HP t5325 Thin Client Kernel-Flavors: kirkwood Machine-Id: 2846 @@ -137,6 +178,17 @@ Required-packages: apex-nslu2 nslu2-utils Bootloader-sets-root: no +Machine: Marvell Armada XP Development Board +Kernel-Flavors: armadaxp +U-Boot-Kernel-Address: 0x8000 +U-Boot-Initrd-Address: 0x0 +U-Boot-Script-Address: 0x1000 +U-Boot-Script-Name: bootscr.armadaxp +Boot-Kernel-Path: /boot/uImage +Boot-Initrd-Path: /boot/uInitrd +Required-Packages: u-boot-tools +Bootloader-sets-root: no + Machine: Marvell DB-78x00-BP Development Board U-Boot-Kernel-Address: 0x8000 U-Boot-Initrd-Address: 0x0 @@ -199,18 +251,34 @@ Required-Packages: u-boot-tools Bootloader-sets-root: no +Machine: OMAP3 Beagle Board +Method: generic +U-Boot-Kernel-Address: 0x80008000 +U-Boot-Initrd-Address: 0x0 +U-Boot-Script-Address: 0x0 +U-Boot-Script-Name: uEnvtxt.omap +Boot-Device: /dev/mmcblk0p1 +Boot-Kernel-Path: uImage +Boot-Initrd-Path: uInitrd +Boot-Script-Path: preEnv.txt +Required-Packages: u-boot-tools +Bootloader-sets-root: yes + Machine: OMAP4 Panda board +Machine: TI OMAP4 PandaBoard Method: generic U-Boot-Kernel-Address: 0x80008000 U-Boot-Initrd-Address: 0x0 U-Boot-Script-Address: 0x0 -U-Boot-Script-Name: bootscr.omap +U-Boot-Script-Name: uEnvtxt.omap Boot-Device: /dev/mmcblk0p1 Boot-Kernel-Path: uImage Boot-Initrd-Path: uInitrd -Boot-Script-Path: boot.scr +Boot-Script-Path: preEnv.txt Required-Packages: u-boot-tools -Bootloader-sets-root: no +Bootloader-sets-root: yes +DTB-Kernel-Version: 3.11 +DTB-Id: omap4-panda-es.dtb Machine: QNAP TS-109/TS-209 Kernel-Flavors: orion5x @@ -248,6 +316,34 @@ Required-Packages: u-boot-tools Bootloader-sets-root: yes +Machine: SAMSUNG SSDK5440 board based on EXYNOS5440 +Kernel-Flavors: exynos5 exynos generic +U-Boot-Kernel-Address: 0x80008000 +U-Boot-Initrd-Address: 0x80000000 +U-Boot-Script-Address: 0x80001000 +U-Boot-Script-Name: bootscr.exynos5 +DTB-Id: exynos5440-ssdk5440.dtb +DTB-Kernel-Version: 3.11 +Boot-Kernel-Path: /boot/uImage +Boot-Initrd-Path: /boot/uInitrd +Boot-Script-Path: /boot/boot.scr +Required-Packages: u-boot-tools +Bootloader-sets-root: no + +Machine: SAMSUNG SD5v1 board based on EXYNOS5440 +Kernel-Flavors: exynos5 generic +U-Boot-Kernel-Address: 0x80008000 +U-Boot-Initrd-Address: 0x80000000 +U-Boot-Script-Address: 0x80001000 +U-Boot-Script-Name: bootscr.exynos5 +DTB-Id: exynos5440-sd5v1.dtb +DTB-Kernel-Version: 3.11 +Boot-Kernel-Path: /boot/uImage +Boot-Initrd-Path: /boot/uInitrd +Boot-Script-Path: /boot/boot.scr +Required-Packages: u-boot-tools +Bootloader-sets-root: no + Machine: Seagate FreeAgent DockStar Kernel-Flavors: kirkwood U-Boot-Kernel-Address: 0x00008000 @@ -270,3 +366,54 @@ Android-Boot-Device: /dev/mmcblk0 Required-Packages: abootimg Bootloader-sets-root: no + +Machine: grouper +Method: android +Android-Boot-Device: /dev/mmcblk0 +Required-Packages: abootimg +Bootloader-sets-root: yes + +Machine: QCT APQ8064 MAKO +Method: android +Android-Boot-Device: /dev/block/platform/msm_sdcc.1/by-name/boot +Android-Skip-Initrd: yes +Required-Packages: abootimg +Bootloader-sets-root: yes + +Machine: Wandboard i.MX6 Quad Board +Method: generic +U-Boot-Kernel-Address: 0x10008000 +U-Boot-Initrd-Address: 0x0 +U-Boot-Script-Address: 0x0 +U-Boot-Script-Name: uEnvtxt.wandboard +Boot-Device: /dev/disk/by-path/platform-2198000.usdhc-part1 +Boot-Kernel-Path: uImage +Boot-Initrd-Path: uInitrd +Boot-Script-Path: preEnv.txt +Required-Packages: u-boot-tools +Bootloader-sets-root: yes +DTB-Kernel-Version: 3.12 +DTB-Id: imx6q-wandboard.dtb + +# No-op entries +## qemu instance on armhf +Machine: Dummy Virtual Machine + +## qemu instance on arm64 +Machine: linux,dummy-virt + +## ARMv8 Foundation Model +Machine: Foundation-v8A + +# RaspberryPi2+ +Machine: BCM2709 +Machine: Raspberry Pi 2 Model B +Machine: Raspberry Pi 2 Model B Rev 1.1 +U-Boot-Script-Name: uboot.env.rpi2 +Required-Packages: u-boot-tools +Boot-Dtb-Path: /boot/firmware/bcm2709-rpi-2-b.dtb +Boot-Kernel-Path: /boot/firmware/vmlinuz +Boot-Initrd-Path: /boot/firmware/initrd.img +Boot-Script-Path: /boot/firmware/uboot.env +DTB-Id: bcm2709-rpi-2-b.dtb +# XXX we should copy the entire overlay dtbs dir too diff -Nru flash-kernel-3.0~rc.4/debian/changelog flash-kernel-3.0~rc.4ubuntu62/debian/changelog --- flash-kernel-3.0~rc.4/debian/changelog 2012-03-11 14:51:49.000000000 +0000 +++ flash-kernel-3.0~rc.4ubuntu62/debian/changelog 2016-02-14 07:25:40.000000000 +0000 @@ -1,3 +1,471 @@ +flash-kernel (3.0~rc.4ubuntu62) xenial; urgency=medium + + * Adjust the size of uboot.env based on empirical results on the rpi2. + + -- Steve Langasek Sat, 13 Feb 2016 23:25:39 -0800 + +flash-kernel (3.0~rc.4ubuntu61) xenial; urgency=medium + + * Adjust the uboot.env.rpi2 to use the one Paolo Pisati has tested, + instead of trying to base on the Snappy one, which is failing to boot. + + -- Steve Langasek Fri, 12 Feb 2016 11:44:45 -0800 + +flash-kernel (3.0~rc.4ubuntu60) xenial; urgency=medium + + * Extend support for the RPi2 to actually install the kernel/initramfs + on the fat partition, and provide a uboot boot script based on the one + used for Snappy images. + * Extend functions to support generating uboot.env images, as an + alternative to boot.scr and uEnv.txt, and use this for RPi2 as well. + * Cherry-pick fixes from Debian to support copying kernel/initrd to + destination. + + -- Steve Langasek Thu, 11 Feb 2016 17:09:53 -0800 + +flash-kernel (3.0~rc.4ubuntu59) xenial; urgency=medium + + * Add support for the Raspberry Pi2; thanks to Paolo Pisati + * . + + -- Steve Langasek Tue, 09 Feb 2016 22:35:28 -0800 + +flash-kernel (3.0~rc.4ubuntu58) xenial; urgency=medium + + * Call systemd-detect-virt instead of the Ubuntu specific + running-in-container wrapper. (LP: #1539016) + + -- Martin Pitt Thu, 28 Jan 2016 14:22:57 +0100 + +flash-kernel (3.0~rc.4ubuntu57) xenial; urgency=medium + + * Cherry pick from Debian: Succeed but do nothing when run on an + unknown machine which was booted via EFI. (LP: #1517582) + + -- dann frazier Tue, 01 Dec 2015 13:51:27 -0700 + +flash-kernel (3.0~rc.4ubuntu56) xenial; urgency=medium + + * make the package postinst respect FLASH_KERNEL_SKIP (LP: #1517582) + + -- Oliver Grawert Wed, 25 Nov 2015 21:12:16 +0100 + +flash-kernel (3.0~rc.4ubuntu55) wily; urgency=medium + + * Wandboard: Use /dev/disk/by-path/platform-2198000.usdhc-part1 + instead of the hardcoded mmcblk1p1, this should make things work on + boards with just a single microSD card in. + + -- Stéphane Graber Thu, 27 Aug 2015 11:55:41 -0400 + +flash-kernel (3.0~rc.4ubuntu54) vivid; urgency=medium + + * Allow us to find DTBs in both the old flat layout and the new vendor + subdirectory layout, so we keep backward compatibility (LP: #1408004) + + -- Adam Conrad Fri, 27 Feb 2015 03:46:28 -0700 + +flash-kernel (3.0~rc.4ubuntu53) utopic; urgency=medium + + * Merge in remaining trusty SRU changes: + * Add U-Boot environment configuration support (LP: #1328597) + * HP Moonshot Cartridges: Use $baudrate from u-boot environment as + serial console speed (LP: #1373628) + * HP Moonshot Cartridges: Enable hardware flow control as required by + the HP moonshot chassis (LP: #1328280) + * Enable U-Boot environment support for X-Gene platforms + * Use filesystem agnostic "load" command instead of assuming ext4 + * Add support for HP ProLiant m800 cartridges (LP: #1326437) + * Set required boot arguments for HP ProLiant m800 cartridges + (LP: #1373659) + + -- dann frazier Mon, 29 Sep 2014 16:20:15 -0600 + +flash-kernel (3.0~rc.4ubuntu52) utopic; urgency=medium + + * Do not fail if there are no specified Kernel-Flavors for this machine. + + -- Scott Moser Wed, 27 Aug 2014 15:59:26 -0400 + +flash-kernel (3.0~rc.4ubuntu51) utopic; urgency=medium + + * Filter the selection of 'latest' usable kernel through the + whitelist. (LP: #1356569) + + -- Manoj Iyer Tue, 19 Aug 2014 14:27:33 -0500 + +flash-kernel (3.0~rc.4ubuntu50) utopic; urgency=medium + + * Added support for user defined uboot environment variables + * Added support for HP ProLiant m800 Server Cartridge + + -- Manoj Iyer Thu, 24 Apr 2014 17:34:28 -0500 + +flash-kernel (3.0~rc.4ubuntu49) trusty; urgency=medium + + * db/all.db: add dummy entries as noops when running on VMs (LP: #1298070) + + -- Adam Conrad Thu, 10 Apr 2014 04:15:37 -0600 + +flash-kernel (3.0~rc.4ubuntu48) trusty; urgency=medium + + * Update APM X-Gene config to match upstream device tree filename/model + * Add a bootscript specific to X-Gene Mustang boards since they need to + pull their dtb from the OS. + + -- dann frazier Tue, 18 Mar 2014 16:31:38 -0600 + +flash-kernel (3.0~rc.4ubuntu47) trusty; urgency=medium + + * Add support for HP ProLiant m400 Server Cartridges (LP: #1287910) + + -- dann frazier Wed, 12 Mar 2014 15:10:43 +0100 + +flash-kernel (3.0~rc.4ubuntu46) trusty; urgency=low + + * Add support for APM X-Gene + * Add support for installing dtb files in boot partition; activate this for + APM X-Gene boards + + -- dann frazier Mon, 23 Dec 2013 14:51:32 -0700 + +flash-kernel (3.0~rc.4ubuntu45) trusty; urgency=low + + * bootscr.highbank: allow more space to load larger kernels (LP: #1250495) + + -- Adam Conrad Wed, 11 Dec 2013 03:48:23 -0700 + +flash-kernel (3.0~rc.4ubuntu44) trusty; urgency=low + + * flash-kernel-installer: make installable on armhf/exynos5 (LP: #1247601) + + -- dann frazier Wed, 13 Nov 2013 08:08:08 +0100 + +flash-kernel (3.0~rc.4ubuntu43) trusty; urgency=low + + * Add basic support for WandBoard Quad. + + -- Stéphane Graber Thu, 07 Nov 2013 23:57:58 -0500 + +flash-kernel (3.0~rc.4ubuntu42) saucy; urgency=low + + * Add support for EXYNOS5440-based platforms (LP: #1231249) + + -- dann frazier Thu, 03 Oct 2013 13:56:55 +0100 + +flash-kernel (3.0~rc.4ubuntu41) saucy; urgency=low + + * Fix typo in dtb_kver test that made it break all non-dtb platforms. + + -- Adam Conrad Sat, 21 Sep 2013 13:07:23 -0600 + +flash-kernel (3.0~rc.4ubuntu40) saucy; urgency=low + + * Apply patch from Paolo Pisati for appended DTB support (LP: #1223261) + + -- Adam Conrad Thu, 19 Sep 2013 10:27:47 -0600 + +flash-kernel (3.0~rc.4ubuntu39) saucy; urgency=low + + * Fix get_kfile_suffix() function to deal with flavours with dashes. + + -- Adam Conrad Tue, 10 Sep 2013 19:30:34 -0400 + +flash-kernel (3.0~rc.4ubuntu38) saucy; urgency=low + + * debian/flash-kernel-installer.isinstallable: add arm*/generic-lpae + + -- Adam Conrad Tue, 10 Sep 2013 17:43:52 -0400 + +flash-kernel (3.0~rc.4ubuntu37) saucy; urgency=low + + * And now fix the quoting error exposed by the fixed testsuite. + + -- Adam Conrad Tue, 10 Sep 2013 15:22:49 -0400 + +flash-kernel (3.0~rc.4ubuntu36) saucy; urgency=low + + * Fix the testsuite to work with the new DT model support and add + a new test to specifically try to use a DT instead of cpuinfo. + + -- Adam Conrad Tue, 10 Sep 2013 14:59:04 -0400 + +flash-kernel (3.0~rc.4ubuntu35) saucy; urgency=low + + * Check /proc/device-tree/model before /proc/cpuinfo (LP: #1164484) + * Add support for Calxeda ECX-2000 to the machine DB (LP: #1223439) + * Add generic-lpae to the XB-Subarchitecture list in debian/control + * Update the Highbank entry in DB to use its device-tree model name + + -- Adam Conrad Tue, 10 Sep 2013 14:36:05 -0400 + +flash-kernel (3.0~rc.4ubuntu34) saucy; urgency=low + + * Extending Android specific options to cover the Ubuntu Touch use cases + (flashing to a specific device and support skipping initrd) + * Enabling support for mako (Nexus 4) + + -- Ricardo Salveti de Araujo Tue, 14 May 2013 04:27:01 -0300 + +flash-kernel (3.0~rc.4ubuntu33) raring; urgency=low + + * Also update XB-Subarchitecture to use "generic" instead of 'highbank" + (LP: #1170515) + + -- dann frazier Sun, 21 Apr 2013 09:36:29 -0600 + +flash-kernel (3.0~rc.4ubuntu32) raring; urgency=low + + * flash-plugin-installer: make installable on armhf/generic for highbank + + -- dann frazier Thu, 18 Apr 2013 16:39:18 -0600 + +flash-kernel (3.0~rc.4ubuntu31) raring; urgency=low + + * Accept "generic" as a valid kernel flavor on highbank (LP: #1164074) + + -- dann frazier Wed, 03 Apr 2013 12:48:56 -0600 + +flash-kernel (3.0~rc.4ubuntu30) raring; urgency=low + + * Do not run flash-kernel inside an LXC container (LP: #1160360) + + -- Jean-Baptiste Lallement Wed, 27 Mar 2013 16:29:20 +0100 + +flash-kernel (3.0~rc.4ubuntu29) raring; urgency=low + + * determine the latest installer kernel version in the target rootfs instead + of assuming the version is the same as the running kernel (LP: #1084106) + * drop the "|| true" from the initramfs building code, if we fail here we + actually dont want to attempt to flash that + + -- Oliver Grawert Tue, 04 Dec 2012 17:24:49 +0100 + +flash-kernel (3.0~rc.4ubuntu28) raring; urgency=low + + * make sure blkid only gives us the UUID and not any other metadata like + labels or filesystem (LP: #1079185) + + -- Oliver Grawert Fri, 16 Nov 2012 15:40:21 +0100 + +flash-kernel (3.0~rc.4ubuntu27) quantal; urgency=low + + * add support for the grouper architecture + + -- Oliver Grawert Mon, 08 Oct 2012 14:44:41 +0200 + +flash-kernel (3.0~rc.4ubuntu26) quantal-proposed; urgency=low + + * make sure that /dev is bind mounted in /target when running + update-initramfs from flash-kernel-installer, else we do not find the boot + media (this is only a workaround for LP: #1056482 actual fixing of the + netinst environment is needed to fix this properly) + + -- Oliver Grawert Wed, 26 Sep 2012 15:27:06 +0200 + +flash-kernel (3.0~rc.4ubuntu25) quantal; urgency=low + + * make sure we only rename the bootrom partition so udisks hides it, + when using mkdosfs for setting the label like we did in jasper (where + we cached the contents before doing this) MLO and u-boot.bin are gone + (LP: #1055938). + + -- Oliver Grawert Tue, 25 Sep 2012 10:31:32 +0200 + +flash-kernel (3.0~rc.4ubuntu24) quantal; urgency=low + + * hide the boot device from udisk's automounting after installation + on all systems using uEnv.txt to configure u-boot + + -- Oliver Grawert Mon, 17 Sep 2012 14:25:37 +0200 + +flash-kernel (3.0~rc.4ubuntu23) quantal; urgency=low + + * initramfs-tools/hooks/flash_kernel_set_root: + - make sure that if we dont want to override the bootloader root= option by + setting "Bootloader-sets-root: yes", we actually dont do it + - Also check for FLASH_KERNEL_SKIP to avoid setting up the root parameter + in case flash-kernel will not be used + - this is a slightly different approach to fix bug (LP: #1034734) than the + patch attached to the bug. + + -- Oliver Grawert Thu, 13 Sep 2012 14:02:48 +0200 + +flash-kernel (3.0~rc.4ubuntu22) quantal; urgency=low + + * do not move the original uEnvtxt.omap to the target, use a copy instead + * make /etc/default/flash-kernel a proper conffile + + -- Oliver Grawert Thu, 23 Aug 2012 11:49:01 +0200 + +flash-kernel (3.0~rc.4ubuntu21) quantal; urgency=low + + * switch omap3 and omap4 to uEnv.txt/preEnv.txt (the former holds all active + boot commands, the latter holds the kernel commandline only) + * enable generation of a /etc/default/flash-kernel file from + flash-kernel-installer holding a UBOOT_DEFAULTS variable with distro + default settings (ro quiet splash) + * enable UUID detection of the currently used root device + * if uEnv.txt is defined in the db for an arch, generate preEnv.txt from + UBOOT_DEFAULTS and UUID detection data + * switch omap3 and omap4 from Bootloader-sets-root: no to yes, we now + generate a root=UUID= line on the fly for arches using uEnv.txt/preEnv.txt + * introduce bootscript/uEnvtxt.omap + + -- Oliver Grawert Wed, 22 Aug 2012 21:56:09 +0200 + +flash-kernel (3.0~rc.4ubuntu20) quantal; urgency=low + + * seemingly -k all doesnt want to work with -c, use -k $(uname -r) for now + + -- Oliver Grawert Fri, 10 Aug 2012 18:29:34 +0200 + +flash-kernel (3.0~rc.4ubuntu19) quantal; urgency=low + + * flash-kernel-installer.postinst: now that we have a diversion in place + there isnt a pre-existing initrd, instead of calling update-initramfs -u + we better call update-initramfs -c -k all to create one from scratch, + fixes (LP: #1035269) + + -- Oliver Grawert Fri, 10 Aug 2012 17:49:00 +0200 + +flash-kernel (3.0~rc.4ubuntu18) quantal; urgency=low + + * make post-base-installer.d/01flash-kernel-diversion executable + + -- Oliver Grawert Thu, 09 Aug 2012 13:59:15 +0200 + +flash-kernel (3.0~rc.4ubuntu17) quantal; urgency=low + + * sigh, not only drop the creation of /var/lib/flash-kernel/configured but + also the check for its existance, else we will always exit 0 + + -- Oliver Grawert Tue, 07 Aug 2012 20:03:20 +0200 + +flash-kernel (3.0~rc.4ubuntu16) quantal; urgency=low + + * re-add a diversion for update-initramfs to live-installers + post-base-installer.d to avoid update-initramfs runs before + flash-kernel is configured + * re-add a check for the diverted update-initramfs to + flash-kernel-installer, so it gets reverted before we try to call + update-initramfs + * drop teh super ugly hack that added a /var/lib/flash-kernel/configured + file to actually check if flash-kernel is configured + + -- Oliver Grawert Tue, 07 Aug 2012 19:52:51 +0200 + +flash-kernel (3.0~rc.4ubuntu15) quantal; urgency=low + + * Fix armadaxp kernel load address (LP: #1026835). + + -- Robie Basak Tue, 31 Jul 2012 16:31:30 +0100 + +flash-kernel (3.0~rc.4ubuntu14) quantal-proposed; urgency=low + + * better do the "configured" check in /var/lib + + -- Oliver Grawert Wed, 25 Jul 2012 18:03:18 +0200 + +flash-kernel (3.0~rc.4ubuntu13) quantal-proposed; urgency=low + + * add very very ugly temporary workaround to make quantal A3 arm server + installs possible (yes, i suck) + + -- Oliver Grawert Wed, 25 Jul 2012 17:16:16 +0200 + +flash-kernel (3.0~rc.4ubuntu12) quantal; urgency=low + + * remove the diversion code again, it doesnt help since + flash-kernel-installer.udeb only comes into play to late so the + post-base-installer.d file isnt available at live-installer time + + -- Oliver Grawert Wed, 25 Jul 2012 14:38:24 +0200 + +flash-kernel (3.0~rc.4ubuntu11) quantal; urgency=low + + * make post-base-installer.d/01flash-kernel-diversion actually an executable + shell script + + -- Oliver Grawert Tue, 24 Jul 2012 15:33:46 +0200 + +flash-kernel (3.0~rc.4ubuntu10) quantal; urgency=low + + * add a diversion for update-initramfs to live-installers + post-base-installer.d to avoid update-initramfs runs before + flash-kernel is configured + * add a check for the diverted update-initramfs to flash-kernel-installer, + so it gets reverted before we try to call update-initramfs + + -- Oliver Grawert Tue, 24 Jul 2012 15:28:37 +0200 + +flash-kernel (3.0~rc.4ubuntu9) quantal; urgency=low + + * Also add omap and omap4 to flash-kernel-installer.isinstallable. + + -- Luke Yelavich Fri, 20 Jul 2012 11:42:33 +1000 + +flash-kernel (3.0~rc.4ubuntu8) quantal; urgency=low + + * debian/control: Re-add omap and omap4 to the flash-kernel-installer + XB-Subarchitecture field. These appear to have been lost somewhere along + the way. + + -- Luke Yelavich Fri, 20 Jul 2012 11:39:08 +1000 + +flash-kernel (3.0~rc.4ubuntu7) quantal; urgency=low + + * make sure the call to abootimg -i does not make the script fail (checking + non bootimg devices makes it return 1 even though there is no error, this + in turn makes teh whole script fail since we run with "set -e") + + -- Oliver Grawert Tue, 17 Jul 2012 13:20:43 +0200 + +flash-kernel (3.0~rc.4ubuntu6) quantal; urgency=low + + * add DB entry for "OMAP3 Beagle Board" (funnily thats missing) + * add Panda to the list of supported board in the README file + + -- Oliver Grawert Fri, 06 Jul 2012 15:59:48 +0200 + +flash-kernel (3.0~rc.4ubuntu5) quantal; urgency=low + + * use umount -l in the cleanup function, else we fail while finishing up + with the script (LP: #1014139) + + -- Oliver Grawert Thu, 05 Jul 2012 19:43:02 +0200 + +flash-kernel (3.0~rc.4ubuntu4) quantal; urgency=low + + * also add FLASH_KERNEL_SKIP to the initramfs post update script, this + should finally fix ac100 image building + + -- Oliver Grawert Fri, 22 Jun 2012 11:20:39 +0200 + +flash-kernel (3.0~rc.4ubuntu3) quantal; urgency=low + + * re-add support for the FLASH_KERNEL_SKIP env variable, so the image build + infrastructure has a chance to skip the automated flash-kernel run during + image builds. + + -- Oliver Grawert Wed, 20 Jun 2012 16:41:28 +0200 + +flash-kernel (3.0~rc.4ubuntu2) quantal; urgency=low + + * add "quiet splash" as default options to omap bootscr + + -- Oliver Grawert Wed, 20 Jun 2012 16:25:31 +0200 + +flash-kernel (3.0~rc.4ubuntu1) quantal; urgency=low + + [ dann frazier ] + * Re-add support for Marvell ArmadaXP + + [ Robie Basak ] + * Add support for Calxeda Highbank + + -- Robie Basak Thu, 31 May 2012 10:09:53 +0100 + flash-kernel (3.0~rc.4) unstable; urgency=low * Upload to unstable diff -Nru flash-kernel-3.0~rc.4/debian/control flash-kernel-3.0~rc.4ubuntu62/debian/control --- flash-kernel-3.0~rc.4/debian/control 2012-03-10 00:13:25.000000000 +0000 +++ flash-kernel-3.0~rc.4ubuntu62/debian/control 2014-09-29 22:21:38.000000000 +0000 @@ -1,7 +1,8 @@ Source: flash-kernel Section: utils Priority: optional -Maintainer: Debian Install System Team +Maintainer: Ubuntu Developers +XSBC-Original-Maintainer: Debian Install System Team Uploaders: Loïc Minier , Hector Oron , Wouter Verhelst @@ -11,7 +12,7 @@ Vcs-Git: git://git.debian.org/d-i/flash-kernel.git Package: flash-kernel -Architecture: arm armel armeb armhf +Architecture: arm armel armeb armhf arm64 Depends: ${misc:Depends}, devio, initramfs-tools (>= 0.92f), @@ -28,8 +29,8 @@ Section: debian-installer Priority: standard XC-Package-Type: udeb -Architecture: arm armel armeb armhf -XB-Subarchitecture: iop32x ixp4xx kirkwood orion5x s3c24xx mx5 +Architecture: arm armel armeb armhf arm64 +XB-Subarchitecture: armadaxp exynos5 generic-lpae generic iop32x ixp4xx keystone kirkwood orion5x s3c24xx mx5 omap omap4 xgene Provides: bootable-system Depends: cdebconf-udeb, installed-base XB-Installer-Menu-Item: 7300 diff -Nru flash-kernel-3.0~rc.4/debian/dirs flash-kernel-3.0~rc.4ubuntu62/debian/dirs --- flash-kernel-3.0~rc.4/debian/dirs 2011-03-02 17:59:05.000000000 +0000 +++ flash-kernel-3.0~rc.4ubuntu62/debian/dirs 2014-09-29 22:21:38.000000000 +0000 @@ -1 +1,3 @@ +etc/flash-kernel/ubootenv.d usr/sbin +usr/share/flash-kernel/ubootenv.d diff -Nru flash-kernel-3.0~rc.4/debian/flash-kernel-installer.install flash-kernel-3.0~rc.4ubuntu62/debian/flash-kernel-installer.install --- flash-kernel-3.0~rc.4/debian/flash-kernel-installer.install 2012-03-09 15:11:01.000000000 +0000 +++ flash-kernel-3.0~rc.4ubuntu62/debian/flash-kernel-installer.install 2014-09-29 22:21:38.000000000 +0000 @@ -1,2 +1,3 @@ db usr/share/flash-kernel functions usr/share/flash-kernel +post-base-installer.d usr/lib/ diff -Nru flash-kernel-3.0~rc.4/debian/flash-kernel-installer.isinstallable flash-kernel-3.0~rc.4ubuntu62/debian/flash-kernel-installer.isinstallable --- flash-kernel-3.0~rc.4/debian/flash-kernel-installer.isinstallable 2011-08-24 13:09:41.000000000 +0000 +++ flash-kernel-3.0~rc.4ubuntu62/debian/flash-kernel-installer.isinstallable 2014-09-29 22:21:38.000000000 +0000 @@ -2,12 +2,27 @@ set -e case "`archdetect`" in + arm*/armadaxp) + exit 0 + ;; + arm*/exynos5) + exit 0 + ;; + arm*/generic) + exit 0 + ;; + arm*/generic-lpae) + exit 0 + ;; arm*/iop32x) exit 0 ;; arm*/ixp4xx) exit 0 ;; + arm*/keystone) + exit 0 + ;; arm*/kirkwood) exit 0 ;; @@ -20,6 +35,15 @@ arm*/s3c24xx) exit 0 ;; + arm*/omap) + exit 0 + ;; + arm*/omap4) + exit 0 + ;; + arm64/xgene) + exit 0 + ;; # Don't activate it by default *) exit 1 diff -Nru flash-kernel-3.0~rc.4/debian/flash-kernel-installer.postinst flash-kernel-3.0~rc.4ubuntu62/debian/flash-kernel-installer.postinst --- flash-kernel-3.0~rc.4/debian/flash-kernel-installer.postinst 2012-03-09 15:11:01.000000000 +0000 +++ flash-kernel-3.0~rc.4ubuntu62/debian/flash-kernel-installer.postinst 2014-09-29 22:21:38.000000000 +0000 @@ -24,6 +24,12 @@ mount | grep "on /target${1%/} " | tail -n1 | cut -d' ' -f1 } +# 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 + machine="$(get_cpuinfo_hardware)" if machine_uses_flash "$machine"; then @@ -65,7 +71,10 @@ : ;; *) - 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 @@ -95,6 +104,14 @@ 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 diff -Nru flash-kernel-3.0~rc.4/debian/flash-kernel.default flash-kernel-3.0~rc.4ubuntu62/debian/flash-kernel.default --- flash-kernel-3.0~rc.4/debian/flash-kernel.default 1970-01-01 00:00:00.000000000 +0000 +++ flash-kernel-3.0~rc.4ubuntu62/debian/flash-kernel.default 2014-09-29 22:21:38.000000000 +0000 @@ -0,0 +1 @@ +UBOOT_DEFAULTS="ro quiet splash" diff -Nru flash-kernel-3.0~rc.4/debian/flash-kernel.postinst flash-kernel-3.0~rc.4ubuntu62/debian/flash-kernel.postinst --- flash-kernel-3.0~rc.4/debian/flash-kernel.postinst 2012-03-09 15:11:01.000000000 +0000 +++ flash-kernel-3.0~rc.4ubuntu62/debian/flash-kernel.postinst 2015-11-25 20:12:13.000000000 +0000 @@ -3,7 +3,14 @@ set -e if [ "$1" = "triggered" ]; then - FLASH_KERNEL_NOTRIGGER=y flash-kernel + # we dont want to run if FLASH_KERNEL_SKIP is set, the ubuntu + # image build system uses this + if [ -n "$FLASH_KERNEL_SKIP" ]; then + echo "FLASH_KERNEL_SKIP is set, skipping flash-kernel call" + exit 0 + else + FLASH_KERNEL_NOTRIGGER=y flash-kernel + fi fi #DEBHELPER# diff -Nru flash-kernel-3.0~rc.4/functions flash-kernel-3.0~rc.4ubuntu62/functions --- flash-kernel-3.0~rc.4/functions 2012-03-09 15:12:03.000000000 +0000 +++ flash-kernel-3.0~rc.4ubuntu62/functions 2016-02-14 07:24:55.000000000 +0000 @@ -22,6 +22,7 @@ MACHINE_DB="$(cat "${FK_CHECKOUT:-$FK_DIR}/db/"*.db)" PROC_CPUINFO="/proc/cpuinfo" PROC_MTD="/proc/mtd" +PROC_DT="/proc/device-tree/model" error() { @@ -91,14 +92,25 @@ } } +get_root_uuid() { + echo $(blkid -o value -s UUID $(mount | grep "on /${1%/} " | tail -n1 | cut -d' ' -f1)) +} + get_cpuinfo_hardware() { - grep "^Hardware" "$PROC_CPUINFO" | sed 's/Hardware\s*:\s*//' + if [ -f "$PROC_DT" ]; then + cat "$PROC_DT" + else + grep "^Hardware" "$PROC_CPUINFO" | sed 's/Hardware\s*:\s*//' + fi } get_kfile_suffix() { local kfile="$1" + local full_version=${kfile#*-} + local flavour_abi=${full_version#*-} + local flavour=${flavour_abi#*-} - echo "$kfile" | sed -e 's/.*-//' + echo "$flavour" } # this is case-sensitive and doesn't support fields spanning multiple lines @@ -175,6 +187,30 @@ } >"$output" } +gen_ubootenv() { + ENVSTUBDIRS="/etc/flash-kernel/ubootenv.d /usr/share/flash-kernel/ubootenv.d" + ENVSTUBS="$(find $ENVSTUBDIRS -type f -regex '.*/[0-9a-zA-Z_-]+' -printf '%f\n' | LC_ALL=C sort -u)" + for file in $ENVSTUBS; do + for dir in $ENVSTUBDIRS; do + if [ -f $dir/$file ]; then + cat $dir/$file + break + fi + done + done +} + +append_dtb() { + local kernel="$1" + local dtb="$2" + local output="$3" + + { + cat "$kernel" + cat "$dtb" + } >"$output" +} + flash_kernel() { local input_file="$1" local output_mtd="$2" @@ -229,10 +265,19 @@ local sdesc="$2" local sdata="$3" local script="$4" + local tdata="$tmpdir/$(basename $sdata)" + + local ubootenv="$(mktemp --tmpdir=$tmpdir)" + gen_ubootenv > $ubootenv printf "Generating boot script u-boot image... " >&2 + sed -e "/@@UBOOT_ENV_EXTRA@@/{ + s/@@UBOOT_ENV_EXTRA@@//g + r $ubootenv + }" < $sdata > $tdata + mkimage -A arm -O linux -T script -C none -a "$saddr" -e "$saddr" \ - -n "$sdesc" -d "$sdata" "$script" >&2 1>/dev/null + -n "$sdesc" -d "$tdata" "$script" >&2 1>/dev/null echo "done." >&2 } @@ -249,6 +294,17 @@ echo "done." >&2 } +mkimage_env() { + local esize="$1" + local edata="$2" + local escript="$3" + + # FIXME: should leverage gen_ubootenv + printf "Generating u-boot environment image... " >&2 + mkenvimage -r -s "$esize" -o "$escript" "$edata" + echo "done." >&2 +} + backup_and_install() { local source="$1" local dest="$2" @@ -288,10 +344,39 @@ android_flash() { local device="$1" - printf "Flashing kernel and initramfs to $device... " >&2 - abootimg -u "$device" -k "$kfile" -r "$ifile" >/dev/null || - error "failed." - echo "done." >&2 + if [ -z "$android_skip_initrd" ]; then + printf "Flashing kernel and initramfs to $device... " >&2 + abootimg -u "$device" -k "$kfile" -r "$ifile" >/dev/null || + error "failed." + echo "done." >&2 + else + printf "Flashing the kernel (skipping initrd) to $device... " >&2 + abootimg -u "$device" -k "$kfile" >/dev/null || error "failed." + echo "done." >&2 + fi +} + +include_only_flavors() { + # include_only_flavors(flav1, flav2, flav3) + # filter lines of input in uname -r format (X.Y.Z-N-flavor) + # and filter-out anything that is not in the listed input + # if exactly zero flavors are given, then assume everything is a match + local cur_uname cur_flav allowed_flav + while read cur_uname; do + if [ $# -eq 0 ]; then + echo "$cur_uname" + else + # could use cur_flav=$(get_kfile_suffix "$cur_uname") + # but this is much faster. + cur_flav=${cur_uname#*-*-} + for allowed_flav in "$@"; do + if [ "${cur_flav}" = "${allowed_flav}" ]; then + echo "$cur_uname" + break + fi + done + fi + done } main() { @@ -312,7 +397,10 @@ # kernel + initrd installation/upgrade mode, with optional version kvers="$1" -latest_version=$(linux-version list | linux-version sort | tail -1) + +# if get_machine_field returns non-zero, then all flavors are allowed +kflavors="$(get_machine_field "$machine" "Kernel-Flavors")" || : +latest_version=$(linux-version list | include_only_flavors $kflavors | linux-version sort | tail -1) if [ -n "$kvers" ] && [ "$kvers" != "$latest_version" ]; then echo "Ignoring old or unknown version $kvers (latest is $latest_version)" >&2 exit 0 @@ -352,10 +440,15 @@ kfile_suffix=$(get_kfile_suffix "$kfile") if ! check_supported "$machine"; then + # do nothing if an unsupported platform is booted from EFI + if [ -d /sys/firmware/efi ]; then + echo "Unsupported platform on EFI system, doing nothing." + exit 0 + fi error "Unsupported platform." fi -if kflavors="$(get_machine_field "$machine" "Kernel-Flavors")"; then +if [ -n "$kflavors" ]; then if ! check_kflavors "$kfile_suffix" $kflavors; then echo "Kernel suffix $kfile_suffix does not match any of the expected flavors ($kflavors), therefore not writing it to flash." >&2 exit 0 @@ -368,17 +461,24 @@ method="$(get_machine_field "$machine" "Method")" || method="generic" mtd_kernel="$(get_machine_field "$machine" "Mtd-Kernel")" || : mtd_initrd="$(get_machine_field "$machine" "Mtd-Initrd")" || : +dtb_name="$(get_machine_field "$machine" "DTB-Id")" || : +dtb_kver="$(get_machine_field "$machine" "DTB-Kernel-Version")" || : ukaddr="$(get_machine_field "$machine" "U-Boot-Kernel-Address")" || : uiaddr="$(get_machine_field "$machine" "U-Boot-Initrd-Address")" || : umaddr="$(get_machine_field "$machine" "U-Boot-Multi-Address")" || : usaddr="$(get_machine_field "$machine" "U-Boot-Script-Address")" || : usname="$(get_machine_field "$machine" "U-Boot-Script-Name")" || : +# FIXME: currently hard coded because only RPi2 uses this; let's not define +# new fields without consulting with Debian. +ussize=16384 boot_device="$(get_machine_field "$machine" "Boot-Device")" || : boot_kernel_path="$(get_machine_field "$machine" "Boot-Kernel-Path")" || : boot_initrd_path="$(get_machine_field "$machine" "Boot-Initrd-Path")" || : boot_script_path="$(get_machine_field "$machine" "Boot-Script-Path")" || : +boot_dtb_path="$(get_machine_field "$machine" "Boot-Dtb-Path")" || : 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")" || : if [ -n "$mtd_kernel" ] || [ -n "$mtd_initrd" ]; then if [ ! -e "$PROC_MTD" ]; then @@ -423,7 +523,7 @@ cleanups() { rm -rf "$tmpdir" if [ -d "$boot_mnt_dir" ]; then - umount "$boot_mnt_dir" + umount -l "$boot_mnt_dir" rmdir "$boot_mnt_dir" fi } @@ -434,16 +534,19 @@ case "$method" in "android") - part="" - largest_size="-1" - for p in "$android_boot_device"*[0-9]; do - abootimg="$(LC_ALL=C abootimg -i "$p" 2>/dev/null)" - image_size="$(abootimg_get_image_size "$abootimg")" - if [ -n "$image_size" ] && - [ "$image_size" -gt "$largest_size" ]; then - part="$p" - fi - done + if abootimg -i "$android_boot_device" > /dev/null 2>&1; then + part="$android_boot_device" + else + largest_size="-1" + for p in "$android_boot_device"*[0-9]; do + abootimg="$(LC_ALL=C abootimg -i "$p" 2>/dev/null || true)" + image_size="$(abootimg_get_image_size "$abootimg")" + if [ -n "$image_size" ] && + [ "$image_size" -gt "$largest_size" ]; then + part="$p" + fi + done + fi if [ -z "$part" ]; then error "Couldn't find Android boot partition on $android_boot_device" fi @@ -456,6 +559,17 @@ gen_kernel "$kernel" "$tmpdir/kernel" "$machine_id" kernel="$tmpdir/kernel" fi + if [ -n "$dtb_kver" ]; then + if dpkg --compare-versions "$kvers" ge "$dtb_kver" >/dev/null; then + dtb="$(find /lib/firmware/$kvers/device-tree/ -name $dtb_name)" + if [ ! -f "$dtb" ] ; then + error "Couldn't find $dtb" + fi + append_dtb "$kernel" "$dtb" "$tmpdir/kernel.dtb" + mv "$tmpdir/kernel.dtb" "$tmpdir/kernel" + kernel="$tmpdir/kernel" + fi + fi if [ -n "$ukaddr" ]; then mkimage_kernel "$ukaddr" "$desc" "$kernel" \ "$tmpdir/uImage" @@ -477,17 +591,23 @@ if [ -n "$boot_kernel_path" ]; then boot_kernel_path="$boot_mnt_dir/$boot_kernel_path" # don't mv the original kernel - if [ "$kernel" != "$kfile" ]; then - backup_and_install "$kernel" \ - "$boot_kernel_path" - else - # TODO add support for kernel symlink - : + if [ "$kernel" = "$kfile" ]; then + cp "$kernel" "$tmpdir/kernel" + kernel="$tmpdir/kernel" fi + backup_and_install "$kernel" "$boot_kernel_path" elif [ -n "$kmtd" ]; then flash_kernel "$tmpdir/uImage" "$kmtd" "" rm -f "$tmpdir/uImage" fi + if [ -n "$dtb_name" ] && [ -n "$boot_dtb_path" ]; then + dtb="$(find /lib/firmware/$kvers/device-tree/ -name $dtb_name)" + if [ -f "$dtb" ]; then + cp "$dtb" "$tmpdir/$dtb_name" + dtb_path="$boot_mnt_dir/$boot_dtb_path" + backup_and_install "$tmpdir/$dtb_name" "$dtb_path" + fi + fi if [ -n "$boot_multi_path" ]; then backup_and_install "$tmpdir/uImage" "$boot_multi_path" fi @@ -499,13 +619,11 @@ if [ -n "$boot_initrd_path" ]; then boot_initrd_path="$boot_mnt_dir/$boot_initrd_path" # don't mv the original initrd - if [ "$initrd" != "$ifile" ]; then - backup_and_install "$initrd" \ - "$boot_initrd_path" - else - # TODO add support for initrd symlink - : + if [ "$initrd" = "$ifile" ]; then + cp "$initrd" "$tmpdir/initrd" + initrd="$tmpdir/initrd" fi + backup_and_install "$initrd" "$boot_initrd_path" elif [ -n "$imtd" ]; then ipad=0 # padding isn't needed for U-Boot images @@ -516,12 +634,40 @@ rm -f "$tmpdir/uInitrd" fi if [ -n "$boot_script_path" ]; then - boot_script_path="$boot_mnt_dir/$boot_script_path" - boot_script="$BOOTSCRIPTS_DIR/$usname" - mkimage_script "$usaddr" "boot script" "$boot_script" \ - "$tmpdir/boot.scr" - boot_script="$tmpdir/boot.scr" - backup_and_install "$boot_script" "$boot_script_path" + case $usname in + bootscr*) + boot_script_path="$boot_mnt_dir/$boot_script_path" + boot_script="$BOOTSCRIPTS_DIR/$usname" + mkimage_script "$usaddr" "boot script" "$boot_script" \ + "$tmpdir/boot.scr" + boot_script="$tmpdir/boot.scr" + backup_and_install "$boot_script" "$boot_script_path" + ;; + uboot.env*) + boot_script_path="$boot_mnt_dir/$boot_script_path" + boot_script="$BOOTSCRIPTS_DIR/$usname" + mkimage_env "$ussize" "$boot_script" \ + "$tmpdir/uboot.env" + boot_script="$tmpdir/uboot.env" + 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=$UBOOT_DEFAULTS root=UUID=$VOLID" > $env_script + + backup_and_install "$env_script" "$boot_script_env" + backup_and_install "$boot_script" "$boot_script_path" + ;; + esac fi ;; "symlink") diff -Nru flash-kernel-3.0~rc.4/initramfs-hook/flash-kernel flash-kernel-3.0~rc.4ubuntu62/initramfs-hook/flash-kernel --- flash-kernel-3.0~rc.4/initramfs-hook/flash-kernel 2012-03-09 15:11:01.000000000 +0000 +++ flash-kernel-3.0~rc.4ubuntu62/initramfs-hook/flash-kernel 2016-01-28 13:22:10.000000000 +0000 @@ -7,6 +7,17 @@ exit 0 fi +# we dont want to run if FLASH_KERNEL_SKIP is set, the ubuntu +# image build system uses this +if [ -n "$FLASH_KERNEL_SKIP" ]; then + exit 0 +fi + +# Do not run inside an LXC container +if systemd-detect-virt --quiet --container; then + exit 0 +fi + abi="$1" # ignored _initrd="$2" diff -Nru flash-kernel-3.0~rc.4/initramfs-tools/hooks/flash_kernel_set_root flash-kernel-3.0~rc.4ubuntu62/initramfs-tools/hooks/flash_kernel_set_root --- flash-kernel-3.0~rc.4/initramfs-tools/hooks/flash_kernel_set_root 2012-03-09 15:11:01.000000000 +0000 +++ flash-kernel-3.0~rc.4ubuntu62/initramfs-tools/hooks/flash_kernel_set_root 2016-01-28 13:21:47.000000000 +0000 @@ -47,6 +47,21 @@ . /usr/share/initramfs-tools/hook-functions +machine="$(get_cpuinfo_hardware)" + +# Should we override the root device or merely provide a default root +# device? +blsr="$(get_machine_field "$machine" "Bootloader-sets-root")" + +if [ "$blsr" = "yes" ] || [ -n "$FLASH_KERNEL_SKIP" ]; 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 @@ -91,22 +106,9 @@ pause_error fi -machine="$(get_cpuinfo_hardware)" - -# Should we override the root device or merely provide a default root -# device? -blsr="$(get_machine_field "$machine" "Bootloader-sets-root")" - -if [ "$blsr" = "no" ]; then - # The boot loader doesn't pass root= on the command line, so - # provide a default. - install -d $DESTDIR/conf/conf.d - echo "ROOT=\"$rootdev\"" > $DESTDIR/conf/conf.d/default_root -else - # The boot loader passes a bogus root= (e.g. root=/dev/ram), so - # override the command line parameter. - install -d $DESTDIR/conf - echo "ROOT=\"$rootdev\"" >> $DESTDIR/conf/param.conf -fi +# The boot loader doesn't pass root= on the command line, so +# provide a default. +install -d $DESTDIR/conf/conf.d +echo "ROOT=\"$rootdev\"" > $DESTDIR/conf/conf.d/default_root # vim:noexpandtab shiftwidth=8 diff -Nru flash-kernel-3.0~rc.4/kernel-hook/zz-flash-kernel flash-kernel-3.0~rc.4ubuntu62/kernel-hook/zz-flash-kernel --- flash-kernel-3.0~rc.4/kernel-hook/zz-flash-kernel 2012-03-09 15:11:01.000000000 +0000 +++ flash-kernel-3.0~rc.4ubuntu62/kernel-hook/zz-flash-kernel 2016-01-28 13:22:54.000000000 +0000 @@ -9,6 +9,17 @@ exit 0 fi +# we dont want to run if FLASH_KERNEL_SKIP is set, the ubuntu +# image build system uses this +if [ -n "$FLASH_KERNEL_SKIP" ]; then + exit 0 +fi + +# Do not run inside an LXC container +if systemd-detect-virt --quiet --container; then + exit 0 +fi + # this script is used as postinst.d and postrm.d script; this is used to # differentiate between the two self="$0" diff -Nru flash-kernel-3.0~rc.4/post-base-installer.d/01flash-kernel-diversion flash-kernel-3.0~rc.4ubuntu62/post-base-installer.d/01flash-kernel-diversion --- flash-kernel-3.0~rc.4/post-base-installer.d/01flash-kernel-diversion 1970-01-01 00:00:00.000000000 +0000 +++ flash-kernel-3.0~rc.4ubuntu62/post-base-installer.d/01flash-kernel-diversion 2014-09-29 22:21:38.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 diff -Nru flash-kernel-3.0~rc.4/test_functions flash-kernel-3.0~rc.4ubuntu62/test_functions --- flash-kernel-3.0~rc.4/test_functions 2012-03-09 15:11:01.000000000 +0000 +++ flash-kernel-3.0~rc.4ubuntu62/test_functions 2014-09-29 22:21:38.000000000 +0000 @@ -135,6 +135,23 @@ } add_test test_check_supported +test_get_cpuinfo_hardware_dt() { + get_tempfile + mock_proc_dt="$last_tempfile" + echo -n "Calxeda ECX-2000" > "$mock_proc_dt" + ( + . "$functions" + PROC_CPUINFO="" + PROC_DT="$mock_proc_dt" + machine=$(get_cpuinfo_hardware) + if [ "$machine" != "Calxeda ECX-2000" ]; then + echo "Expected machine to be Calxeda ECX-2000 but got $machine" >&2 + exit 1 + fi + ) +} +add_test test_get_cpuinfo_hardware_dt + test_get_cpuinfo_hardware() { get_tempfile mock_proc_cpuinfo="$last_tempfile" @@ -155,6 +172,7 @@ ( . "$functions" PROC_CPUINFO="$mock_proc_cpuinfo" + PROC_DT="" machine=$(get_cpuinfo_hardware) if [ "$machine" != "Marvell SheevaPlug Reference Board" ]; then echo "Expected machine to be Marvell SheevaPlug Reference Board but got $machine" >&2