+# Needed for booting, creates uboot scripts and so on
+flash-kernel
+
+# TODO: Is the following still needed? Is the new mesa nir default already in debian?
libenvpreload
+# Needed for booting, creates uboot scripts and so on
+flash-kernel
+
+# TODO: Is the following still needed? Is the new mesa nir default already in debian?
libenvpreload
# For forwarding modem audio
KERNEL_CONFIG_TARGET = pinephonepro
FK_MACHINE = Pine64 PinePhonePro
+BOOT_FSTYPE = vfat
+BOOT_DIR = boot/efi
+
S_COMPONENTS += contrib non-free
+PATCH_DEV_FILES += boot/efi/EFI/boot/grub.cfg
+
repo-branch@linux = pine64-kernel-ppp-5.16.y-release
repo-source@linux = https://gitlab.com/pine64-org/linux.git
firmware-misc-nonfree
firmware-brcm80211
eg25-manager
+grub-efi
cd "$tmp"
+# TODO: Does any of the /lib/firmware/brcm/brcmfmac43455-sdio.* files from firmware-brcm80211 / linux-firmware, which is installed, work?
if apt-get download raspi-firmware
then
dpkg-deb -xv raspi-firmware*.deb .
dpkg-deb -xv linux-firmware-raspi*.deb .
cp ./lib/firmware/brcm/brcmfmac43455-sdio.raspberrypi,400.txt /lib/firmware/brcm/brcmfmac43455-sdio.pine64,pinephone-pro.txt
fi
+
+# Create an initial grub config. It's not possible to get grub-install
+# working properly in the chroot, but grub-mkimage will work for the first boot,
+# we can do grub-instal and grub-update un the first boot after that.
+MODULES='
+ all_video boot cat configfile disk echo efi_gop ext2 fat fdt gzio help iso9660
+ linux ls normal part_gpt part_msdos reboot search search_fs_file search_fs_uuid
+ search_label test true probe
+'
+
+mkdir -p /boot/efi/EFI/boot/
+grub-mkimage -p /EFI/boot/ -O arm64-efi -o /boot/efi/EFI/boot/bootaa64.efi $MODULES
--- /dev/null
+#!/bin/sh
+
+set +e
+
+# Properly install grub. Can't be done when bootstrapping.
+
+# Apparently, the modules needed for fat32 aren't in the initramfs
+modprobe fat
+modprobe vfat
+modprobe msdos
+modprobe nls_cp437
+modprobe nls_ascii
+
+# grub will be reinstalled here
+mount /boot/efi
+mount -o remount,rw /boot/efi
+
+# The following will fail, but maybe someone fixes EFI Varaiables un uboot some day?
+grub-install
+# EFI Varaiables aren't supported yet, skip just that step. That should work.
+grub-install --no-nvram
+# Without EFI variables, we need the fallback. It doesn't work without the above though. Probably a bug?
+grub-install --removable
+# Let's make sure the config and so one is present, too
+update-grub
+
+# Unmount it again, the system will mount it later, but may want to do an fsck first.
+umount /boot/efi
--- /dev/null
+# Apparently, this grubs probe command doesn't support --part-uuid
+#if [ x{PARTUUID_root} != x ]
+# then probe --set=root --part-uuid {PARTUUID_root}
+# else
+search --no-floppy --fs-uuid --set=root {UUID_root}
+#fi
+
+linux /boot/vmlinuz-5.16.7-00003-gd31aea033841 root={FSTAB_root} console=tty1 ro
+initrd /boot/initrd.img-5.16.7-00003-gd31aea033841
+boot
--- /dev/null
+# If you change this file, run 'update-grub' afterwards to update
+# /boot/grub/grub.cfg.
+# For full documentation of the options in this file, see:
+# info -f grub -n 'Simple configuration'
+
+GRUB_DEFAULT=0
+GRUB_TIMEOUT=5
+GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
+GRUB_CMDLINE_LINUX_DEFAULT=""
+GRUB_CMDLINE_LINUX="console=tty1 ro"
+
+# Uncomment to enable BadRAM filtering, modify to suit your needs
+# This works with Linux (no patch required) and with any kernel that obtains
+# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
+#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"
+
+# Uncomment to disable graphical terminal (grub-pc only)
+GRUB_TERMINAL=console
+
+# The resolution used on graphical terminal
+# note that you can use only modes which your graphic card supports via VBE
+# you can see them in real GRUB with the command `vbeinfo'
+#GRUB_GFXMODE=640x480
+
+# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
+#GRUB_DISABLE_LINUX_UUID=true
+
+# Uncomment to disable generation of recovery mode menu entries
+#GRUB_DISABLE_RECOVERY="true"
+
+# Uncomment to get a beep at grub start
+#GRUB_INIT_TUNE="480 440 1"
--- /dev/null
+# <file system> <mount point> <type> <options> <dump> <pass>
+
+proc /proc proc nosuid,noexec,nodev,hidepid=2 0 0
+{FSTAB_root} / auto defaults,discard,relatime 0 1
+{FSTAB_boot} /boot/efi vfat defaults,ro,relatime 0 1
+tmpfs /tmp tmpfs defaults,noexec,nosuid,nodev 0 0
--- /dev/null
+#!/bin/sh
+set -ex
+
+libdir="/usr/lib/$DPKG_MAINTSCRIPT_PACKAGE/"
+[ -d "$libdir" ] || exit 0
+
+cd "$libdir"
+mkdir -p /boot/efi/dtb/
+find -iname '*.dtb' -exec cp --parents {} /boot/efi/dtb/ \;
+# Needed for booting, creates uboot scripts and so on
+flash-kernel
linux-image-arm64
raspi-firmware
FSTYPE = ext4
USE_EFI = y
+PATCH_DEV_FILES = etc/fstab
BUILD_PACKAGES = no
USE_IMAGE_BUILDER_REPO = yes
# Needed to install the kernel & bootloader
u-boot-tools
-# flash-kernel # Uncomment once librem 5 support is in the official repos
# Required by rootfs_setup.sh and first_boot_setup.sh
dpkg-dev
initramfs-tools
-# Needed by current flash-kernel version, remove once everything is mainline
file
-# Needed for booting, creates uboot scripts and so on
-flash-kernel
-
locales # Has to be installed before console keyboard, because it needs locale C.UTF-8
# Do make the text readable
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc nosuid,noexec,nodev,hidepid=2 0 0
-{UUID_root} / auto defaults,discard,relatime 0 1
-{UUID_boot} /boot ext2 defaults,ro,relatime 0 1
+{FSTAB_root} / auto defaults,discard,relatime 0 1
+{FSTAB_boot} /boot ext2 defaults,ro,relatime 0 1
tmpfs /tmp tmpfs defaults,noexec,nosuid,nodev 0 0
# Protective partition for firmware (The type / guid here was chowsen randomly)
start=64, size=31MiB, type=59EB2C4A-6F39-4E7E-8A7A-2C32F189FA8F, name=loader, attrs="RequiredPartition,62,63"
-# /boot/ partition
-size=224MiB, type=BC13C2FF-59E6-4262-A352-B275FD6F7172, name=boot, attrs=LegacyBIOSBootable
+# /boot/efi partition
+size=224MiB, type=C12A7328-F81F-11d2-BA4B-00A0C93EC93B, name=boot
# / partition, use remaining space
type=B921B045-1DF0-41C3-AF44-4C6F280D3FAE, name=root
. "$part_info"
eval "$(blkid -p "$part" | sed "s/^[^:]*: //")"
FSTAB_ID=
+ if [ -n "$UUID" ]
+ then
+ FSTAB_ID="UUID=$UUID"
+ sed -i "s/{UUID_$part_name}/$UUID/" $PATCH_DEV_FILES
+ fi
if [ -n "$PARTUUID" ]
- then FSTAB_ID="PARTUUID=$PARTUUID"
- elif [ -n "$UUID" ]
- then FSTAB_ID="UUID=$UUID"
+ then
+ FSTAB_ID="PARTUUID=$PARTUUID"
+ sed -i "s/{PARTUUID_$part_name}/$PARTUUID/" $PATCH_DEV_FILES
fi
if [ -n "$FSTAB_ID" ]
- then sed -i "s/{UUID_$part_name}/$FSTAB_ID/" etc/fstab
+ then sed -i "s/{FSTAB_$part_name}/$FSTAB_ID/" $PATCH_DEV_FILES
fi
); done
)' CHNS_OVERLAY=1 CHNS_EXTRA_POST='(