diff --git a/cfg/hardware.nix b/cfg/hardware.nix index 4af37242..42d8fc8b 100644 --- a/cfg/hardware.nix +++ b/cfg/hardware.nix @@ -14,8 +14,10 @@ # NixOS defaults to grub: we don't want that. boot.loader.grub.enable = false; - # Enables the generation of /boot/extlinux/extlinux.conf - boot.loader.generic-extlinux-compatible.enable = true; + # raspberryPi boot loader creates extlinux.conf. + # otherwise, enable the generic-extlinux-compatible loader below. + # note: THESE ARE MUTUALLY EXCLUSIVE. generic-extlinux-compatible causes uboot to not be built + # boot.loader.generic-extlinux-compatible.enable = true; boot.loader.raspberryPiColin.enable = true; boot.loader.raspberryPiColin.uboot.enable = true; boot.loader.raspberryPiColin.version = 4; diff --git a/pkgs/ubootRaspberryPi4_64bit/01-skip-lba-check.patch b/pkgs/ubootRaspberryPi4_64bit/01-skip-lba-check.patch new file mode 100644 index 00000000..7f044f3c --- /dev/null +++ b/pkgs/ubootRaspberryPi4_64bit/01-skip-lba-check.patch @@ -0,0 +1,32 @@ +diff --git a/disk/part_efi.c b/disk/part_efi.c +index 829ccb6bd1..5f3f0ae042 100644 +--- a/disk/part_efi.c ++++ b/disk/part_efi.c +@@ -133,12 +133,12 @@ static int validate_gpt_header(gpt_header *gpt_h, lbaint_t lba, + * Check that the first_usable_lba and that the last_usable_lba are + * within the disk. + */ +- if (le64_to_cpu(gpt_h->first_usable_lba) > lastlba) { ++ if (le64_to_cpu(gpt_h->first_usable_lba) > lastlba && lastlba != 0) { + printf("GPT: first_usable_lba incorrect: %llX > " LBAF "\n", + le64_to_cpu(gpt_h->first_usable_lba), lastlba); + return -1; + } +- if (le64_to_cpu(gpt_h->last_usable_lba) > lastlba) { ++ if (le64_to_cpu(gpt_h->last_usable_lba) > lastlba && lastlba != 0) { + printf("GPT: last_usable_lba incorrect: %llX > " LBAF "\n", + le64_to_cpu(gpt_h->last_usable_lba), lastlba); + return -1; +diff --git a/include/configs/rpi.h b/include/configs/rpi.h +index 7a5f0851b5..01545f7480 100644 +--- a/include/configs/rpi.h ++++ b/include/configs/rpi.h +@@ -15,6 +15,8 @@ + + /* Architecture, CPU, etc.*/ + ++#define CONFIG_SYS_64BIT_LBA ++ + /* Use SoC timer for AArch32, but architected timer for AArch64 */ + #ifndef CONFIG_ARM64 + #define CONFIG_SYS_TIMER_RATE 1000000 diff --git a/pkgs/ubootRaspberryPi4_64bit/02-extra-cmds.patch b/pkgs/ubootRaspberryPi4_64bit/02-extra-cmds.patch new file mode 100644 index 00000000..81d8367b --- /dev/null +++ b/pkgs/ubootRaspberryPi4_64bit/02-extra-cmds.patch @@ -0,0 +1,16 @@ +diff --git a/configs/rpi_4_defconfig b/configs/rpi_4_defconfig +index eae03bf023..2ded4123ce 100644 +--- a/configs/rpi_4_defconfig ++++ b/configs/rpi_4_defconfig +@@ -63,3 +63,11 @@ CONFIG_VIDEO_BCM2835=y + CONFIG_CONSOLE_SCROLL_LINES=10 + CONFIG_PHYS_TO_BUS=y + CONFIG_OF_LIBFDT_OVERLAY=y ++CONFIG_CMD_CONFIG=y ++CONFIG_CMD_EFIDEBUG=y ++CONFIG_CMD_GPT=y ++CONFIG_CMD_LOG=y ++CONFIG_CMD_READ=y ++CONFIG_CMD_USB_MASS_STORAGE=y ++CONFIG_LOG_MAX_LEVEL=8 ++CONFIG_CMD_LSBLK=y diff --git a/pkgs/ubootRaspberryPi4_64bit/01-enable-large-gpt.patch b/pkgs/ubootRaspberryPi4_64bit/03-verbose-log.patch similarity index 54% rename from pkgs/ubootRaspberryPi4_64bit/01-enable-large-gpt.patch rename to pkgs/ubootRaspberryPi4_64bit/03-verbose-log.patch index 41cdf172..1ba2416f 100644 --- a/pkgs/ubootRaspberryPi4_64bit/01-enable-large-gpt.patch +++ b/pkgs/ubootRaspberryPi4_64bit/03-verbose-log.patch @@ -1,19 +1,3 @@ -diff --git a/configs/rpi_4_defconfig b/configs/rpi_4_defconfig -index eae03bf023..2ded4123ce 100644 ---- a/configs/rpi_4_defconfig -+++ b/configs/rpi_4_defconfig -@@ -63,3 +63,11 @@ CONFIG_VIDEO_BCM2835=y - CONFIG_CONSOLE_SCROLL_LINES=10 - CONFIG_PHYS_TO_BUS=y - CONFIG_OF_LIBFDT_OVERLAY=y -+CONFIG_CMD_CONFIG=y -+CONFIG_CMD_EFIDEBUG=y -+CONFIG_CMD_GPT=y -+CONFIG_CMD_LOG=y -+CONFIG_CMD_READ=y -+CONFIG_CMD_USB_MASS_STORAGE=y -+CONFIG_LOG_MAX_LEVEL=8 -+CONFIG_CMD_LSBLK=y diff --git a/disk/part.c b/disk/part.c index 79955c7fb0..c1d469cebb 100644 --- a/disk/part.c @@ -32,21 +16,6 @@ diff --git a/disk/part_efi.c b/disk/part_efi.c index 829ccb6bd1..5f3f0ae042 100644 --- a/disk/part_efi.c +++ b/disk/part_efi.c -@@ -133,12 +133,12 @@ static int validate_gpt_header(gpt_header *gpt_h, lbaint_t lba, - * Check that the first_usable_lba and that the last_usable_lba are - * within the disk. - */ -- if (le64_to_cpu(gpt_h->first_usable_lba) > lastlba) { -+ if (le64_to_cpu(gpt_h->first_usable_lba) > lastlba && lastlba != 0) { - printf("GPT: first_usable_lba incorrect: %llX > " LBAF "\n", - le64_to_cpu(gpt_h->first_usable_lba), lastlba); - return -1; - } -- if (le64_to_cpu(gpt_h->last_usable_lba) > lastlba) { -+ if (le64_to_cpu(gpt_h->last_usable_lba) > lastlba && lastlba != 0) { - printf("GPT: last_usable_lba incorrect: %llX > " LBAF "\n", - le64_to_cpu(gpt_h->last_usable_lba), lastlba); - return -1; @@ -1044,6 +1044,8 @@ static int is_gpt_valid(struct blk_desc *dev_desc, u64 lba, return 2; } @@ -78,19 +47,6 @@ index 21c5209bb6..6ce03d8d09 100644 if (!ops->read) return -ENOSYS; -diff --git a/include/configs/rpi.h b/include/configs/rpi.h -index 7a5f0851b5..01545f7480 100644 ---- a/include/configs/rpi.h -+++ b/include/configs/rpi.h -@@ -15,6 +15,8 @@ - - /* Architecture, CPU, etc.*/ - -+#define CONFIG_SYS_64BIT_LBA -+ - /* Use SoC timer for AArch32, but architected timer for AArch64 */ - #ifndef CONFIG_ARM64 - #define CONFIG_SYS_TIMER_RATE 1000000 diff --git a/include/log.h b/include/log.h index 8f35c10abb..afd2d704f4 100644 --- a/include/log.h diff --git a/pkgs/ubootRaspberryPi4_64bit/default.nix b/pkgs/ubootRaspberryPi4_64bit/default.nix index aaee2efd..f233ac34 100644 --- a/pkgs/ubootRaspberryPi4_64bit/default.nix +++ b/pkgs/ubootRaspberryPi4_64bit/default.nix @@ -3,7 +3,10 @@ (pkgs.ubootRaspberryPi4_64bit.overrideAttrs (upstream: { patches = (upstream.patches or []) ++ [ # enable booting from > 2 TiB drives - ./01-enable-large-gpt.patch + ./01-skip-lba-check.patch + # enable some builtin commands to aid in debugging, while we're here + ./02-extra-cmds.patch + # ./03-verbose-log.patch ]; }))