summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Cournoyer <maxim.cournoyer@gmail.com>2022-12-02 00:11:06 -0500
committerMaxim Cournoyer <maxim.cournoyer@gmail.com>2023-01-18 21:25:17 -0500
commitd393e89d45da79a3d48c6dae9d609b17fea25eec (patch)
tree47e311fd20de7123e610992bc69eb5ed41ca7054
parent6433d49ab75a5575d35b258e000b18ad050006df (diff)
gnu: Add u-boot-ts7970-q-2g-1000mhz-c.
* gnu/packages/bootloaders.scm (u-boot-ts-mx6): New variable. (u-boot-ts7970-q-2g-1000mhz-c): Likewise.
-rw-r--r--gnu/packages/bootloaders.scm152
1 files changed, 152 insertions, 0 deletions
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index 1dcd64421c5..0db20219102 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -1376,6 +1376,158 @@ grub-efi-netboot-removable-bootloader.")
1376(define-public u-boot-rpi-arm64-efi-bin 1376(define-public u-boot-rpi-arm64-efi-bin
1377 (make-u-boot-bin-package u-boot-rpi-arm64-efi)) 1377 (make-u-boot-bin-package u-boot-rpi-arm64-efi))
1378 1378
1379(define u-boot-ts-mx6
1380 ;; There is no release; use the latest commit of the
1381 ;; 'imx_v2015.04_3.14.52_1.1.0_ga' branch.
1382 (let ((revision "0")
1383 (commit "08809160fbc60d6e949fa9d37d9a41aab8fef742"))
1384 (package
1385 (inherit u-boot)
1386 (name "u-boot-ts-mx6")
1387 (version (git-version "2015.04_3" revision commit))
1388 (source (origin
1389 (method git-fetch)
1390 (uri (git-reference
1391 (url "https://github.com/embeddedTS/u-boot-imx")
1392 (commit commit)))
1393 (file-name (git-file-name "u-boot-imx-ts" version))
1394 (sha256
1395 (base32
1396 "01mja33351hkcs59rmfvppqlxqw4rh9gng7a7hx2cfspqwh2y6kr"))))
1397 (arguments
1398 (substitute-keyword-arguments (package-arguments u-boot)
1399 ((#:phases phases '%standard-phases)
1400 #~(modify-phases #$phases
1401 (add-after 'unpack 'patch-u-boot
1402 (lambda _
1403 (substitute* (find-files "include/configs" "^ts[0-9]{4}\\.h$")
1404 ;; Default to boot a standard zImage instead of a uImage.
1405 (("/boot/uImage")
1406 "/boot/zImage")
1407 (("uimage")
1408 "zimage")
1409 (("bootm \\$\\{loadaddr}")
1410 "bootz ${loadaddr}")
1411 ;; This reference DTB is not available in mainline.
1412 (("ts7970-revf.dtb")
1413 "ts7970.dtb")
1414 ;; Enable support for DISTRO_DEFAULTS, which enables to
1415 ;; use 'sysboot' to boot Guix System. Also enable
1416 ;; "standard" boot commands for dealing with discovery and
1417 ;; booting of syslinux configurations (extlinux.conf).
1418
1419 ;; Disable the stock CONFIG_BOOTCOMMAND to avoid a
1420 ;; redefinition error.
1421 (("CONFIG_BOOTCOMMAND")
1422 "CONFIG_BOOTCOMMAND_DISABLED")
1423 (("CONFIG_BOOTDELAY")
1424 "CONFIG_BOOTDELAY_DISABLED")
1425 ;; Inspired by include/configs/embestmx6boards.h
1426 (("#define CONFIG_EXTRA_ENV_SETTINGS.*" anchor)
1427 (string-append "\
1428#include <config_distro_defaults.h>
1429
1430#define MEM_LAYOUT_ENV_SETTINGS \\
1431\t\"bootm_size=0x10000000\\0\" \\
1432\t\"kernel_addr_r=0x10800000\\0\" \\
1433\t\"fdt_addr_r=0x18000000\\0\" \\
1434\t\"scriptaddr=0x18100000\\0\" \\
1435\t\"pxefile_addr_r=0x18200000\\0\" \\
1436\t\"ramdisk_addr_r=0x18300000\\0\"
1437
1438#define BOOT_TARGET_DEVICES(func) \\
1439\tfunc(MMC, mmc, 0) \\
1440\tfunc(MMC, mmc, 1) \\
1441\tfunc(SATA, sata, 0) \\
1442\tfunc(USB, usb, 0) \\
1443\tfunc(PXE, pxe, na) \\
1444\tfunc(DHCP, dhcp, na)
1445
1446#include <config_distro_bootcmd.h>
1447
1448" anchor
1449
1450;; Sadly, the user config CONFIG_DEFAULT_FDT_FILE did not exist in that older
1451;; U-Boot. A placeholder is added here, to be substituted in each TS U-Boot
1452;; board package.
1453"\
1454\t\"fdtfile=DEFAULT_FDT_FILE\\0\" \\
1455\tMEM_LAYOUT_ENV_SETTINGS \\
1456\tBOOTENV \\\n")))))
1457 (add-after 'unpack 'patch-for-reproducibility
1458 (lambda _
1459 ;; Substitute dynamically computed timestamps with static
1460 ;; ones.
1461 (substitute* "Makefile"
1462 (("U_BOOT_DATE \"%b %d %C%y\"")
1463 "U_BOOT_DATE \"Jan 01 1969\"")
1464 (("U_BOOT_TIME \"%T\"")
1465 "U_BOOT_TIME \"00:00:00\""))))
1466 (add-before 'build 'adjust-for-gcc10
1467 (lambda _
1468 (copy-file "include/linux/compiler-gcc6.h"
1469 "include/linux/compiler-gcc10.h")
1470 (substitute* "arch/arm/Makefile"
1471 (("march=armv5")
1472 "march=armv5te"))))
1473 (add-after 'install 'build+install-tools
1474 (lambda* (#:key make-flags #:allow-other-keys)
1475 (apply invoke "make" "tools-all" make-flags)
1476 (install-file "tools/env/fw_printenv"
1477 (string-append #$output "/bin"))
1478 (symlink (string-append #$output "/bin/fw_printenv")
1479 (string-append #$output "/bin/fw_setenv"))))))))
1480 (native-inputs
1481 (modify-inputs (package-native-inputs u-boot)
1482 (delete "dtc")))))) ;otherwise the build fails
1483
1484;;; Note: the default cross-build of this package is currently broken on
1485;;; master; the fix exists as commit 6454208222d6e7760daa964b590f35ea75ffe0e5
1486;;; ("build: gnu-build-system: Remove source from native inputs.") on
1487;;; core-updates.
1488(define-public u-boot-ts7970-q-2g-1000mhz-c
1489 (let ((base
1490 (make-u-boot-package "ts7970-q-2g-1000mhz-c" "arm-linux-gnueabihf"
1491 #:u-boot u-boot-ts-mx6
1492 #:append-description
1493 "This U-Boot variant is for the Technologic
1494Systems TS-7970 revision C board, which includes a quad core Freescale i.MX6
1495CPU and 2 GiB of RAM clocked at 1000MHz. The binary U-Boot image to flash is
1496the @file{libexec/u-boot.imx} file. It can be used with the @file{zImage} and
1497the @file{imx6q-ts7970.dtb} files provided by the
1498@code{linux-libre-arm-generic} image.
1499
1500To flash this bootloader, write it to an SD card, then using the U-Boot serial
1501console:
1502@example
1503mmc dev 0
1504load mmc 0:1 ${loadaddr} /u-boot.imx
1505sf probe
1506sf erase 0 0x80000
1507sf write ${loadaddr} 0x400 $filesize
1508@end example
1509
1510The factory values of U-Boot must also be reset so that it boots using a
1511zImage instead of the default uImage:
1512@example
1513run clearenv
1514reset
1515@end example
1516
1517For more information, refer to
1518@url{https://docs.embeddedts.com/TS-7970#Update_U-Boot}.")))
1519 (package
1520 (inherit base)
1521 (arguments
1522 (substitute-keyword-arguments (package-arguments base)
1523 ((#:phases phases '%standard-phases)
1524 #~(modify-phases #$phases
1525 (add-after 'patch-u-boot 'set-default-fdt-file
1526 (lambda _
1527 (substitute* "include/configs/ts7970.h"
1528 (("DEFAULT_FDT_FILE")
1529 "imx6q-ts7970.dtb")))))))))))
1530
1379(define-public vboot-utils 1531(define-public vboot-utils
1380 (package 1532 (package
1381 (name "vboot-utils") 1533 (name "vboot-utils")