From d26cc84c3271cd19b7dc2074ba18b2901dffcd24 Mon Sep 17 00:00:00 2001 From: Bart Ribbers Date: Fri, 21 Jan 2022 14:13:41 +0100 Subject: [PATCH] pine64-pinephonepro: switch to UEFI booting (MR 2870) This removes u-boot from our image and allows booting via an UEFI-compatible platform firmware instead. So to flash pmOS on the PPP now we will require the user to flash Tow-Boot to the SPI. See the edge post for more information. Related: https://postmarketos.org/edge/2022/03/28/ppp-tow-boot/ Co-Authored-By: Oliver Smith --- .../device-pine64-pinephonepro/APKBUILD | 53 ++++++++++++++++--- .../device-pine64-pinephonepro/deviceinfo | 6 +-- .../device-pine64-pinephonepro/extlinux.conf | 9 ---- .../device-pine64-pinephonepro/grub.cfg | 6 +++ .../device-pine64-pinephonepro/grub_early.cfg | 2 + .../linux-pine64-pinephonepro/APKBUILD | 4 +- .../config-pine64-pinephonepro.aarch64 | 44 +++++++++++++-- 7 files changed, 97 insertions(+), 27 deletions(-) delete mode 100644 device/testing/device-pine64-pinephonepro/extlinux.conf create mode 100644 device/testing/device-pine64-pinephonepro/grub.cfg create mode 100644 device/testing/device-pine64-pinephonepro/grub_early.cfg diff --git a/device/testing/device-pine64-pinephonepro/APKBUILD b/device/testing/device-pine64-pinephonepro/APKBUILD index 4a5dff21b..6a821bd7b 100644 --- a/device/testing/device-pine64-pinephonepro/APKBUILD +++ b/device/testing/device-pine64-pinephonepro/APKBUILD @@ -2,12 +2,13 @@ # Maintainer: Martijn Braam pkgname=device-pine64-pinephonepro pkgdesc="PINE64 PinePhone Pro" -pkgver=1.3 +pkgver=2.0 pkgrel=0 url="https://postmarketos.org" license="MIT" arch="aarch64" -options="!check !archcheck" +# pmb:strict is required for grub +options="!check !archcheck pmb:strict" depends=" alsa-ucm-conf>=1.2.6.2 eg25-manager>=0.4.2 @@ -20,7 +21,11 @@ depends=" fwupd-plugin-modem_manager fwupd-plugin-fastboot " -makedepends="devicepkg-dev" +makedepends=" + devicepkg-dev + grub + grub-efi + " subpackages="$pkgname-nonfree-firmware:nonfree_firmware" install=" $pkgname.post-install @@ -28,7 +33,8 @@ install=" " source=" deviceinfo - extlinux.conf + grub.cfg + grub_early.cfg ucm/HiFi.conf ucm/PinePhonePro.conf ucm/VoiceCall.conf @@ -36,12 +42,42 @@ source=" build() { devicepkg_build $startdir $pkgname + + grub-mkimage \ + --config="$srcdir/grub_early.cfg" \ + --prefix="" \ + --output="bootaa64.efi" \ + --format="arm64-efi" \ + --compression="xz" \ + \ + all_video \ + cat \ + configfile \ + disk \ + echo \ + efi_gop \ + fat \ + gzio \ + help \ + iso9660 \ + linux \ + ls \ + normal \ + part_gpt \ + part_msdos \ + search \ + search_label \ + test \ + true } package() { devicepkg_package $startdir $pkgname - install -D -m644 "$srcdir"/extlinux.conf \ - "$pkgdir"/boot/extlinux/extlinux.conf + + install -Dm644 -t "$pkgdir"/boot/grub \ + "$srcdir"/grub.cfg + install -Dm644 -t "$pkgdir"/boot/EFI/Boot \ + "$srcdir"/bootaa64.efi install -Dm644 -t "$pkgdir"/usr/share/alsa/ucm2/conf.d/simple-card \ "$srcdir"/PinePhonePro.conf \ @@ -62,8 +98,9 @@ nonfree_firmware() { } sha512sums=" -f42c2c13bf8363a2427ad501e922d0e1fb813a750c3df882f4b394a2e40efbacc9b9deb7b25cd253a2e1cd6448ad0541bfe2f6326f179c329b28f518e4915850 deviceinfo -b116e5286880c2b8774fc065e4312d2c89a06003c85f332519b827b42b4e0630a1c47b69f75d56c5c91469eb810f18c6de21cf52234e59c67478c4c1731d347e extlinux.conf +18af46496eba898e7642ffed02d2d8dd4c9652c304eb2730fd042ca9d71da570b9c51446d9055ced1ea47e94a00c2590cdf9115f3a6d7219d457ce2d5eb8fc69 deviceinfo +e69752fc7f2b8552ba2e1e6da5b6bec0e284c7f14bc09576c862faeb5154a44522535a919ae5aca33a22fd14557e802595a7c96c59b9362c5ac5b991a8eac5fc grub.cfg +0f9357d4eea089628fbceb1e3e96d21a3f4329aeb6743158a6f877f967ef274506404eba949d5f01b7e1adea149f9a3aef992a5e8cd4181f93ab00909b1c5ecd grub_early.cfg ac22c856af81d00aa6a349b68cf9e8645bf38277d9aafd07f1f46f5f932f48d37b9dfdcc8772fff4027f914c9b4c3b4a11c51bd9f2aa1abbc53abd3f54adb818 HiFi.conf c57dae885c9a5f366f18b38a3ce3e21627baaf014724537eced9e8d6ac3ca61ade42b9fcf84db350b1e64742760e8cf4fe10639d41052387927238e85c3c4769 PinePhonePro.conf e978876bda8874e30df75c80554ccbbc0dd202c852ecae0b5c1a0d845402a630962afc2691c6f7d5f478fb0e4be045af4ef62ad0b1ce77f62fe2f155dc0a9cff VoiceCall.conf diff --git a/device/testing/device-pine64-pinephonepro/deviceinfo b/device/testing/device-pine64-pinephonepro/deviceinfo index 3be7e98c1..dcc6191b5 100644 --- a/device/testing/device-pine64-pinephonepro/deviceinfo +++ b/device/testing/device-pine64-pinephonepro/deviceinfo @@ -6,7 +6,7 @@ deviceinfo_name="PINE64 PinePhone Pro" deviceinfo_manufacturer="PINE64" deviceinfo_codename="pine64-pinephonepro" deviceinfo_year="2021" -deviceinfo_modules_initfs="gpu_sched dw_wdt fusb302 panel_himax_hx8394 goodix_ts" +deviceinfo_modules_initfs="gpu_sched dw_wdt fusb302 panel_himax_hx8394 goodix_ts vfat nls_cp437 nls_ascii" deviceinfo_arch="aarch64" # Device related @@ -24,5 +24,5 @@ deviceinfo_dev_internal_storage_repartition="true" # Bootloader related deviceinfo_flash_method="none" -deviceinfo_sd_embed_firmware="u-boot/pine64-pinephonepro/u-boot-rockchip.bin:32" -deviceinfo_boot_part_start="32768" +deviceinfo_boot_filesystem="fat32" +deviceinfo_partition_type="gpt" diff --git a/device/testing/device-pine64-pinephonepro/extlinux.conf b/device/testing/device-pine64-pinephonepro/extlinux.conf deleted file mode 100644 index 26f482410..000000000 --- a/device/testing/device-pine64-pinephonepro/extlinux.conf +++ /dev/null @@ -1,9 +0,0 @@ -timeout 10 -default POSTMARKETOS -menu title boot prev kernel - -label POSTMARKETOS - kernel /vmlinuz - fdt /dtbs-pine64-pinephonepro/rockchip/rk3399-pinephone-pro.dtb - initrd /initramfs - append console=tty0 earlycon=uart8250,mmio32,0xff1a0000 console=ttyS2,115200n8 panic=10 coherent_pool=1M loglevel=5 mem_sleep_default=s2idle PMOS_NO_OUTPUT_REDIRECT fw_devlink=off diff --git a/device/testing/device-pine64-pinephonepro/grub.cfg b/device/testing/device-pine64-pinephonepro/grub.cfg new file mode 100644 index 000000000..b3afd605f --- /dev/null +++ b/device/testing/device-pine64-pinephonepro/grub.cfg @@ -0,0 +1,6 @@ +timeout=0 + +menuentry "postmarketOS" { + linux ($root)/vmlinuz console=tty0 earlycon=uart8250,mmio32,0xff1a0000 console=ttyS2,115200 panic=10 coherent_pool=1M loglevel=5 mem_sleep_default=s2idle PMOS_NO_OUTPUT_REDIRECT fw_devlink=off + initrd ($root)/initramfs +} diff --git a/device/testing/device-pine64-pinephonepro/grub_early.cfg b/device/testing/device-pine64-pinephonepro/grub_early.cfg new file mode 100644 index 000000000..995cea771 --- /dev/null +++ b/device/testing/device-pine64-pinephonepro/grub_early.cfg @@ -0,0 +1,2 @@ +search --no-floppy --set=root --label "pmOS_boot" +set prefix=($root)/grub diff --git a/device/testing/linux-pine64-pinephonepro/APKBUILD b/device/testing/linux-pine64-pinephonepro/APKBUILD index 07e80dcd6..b9f0b8352 100644 --- a/device/testing/linux-pine64-pinephonepro/APKBUILD +++ b/device/testing/linux-pine64-pinephonepro/APKBUILD @@ -2,7 +2,7 @@ pkgname=linux-pine64-pinephonepro pkgver=5.16.7 -pkgrel=0 +pkgrel=1 pkgdesc="Mainline kernel for the pinephone pro" arch="aarch64" _flavor="${pkgname#linux-}" @@ -78,5 +78,5 @@ package() { sha512sums=" 365697049c59f2d0baf27becd6d00da030ab931b16ef075ca9a227302adf741de55137a349d589edd8bd028f95f6e23417858cfefb9d9748ec5e36fc3b4205de linux-ppp-5.16.7.tar.gz -1fc43a1bca4cb2a82617568cee24d49acc172ddc8fcc2d652760c368b242e536629b6e0fda5f38b990ee2e5fb029c1592ea5bdd0f89a83bd3484bc8d533d64cc config-pine64-pinephonepro.aarch64 +786b64241a720e7f174ccde3c04fc5c53b0b26858bfd654ac387c84b9398cb4e235f33b0e6d6a0173e6c208d1b5e1deb610d0f5d6645a82878c19e1ee81860dc config-pine64-pinephonepro.aarch64 " diff --git a/device/testing/linux-pine64-pinephonepro/config-pine64-pinephonepro.aarch64 b/device/testing/linux-pine64-pinephonepro/config-pine64-pinephonepro.aarch64 index f730d767a..f4eacc81e 100644 --- a/device/testing/linux-pine64-pinephonepro/config-pine64-pinephonepro.aarch64 +++ b/device/testing/linux-pine64-pinephonepro/config-pine64-pinephonepro.aarch64 @@ -1,15 +1,15 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/arm64 5.16.0 Kernel Configuration +# Linux/arm64 5.16.7 Kernel Configuration # -CONFIG_CC_VERSION_TEXT="aarch64-alpine-linux-musl-gcc (Alpine 11.2.1_git20220106) 11.2.1 20220106" +CONFIG_CC_VERSION_TEXT="aarch64-alpine-linux-musl-gcc (Alpine 11.2.1_git20220117) 11.2.1 20220117" CONFIG_CC_IS_GCC=y CONFIG_GCC_VERSION=110201 CONFIG_CLANG_VERSION=0 CONFIG_AS_IS_GNU=y -CONFIG_AS_VERSION=23700 +CONFIG_AS_VERSION=23800 CONFIG_LD_IS_BFD=y -CONFIG_LD_VERSION=23700 +CONFIG_LD_VERSION=23800 CONFIG_LLD_VERSION=0 CONFIG_CC_HAS_ASM_GOTO=y CONFIG_CC_HAS_ASM_GOTO_OUTPUT=y @@ -501,7 +501,9 @@ CONFIG_CC_HAVE_STACKPROTECTOR_SYSREG=y # Boot options # CONFIG_CMDLINE="" -# CONFIG_EFI is not set +CONFIG_EFI_STUB=y +CONFIG_EFI=y +CONFIG_DMI=y # end of Boot options CONFIG_SYSVIPC_COMPAT=y @@ -593,6 +595,8 @@ CONFIG_ARM_SCMI_CPUFREQ=y # end of CPU Frequency scaling # end of CPU Power Management +CONFIG_ARCH_SUPPORTS_ACPI=y +# CONFIG_ACPI is not set CONFIG_IRQ_BYPASS_MANAGER=y CONFIG_HAVE_KVM=y CONFIG_HAVE_KVM_IRQCHIP=y @@ -718,6 +722,7 @@ CONFIG_ARCH_HAS_STRICT_MODULE_RWX=y CONFIG_STRICT_MODULE_RWX=y CONFIG_HAVE_ARCH_COMPILER_H=y CONFIG_HAVE_ARCH_PREL32_RELOCATIONS=y +CONFIG_ARCH_USE_MEMREMAP_PROT=y # CONFIG_LOCK_EVENT_COUNTS is not set CONFIG_ARCH_HAS_RELR=y CONFIG_ARCH_WANT_LD_ORPHAN_WARN=y @@ -1698,8 +1703,32 @@ CONFIG_ARM_SCPI_PROTOCOL=m CONFIG_ARM_SCPI_POWER_DOMAIN=m CONFIG_ARM_SDE_INTERFACE=y CONFIG_FIRMWARE_MEMMAP=y +CONFIG_DMIID=y +# CONFIG_DMI_SYSFS is not set +CONFIG_SYSFB=y +# CONFIG_SYSFB_SIMPLEFB is not set # CONFIG_ARM_FFA_TRANSPORT is not set # CONFIG_GOOGLE_FIRMWARE is not set + +# +# EFI (Extensible Firmware Interface) Support +# +CONFIG_EFI_ESRT=y +CONFIG_EFI_VARS_PSTORE=y +# CONFIG_EFI_VARS_PSTORE_DEFAULT_DISABLE is not set +CONFIG_EFI_PARAMS_FROM_FDT=y +CONFIG_EFI_RUNTIME_WRAPPERS=y +CONFIG_EFI_GENERIC_STUB=y +CONFIG_EFI_ARMSTUB_DTB_LOADER=y +CONFIG_EFI_GENERIC_STUB_INITRD_CMDLINE_LOADER=y +# CONFIG_EFI_BOOTLOADER_CONTROL is not set +# CONFIG_EFI_CAPSULE_LOADER is not set +# CONFIG_EFI_TEST is not set +# CONFIG_RESET_ATTACK_MITIGATION is not set +# CONFIG_EFI_DISABLE_PCI_DMA is not set +# end of EFI (Extensible Firmware Interface) Support + +CONFIG_EFI_EARLYCON=y CONFIG_ARM_PSCI_FW=y # CONFIG_ARM_PSCI_CHECKER is not set CONFIG_HAVE_ARM_SMCCC=y @@ -3703,6 +3732,7 @@ CONFIG_FB_MODE_HELPERS=y # # CONFIG_FB_ARMCLCD is not set # CONFIG_FB_UVESA is not set +# CONFIG_FB_EFI is not set # CONFIG_FB_OPENCORES is not set # CONFIG_FB_S1D13XXX is not set # CONFIG_FB_SMSCUFX is not set @@ -4757,6 +4787,7 @@ CONFIG_RTC_I2C_AND_SPI=y # CONFIG_RTC_DRV_DS1685_FAMILY is not set # CONFIG_RTC_DRV_DS1742 is not set # CONFIG_RTC_DRV_DS2404 is not set +# CONFIG_RTC_DRV_EFI is not set # CONFIG_RTC_DRV_STK17TA8 is not set # CONFIG_RTC_DRV_M48T86 is not set # CONFIG_RTC_DRV_M48T35 is not set @@ -5907,6 +5938,7 @@ CONFIG_HUGETLB_PAGE=y CONFIG_MEMFD_CREATE=y CONFIG_ARCH_HAS_GIGANTIC_PAGE=y CONFIG_CONFIGFS_FS=y +CONFIG_EFIVAR_FS=m # end of Pseudo filesystems CONFIG_MISC_FILESYSTEMS=y @@ -6094,6 +6126,7 @@ CONFIG_FORTIFY_SOURCE=y # CONFIG_SECURITY_LOCKDOWN_LSM is not set # CONFIG_SECURITY_LANDLOCK is not set # CONFIG_INTEGRITY is not set +# CONFIG_IMA_SECURE_AND_OR_TRUSTED_BOOT is not set CONFIG_DEFAULT_SECURITY_DAC=y CONFIG_LSM="lockdown,yama,loadpin,safesetid,integrity,apparmor,selinux,smack,tomoyo" @@ -6448,6 +6481,7 @@ CONFIG_IRQ_POLL=y CONFIG_MPILIB=y CONFIG_LIBFDT=y CONFIG_OID_REGISTRY=y +CONFIG_UCS2_STRING=y CONFIG_HAVE_GENERIC_VDSO=y CONFIG_GENERIC_GETTIMEOFDAY=y CONFIG_GENERIC_VDSO_TIME_NS=y