Re: Providing (armhf) u-boot images together with d-i images?
On Thu, 2014-12-18 at 20:44 +0100, Karsten Merker wrote:
> On Thu, Dec 18, 2014 at 10:48:07AM -0800, Vagrant Cascadian wrote:
>
> > I don't know how realistic it is to provide concatenateable images with
> > the u-boot "bare" image as one file, and the kernel + initrd + dtb +
> > boot.scr as a second file to be appended to the bare image... but this
> > would minimize duplicate content considerably, at some expense in
> > installation instructions.
>
> I had also been thinking about implementing support for such a
> setup and have that still on my todo list. Technically building
> such concatenateable images is possible, but that would of course
> require that a single boot script in the filesystem image works
> on all platforms. I have not yet checked whether this feasible
> in practice.
Another approach might be to make the image building tool useful in a
standalone situation, so folks can download it and build their own
images reasonably easily (perhaps with automatic downloading of the
bits, finding them in /usr/lib/debian-installer/images/ etc). Extra
useful if it doesn't require a Debian host.
At one point I was hacking on something along those lines for
sunxi-tools to automate "install over FEL". I didn't get it done in time
for Jessie though, maybe Stretch. The hack is below, it's neither pretty
nor finished, I don't even recall if it was working when I last touched
it, but maybe there's some useful stuff there... (probably not...)
Ian.
diff --git a/debian/control b/debian/control
index 12c5255..8792735 100644
--- a/debian/control
+++ b/debian/control
@@ -12,6 +12,7 @@ Package: sunxi-tools
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Recommends: u-boot:armhf
+Suggests: debian-installer-netboot-armhf
Description: tools for working with Allwinner (sunxi) ARM processors
This package contains various tools for working with devices based around the
Allwinner sunxi processors (A10/A13/A20/A31 etc). Utilities include tools to:
diff --git a/debian/sunxi-debian-install-fel b/debian/sunxi-debian-install-fel
new file mode 100755
index 0000000..30a9778
--- /dev/null
+++ b/debian/sunxi-debian-install-fel
@@ -0,0 +1,144 @@
+#!/bin/bash
+
+# Copyright (C) 2014 Ian Campbell <ijc@hellion.org.uk>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+if [ $# -ne 2 ]; then
+ echo "Usage: $0 [BOARD|?] [DIVERSION] [HEADLESS]"
+ exit 1
+fi
+
+board=$1; shift
+diversion=$1; shift
+headless=${1:-n}; shift
+
+ubootdir=/usr/lib/u-boot
+didir=/usr/lib/debian-installer/images
+
+if [ x$board = x\? ]; then
+ echo "Known boards:"
+ for i in $ubootdir/*_FEL ; do
+ if [ x$i = x$ubootdir/\*_FEL ]; then
+ echo "No boards found in $ubootdir"
+ exit 1
+ fi
+ if [ -e $i/u-boot-spl.bin ]; then
+ board=$(basename ${i%_FEL})
+ echo " - $board"
+ fi
+ done
+ exit 0
+fi
+
+spl=$ubootdir/${board}_FEL/u-boot-spl.bin
+uboot=$ubootdir/${board}_FEL/u-boot.bin
+
+if [ ! -e "$spl" ] ; then
+ echo "u-boot SPL binary $spl not found" >&2
+ exit 1
+fi
+if [ ! -e "$uboot" ] ; then
+ echo "u-boot binary $uboot not found" >&2
+ exit 1
+fi
+
+case $diversion in
+ daily)
+ diurl=http://d-i.debian.org/daily-images/armhf/daily
+ ;;
+ daily:*) # e.g daily:20140704-05:23
+ diurl=http://d-i.debian.org/daily-images/armhf/${diversion#daily:}
+ ;;
+ *:*)
+ dist=${diversion%:*}
+ ver=${diversion##%:}
+ diurl="ftp://ftp.debian.org/debian/dists/$dist/main/installer-armhf/$ver/images/armmp/netboot/"
+ ;;
+ *)
+ dipath=/usr/lib/debian-installer/images/$diversion/armhf
+ if [ ! -d $dipath ] ; then
+ echo "Unknown di version $diversion" >&2
+ exit 1
+ fi
+esac
+
+# XXX fdtfile?
+fdtfile=sun7i-a20-cubieboard2.dtb
+
+if [ x$HEADLESS = xy ] ; then
+ # XXX ask questions...
+ bootargs="hostname=cubietruck domain=hellion.org.uk network-console/password=password network-console/password-again=password --"
+ kernel=$(get_file netboot/vmlinuz)
+ ramdisk=$(get_file network-console/initrd.gz)
+else
+ bootargs="console=ttyS0,115200n8 -- console=ttyS0,114200n8"
+
+ kernel=$(get_file netboot/vmlinuz)
+ ramdisk=$(get_file network-console/initrd.gz)
+fi
+fdt=$(get_file device-tree/$fdtfile)
+
+TO_CLEAN=
+trap '
+for C in ${TO_CLEAN} ; do
+ rm $C
+done
+' EXIT
+
+get_temp() {
+ local t=$(mktemp) || exit 1
+ TO_CLEAN="$TO_CLEAN $t"
+ echo $t
+ return 0
+}
+get_file() {
+ local f=$1; shift
+
+ if [ -n "$dipath" ] ; then
+ if [ ! -f "$dipath/$f" ] ; then
+ echo "$dipath/$f not found" 1>&2
+ exit 1
+ fi
+ echo "$dipath/$f"
+ return 0
+ fi
+
+ if [ -n "$diurl" ] ; then
+ local dl=$(get_temp)
+ echo "Fetching $diurl/$f" 1>&2
+ wget -q -O $dl $diurl/$f 1>&2
+ echo $dl
+ return 0
+ fi
+
+ echo "Cannot find $f" 1>&2
+ exit 1
+}
+
+bootscr=$(get_temp)
+bootuscr=$(get_temp)
+
+# These must match /usr/bin/sunxi-usb-boot
+kernel_addr_r=0x44000000
+ramdisk_addr_r=0x4c000000
+fdt_addr_r=0x43000000 # AKA $scriptbin in sunxi-usb-boot
+echo >$bootscr <<EOF
+setenv bootargs $bootargs
+bootz ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr_r}
+EOF
+
+mkimage -T script -A arm -d $bootscr $bootuscr
+
+sunxi-usb-boot $spl $uboot $bootuscr $kernel $fdt $ramdisk
Reply to: