# Install a bog-standard Debian bootable for ODROID XU3/XU4.
#
-# Note: You will need u-boot-exynos >= 2016.05~rc3+dfsg1-1,
-# which at the time of writing is in experimental (it will
-# probably eventually hit stretch).
-#
# Beware: This will ERASE ALL DATA on the target SD card
# or MMC partition.
#
# Prerequisites.
dpkg --add-architecture armhf
apt update
-apt install git parted dosfstools e2fsprogs binfmt-support qemu qemu-user-static debootstrap zerofree u-boot-exynos:armhf
+apt install -t $SUITE git parted dosfstools e2fsprogs binfmt-support qemu qemu-user-static debootstrap zerofree u-boot-exynos:armhf
# Get first stages of bootloader. (BL1 must be signed by Hardkernel,
# and TZSW comes without source anyway, so we can't build these ourselves)
fi
dd if=u-boot/sd_fuse/hardkernel_1mb_uboot/bl1.bin.hardkernel of=${UBOOT_DEVICE} seek=${UBOOT_OFFSET} conv=sync
dd if=u-boot/sd_fuse/hardkernel_1mb_uboot/bl2.bin.hardkernel.1mb_uboot of=${UBOOT_DEVICE} seek=$((UBOOT_OFFSET + 30)) conv=sync
-dd if=/usr/lib/u-boot/odroid-xu3/u-boot-dtb.bin of=${UBOOT_DEVICE} seek=$((UBOOT_OFFSET + 62)) conv=sync
+dd if=/usr/lib/u-boot/odroid-xu3/u-boot.bin of=${UBOOT_DEVICE} seek=$((UBOOT_OFFSET + 62)) conv=sync
dd if=u-boot/sd_fuse/hardkernel_1mb_uboot/tzsw.bin.hardkernel of=${UBOOT_DEVICE} seek=$((UBOOT_OFFSET + 2110)) conv=sync
# Clear out the environment.
mount /dev/odroid/root /mnt/xu4
mkdir /mnt/xu4/boot/
mount ${BOOT_PART} /mnt/xu4/boot
-debootstrap --include=linux-image-armmp-lpae,grub-efi-arm,lvm2,isc-dhcp-client --foreign --arch armhf ${SUITE} /mnt/xu4 "$@"
+debootstrap --include=grub-efi-arm,lvm2,isc-dhcp-client --foreign --arch armhf ${SUITE} /mnt/xu4 "$@"
# Run the second stage debootstrap under qemu (via binfmt_misc).
cp /usr/bin/qemu-arm-static /mnt/xu4/usr/bin/
# Enable security updates, and apply any that might be waiting.
if [ "$SUITE" != "unstable" ] && [ "$SUITE" != "sid" ]; then
echo "deb http://security.debian.org $SUITE/updates main" >> /mnt/xu4/etc/apt/sources.list
- DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true LC_ALL=C LANGUAGE=C LANG=C chroot /mnt/xu4 apt update
- DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true LC_ALL=C LANGUAGE=C LANG=C chroot /mnt/xu4 apt dist-upgrade
+ DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true LC_ALL=C LANGUAGE=C LANG=C chroot /mnt/xu4 apt -y update
+ DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true LC_ALL=C LANGUAGE=C LANG=C chroot /mnt/xu4 apt -y full-upgrade
fi
+# Install the kernel; we don't do this as part of debootstrap, because it could
+# come from security.d.o and upgrading doesn't work too well on FAT (due to
+# missing hardlinks). (Admittedly, this is a hack.)
+DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true LC_ALL=C LANGUAGE=C LANG=C chroot /mnt/xu4 apt -y install linux-image-armmp-lpae
+
# Create an fstab (this is normally done by partconf, in d-i).
BOOT_UUID=$( blkid -s UUID -o value ${BOOT_PART} )
cat <<EOF > /mnt/xu4/etc/fstab
# Set a hostname.
echo odroid > /mnt/xu4/etc/hostname
-# Work around Debian bug #824391.
-echo ttySAC2 >> /mnt/xu4/etc/securetty
-
# Work around Debian bug #825026.
echo ledtrig-heartbeat >> /mnt/xu4/etc/modules
# Install GRUB, chainloaded from U-Boot via UEFI.
mount --bind /dev /mnt/xu4/dev
mount --bind /proc /mnt/xu4/proc
+mount --bind /sys /mnt/xu4/sys
chroot /mnt/xu4 /usr/sbin/grub-install --removable --target=arm-efi --boot-directory=/boot --efi-directory=/boot
# Get the device tree in place (we need it to load GRUB).
umount /mnt/xu4/dev
umount /mnt/xu4/proc
umount /mnt/xu4/boot
+umount /mnt/xu4/sys
umount /mnt/xu4
# The root file system is ext4, so we can use zerofree, which is