guix_mirror_bot pushed a commit to branch master
in repository guix.
commit 99b6b83230277ccf6541de107ce33cfb706e1d5b
Author: Denis 'GNUtoo' Carikli <[email protected]>
AuthorDate: Sun Dec 21 20:04:47 2025 +0100
gnu: bootloader: Add u-boot-am335x-evm-bootloader.
* gnu/bootloader/u-boot.scm (u-boot-am335x-evm-bootloader):
New exported variable.
Change-Id: I258f7b7b31e7b7597710b8ff30d7a5ed882e147c
Signed-off-by: Denis 'GNUtoo' Carikli <[email protected]>
Signed-off-by: Vagrant Cascadian <[email protected]>
---
gnu/bootloader/u-boot.scm | 70 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 70 insertions(+)
diff --git a/gnu/bootloader/u-boot.scm b/gnu/bootloader/u-boot.scm
index 349bb72418..5d341e97fe 100644
--- a/gnu/bootloader/u-boot.scm
+++ b/gnu/bootloader/u-boot.scm
@@ -36,6 +36,7 @@
u-boot-a20-olinuxino-lime2-bootloader
u-boot-a20-olinuxino-micro-bootloader
u-boot-bananapi-m2-ultra-bootloader
+ u-boot-am335x-evm-bootloader
u-boot-beaglebone-black-bootloader
u-boot-cubietruck-bootloader
u-boot-firefly-rk3399-bootloader
@@ -97,6 +98,48 @@ is BLOCK-SIZE * COUNT, or FILE size if COUNT is not given."
(if bootloader
(error "Failed to install U-Boot"))))
+(define install-am335x-evm-u-boot
+ (write-u-boot-image
+ ;; According to the "26.1.8.5.5 MMC/SD Read Sector Procedure in Raw Mode"
+ ;; section in the "AM335x and AMIC110 Sitaraâ„¢ Processors Technical
+ ;; Reference Manual", we have offset, the bootrom tries to load code at the
+ ;; offsets 0x0, 0x20000 (128KB), 0x40000 (256KB) and 0x60000 (384KB).
+ ;;
+ ;; The MBR is 512 Bytes
+ ;; (https://en.wikipedia.org/wiki/Master_boot_record#Sector_layout).
+ ;;
+ ;; At the time of writing, u-boot.img is 1.4 MiB, and it is at offset
+ ;; 0x60000 (384KB) as per CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR.
+ ;;
+ ;; We also need to align the first partition to make sure read/writes are
+ ;; properly aligned.
+ ;;
+ ;; Given these constraints, we chose the following partitioning:
+ ;;
+ ;; 0 512 Bytes 128 KiB
+ ;; | | (0x20000) 256 KiB
+ ;; | | / (0x40000) 384 KiB 4 MiB
+ ;; | | / | (0x60000) |
+ ;; | | / | | |
+ ;; v v / v v v
+ ;; +-------+ +--------------+---------------+----------------+
+ ;; | MBR | ... | First MLO | Second MLO | u-boot.img |
+ ;; +-------+ +--------------+---------------+----------------+
+ ;; <-512 B-> ... <-- 128 KiB --> <-- 128 KiB --> <-- 3712 KiB -->
+ ;;
+ ;; The rationale for that is as follows:
+ ;;
+ ;; - We add a second copy of the MLO at 256 KiB for improving reliability
+ ;; as the doc/board/ti/am335x_evm.rst documentation in u-boot advise us
+ ;; to do that, and also because the space there isn't used.
+ ;;
+ ;; - All can fit into 2MiB (u-boot.img can grow up to 1664 KiB), but we
+ ;; want a bit more space in case u-boot.img grows over time, so we allow
+ ;; u-boot to grow until the 4 MiB offset.
+ '(("MLO" 256 256) ;; First MLO
+ ("MLO" 256 512) ;; Second MLO
+ ("u-boot.img" 7424 768)) 512))
+
(define install-beaglebone-black-u-boot
;;
http://wiki.beyondlogic.org/index.php?title=BeagleBoneBlack_Upgrading_uBoot
;; This first stage bootloader called MLO (U-Boot SPL) is expected at
@@ -158,6 +201,33 @@ is BLOCK-SIZE * COUNT, or FILE size if COUNT is not given."
(installer #f)
(disk-image-installer install-u-boot)))
+(define u-boot-am335x-evm-bootloader
+ (bootloader
+ (inherit u-boot-bootloader)
+ ;; This bootloader supports the following computers:
+ ;; - SanCloud BeagleBone Enhanced
+ ;; - SanCloud BeagleBone Enhanced Extended WiFi
+ ;; - SanCloud BeagleBone Enhanced Lite
+ ;; - Seeed Studio BeagleBone Green Eco
+ ;; - TI AM3359 ICE-V2
+ ;; - TI AM335x BeagleBone
+ ;; - TI AM335x BeagleBone Black
+ ;; - TI AM335x BeagleBone Green
+ ;; - TI AM335x EVM
+ ;; - TI AM335x EVM-SK
+ ;; - TI AM335x PocketBeagle
+ ;;
+ ;; This list was made by retrieving the list of Devicetrees used in
+ ;; configs/am335x_evm_defconfig in u-boot source code. Once we have that we
+ ;; can look at each Devicetree in arch/arm/boot/dts/ti/omap/ inside Linux,
+ ;; and in each file, look at the model property to find the name of the
+ ;; computers that this image supports.
+ (package u-boot-am335x-evm)
+ ;; At the time of writing, our u-boot.img is 1.4 MiB. This is why we can't
+ ;; reuse install-beaglebone-black-u-boot. And having the same image being
+ ;; able to boot on multiple computers is useful.
+ (disk-image-installer install-am335x-evm-u-boot)))
+
(define u-boot-beaglebone-black-bootloader
(bootloader
(inherit u-boot-bootloader)