From fc18dd0bbb82847bbe07215951b998480c11dc42 Mon Sep 17 00:00:00 2001 From: Denis 'GNUtoo' Carikli Date: Thu, 9 Jan 2020 15:37:28 +0100 Subject: libre: u-boot: Add uboot4extlinux-imx The instructions to flash are based on information from uboot's doc/imx/mkimage/imximage.txt document. As for the USB Armory which uses an I.MX 53, the it also uses the same offset as documented in an u-boot installation guide: https://github.com/inversepath/usbarmory/wiki/Secure-boot-(Mk-I)#user-content-prepare-and-flash-the-signed-u-boot Signed-off-by: Denis 'GNUtoo' Carikli --- libre/uboot4extlinux-imx/PKGBUILD | 147 +++++++++++++++++++++ libre/uboot4extlinux-imx/extlinux.conf | 51 +++++++ libre/uboot4extlinux-imx/tbs2910.h | 136 +++++++++++++++++++ libre/uboot4extlinux-imx/tbs2910_defconfig | 84 ++++++++++++ .../uboot4extlinux-imx/uboot4extlinux-imx.install | 35 +++++ 5 files changed, 453 insertions(+) create mode 100644 libre/uboot4extlinux-imx/PKGBUILD create mode 100644 libre/uboot4extlinux-imx/extlinux.conf create mode 100644 libre/uboot4extlinux-imx/tbs2910.h create mode 100644 libre/uboot4extlinux-imx/tbs2910_defconfig create mode 100644 libre/uboot4extlinux-imx/uboot4extlinux-imx.install diff --git a/libre/uboot4extlinux-imx/PKGBUILD b/libre/uboot4extlinux-imx/PKGBUILD new file mode 100644 index 000000000..b6b7652a7 --- /dev/null +++ b/libre/uboot4extlinux-imx/PKGBUILD @@ -0,0 +1,147 @@ +# U-Boot: I.MX +# Contributor: Isaac David +# Contributor: André Silva +# Contributor: Timothy Redaelli +# Maintainer: Denis 'GNUtoo' Carikli + +pkgbase=uboot4extlinux-imx +pkgname=('uboot4extlinux-mx6cuboxi' + 'uboot4extlinux-nitrogen6q' + 'uboot4extlinux-tbs2910' + 'uboot4extlinux-udoo' + 'uboot4extlinux-usbarmory' + 'uboot4extlinux-wandboard') +pkgver=2020.01 +pkgrel=1 +arch=('armv7h') +url="http://git.denx.de/u-boot.git/" +license=('GPL') +makedepends=('bc' 'dtc' 'python' 'python2' 'swig') +backup=(boot/extlinux/extlinux.conf) +source=("ftp://ftp.denx.de/pub/u-boot/u-boot-${pkgver}.tar.bz2" + 'extlinux.conf' + 'tbs2910.h' + 'tbs2910_defconfig') +sha256sums=('aa453c603208b1b27bd03525775a7f79b443adec577fdc6e8f06974025a135f1' + 'SKIP' + 'SKIP' + 'SKIP') + +# TODO +# boards=('mx6cuboxi' +# 'nitrogen6q' +# 'tbs2910' +# 'udoo' +# 'usbarmory' +# 'wandboard') +boards=('tbs2910') + +prepare() { + cd u-boot-${pkgver} + + # TODO: send patches upstream + # tbs2910.h: needed for generic distro booting + # tbs2910_defconfig: needed for generic distro booting + # and to fit within the size constraints + cp -f ../tbs2910.h include/configs/tbs2910.h + cp -f ../tbs2910_defconfig configs/tbs2910_defconfig + + for i in ${boards[@]}; do + echo 'CONFIG_DISTRO_DEFAULTS=y' >> configs/${i}_defconfig + echo 'CONFIG_SD_BOOT=y' >> configs/${i}_defconfig + echo 'CONFIG_SATA_BOOT=y' >> configs/${i}_defconfig + done +} + + +build() { + cd u-boot-${pkgver} + + unset CFLAGS CXXFLAGS LDFLAGS + + for i in ${boards[@]}; do + mkdir -p ../bin_${i} + make distclean + make ${i}_defconfig + echo 'CONFIG_IDENT_STRING=" Parabola GNU/Linux-libre"' >> .config + make EXTRAVERSION=-${pkgrel} + mv -f u-boot.imx ../bin_${i} + done +} + +package_uboot4extlinux-nitrogen6q() { + pkgdesc="U-Boot with Extlinux support for the Boundary Devices i.MX6 Quad Nitrogen6" + install=${pkgbase}.install + provides=('uboot4extlinux-imx') + conflicts=('uboot-nitrogen6q') + + install -d "${pkgdir}"/boot/extlinux + install -d "${pkgdir}"/boot/u-boot/images/ + install -Dm644 bin_nitrogen6q/u-boot.imx "${pkgdir}"/boot/u-boot/images/ + + install -Dm644 extlinux.conf "${pkgdir}"/boot/extlinux +} + +package_uboot4extlinux-mx6cuboxi() { + pkgdesc="U-Boot with Extlinux support for the SolidRun Cubox-i" + install=${pkgbase}.install + provides=('uboot4extlinux-imx') + conflicts=('uboot-mx6_cubox-i') + + install -d "${pkgdir}"/boot/extlinux + install -d "${pkgdir}"/boot/u-boot/images/ + install -Dm644 bin_mx6cuboxi/u-boot.imx "${pkgdir}"/boot/u-boot/images/ + + install -Dm644 extlinux.conf "${pkgdir}"/boot/extlinux +} + +package_uboot4extlinux-tbs2910() { + pkgdesc="U-Boot with Extlinux support for the TBS2910 Matrix ARM mini PC" + install=${pkgbase}.install + provides=('uboot4extlinux-imx') + + install -d "${pkgdir}"/boot/extlinux + install -d "${pkgdir}"/boot/u-boot/images/ + install -Dm644 bin_tbs2910/u-boot.imx "${pkgdir}"/boot/u-boot/images/ + + install -Dm644 extlinux.conf "${pkgdir}"/boot/extlinux +} + +package_uboot4extlinux-udoo() { + pkgdesc="U-Boot with Extlinux support for the Udoo Board" + install=${pkgbase}.install + provides=('uboot4extlinux-imx') + conflicts=('uboot-udoo') + + install -d "${pkgdir}"/boot/extlinux + install -d "${pkgdir}"/boot/u-boot/images/ + install -Dm644 udoo/u-boot.imx "${pkgdir}"/boot/u-boot/images/ + + install -Dm644 extlinux.conf "${pkgdir}"/boot/extlinux +} + +package_uboot4extlinux-usbarmory() { + pkgdesc="U-Boot with Extlinux support for the Inverse Path USB armory" + install=${pkgbase}.install + provides=('uboot4extlinux-imx') + conflicts=('uboot-usbarmory') + + install -d "${pkgdir}"/boot/extlinux + install -d "${pkgdir}"/boot/u-boot/images/ + install -Dm644 usbarmory/u-boot.imx "${pkgdir}"/boot/u-boot/images/ + + install -Dm644 extlinux.conf "${pkgdir}"/boot/extlinux +} + +package_uboot4extlinux-wandboard() { + pkgdesc="U-Boot with Extlinux support for the Wandboard" + install=${pkgbase}.install + provides=('uboot4extlinux-imx') + conflicts=('uboot-wandboard') + + install -d "${pkgdir}"/boot/extlinux + install -d "${pkgdir}"/boot/u-boot/images/ + install -Dm644 wandboard/u-boot.imx "${pkgdir}"/boot/u-boot/images/ + + install -Dm644 extlinux.conf "${pkgdir}"/boot/extlinux +} diff --git a/libre/uboot4extlinux-imx/extlinux.conf b/libre/uboot4extlinux-imx/extlinux.conf new file mode 100644 index 000000000..c41ce605a --- /dev/null +++ b/libre/uboot4extlinux-imx/extlinux.conf @@ -0,0 +1,51 @@ +menu title Welcome to U-Boot with Extlinux support! + +timeout 50 + +label Parabola GNU/Linux-libre, linux-libre kernel + kernel /boot/vmlinuz-linux-libre + initrd /boot/initramfs-linux-libre-fallback.img + append root=/dev/mmcblk0p1 rw rootwait + fdtdir /boot/dtbs/linux-libre + +label Parabola GNU/Linux-libre, linux-libre-lts kernel + kernel /boot/vmlinuz-linux-libre-lts + initrd /boot/initramfs-linux-libre-lts-fallback.img + append root=/dev/mmcblk0p1 rw rootwait + fdtdir /boot/dtbs/linux-libre-lts + +label Parabola GNU/Linux-libre, linux-libre-lts-knock kernel + kernel /boot/vmlinuz-linux-libre-lts-knock + initrd /boot/initramfs-linux-libre-lts-knock-fallback.img + append root=/dev/mmcblk0p1 rw rootwait + fdtdir /boot/dtbs/linux-libre-lts-knock + +label Parabola GNU/Linux-libre, linux-libre-hardened kernel + kernel /boot/vmlinuz-linux-libre-hardened + initrd /boot/initramfs-linux-libre-hardened-fallback.img + append root=/dev/mmcblk0p1 rw rootwait + fdtdir /boot/dtbs/linux-libre-hardened + +label Parabola GNU/Linux-libre, linux-libre-lts-apparmor kernel + kernel /boot/vmlinuz-linux-libre-lts-apparmor + initrd /boot/initramfs-linux-libre-lts-apparmor-fallback.img + append root=/dev/mmcblk0p1 rw rootwait + fdtdir /boot/dtbs/linux-libre-lts-apparmor + +label Parabola GNU/Linux-libre, linux-libre-pck kernel + kernel /boot/vmlinuz-linux-libre-pck + initrd /boot/initramfs-linux-libre-pck-fallback.img + append root=/dev/mmcblk0p1 rw rootwait + fdtdir /boot/dtbs/linux-libre-pck + +label Parabola GNU/Linux-libre, linux-libre-rt kernel + kernel /boot/vmlinuz-linux-libre-rt + initrd /boot/initramfs-linux-libre-rt-fallback.img + append root=/dev/mmcblk0p1 rw rootwait + fdtdir /boot/dtbs/linux-libre-rt + +label Parabola GNU/Linux-libre, linux-libre-xtreme kernel + kernel /boot/vmlinuz-linux-libre-xtreme + initrd /boot/initramfs-linux-libre-xtreme-fallback.img + append root=/dev/mmcblk0p1 rw rootwait + fdtdir /boot/dtbs/linux-libre-xtreme diff --git a/libre/uboot4extlinux-imx/tbs2910.h b/libre/uboot4extlinux-imx/tbs2910.h new file mode 100644 index 000000000..27166b719 --- /dev/null +++ b/libre/uboot4extlinux-imx/tbs2910.h @@ -0,0 +1,136 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright (C) 2014 Soeren Moch + * + * Configuration settings for the TBS2910 MatrixARM board. + */ + +#ifndef __TBS2910_CONFIG_H +#define __TBS2910_CONFIG_H + +#define CONFIG_BOOTCOMMAND \ + "mmc rescan; " \ + "if run bootcmd_up1; then " \ + "run bootcmd_up2; " \ + "else " \ + "run bootcmd_mmc || run distro_bootcmd; " \ + "fi" + +#ifndef CONFIG_SPL_BUILD +#define BOOT_TARGET_DEVICES(func) \ + func(MMC, mmc, 0) \ + func(MMC, mmc, 1) \ + func(MMC, mmc, 2) \ + func(SATA, sata, 0) \ + func(USB, usb, 0) \ + func(PXE, pxe, na) \ + func(DHCP, dhcp, na) +#include +#endif + +#include "mx6_common.h" + +/* General configuration */ + +#define CONFIG_MACH_TYPE 3980 + +#define CONFIG_SYS_HZ 1000 + +#define CONFIG_IMX_THERMAL + +/* Physical Memory Map */ +#define CONFIG_SYS_SDRAM_BASE MMDC0_ARB_BASE_ADDR + +#define CONFIG_SYS_INIT_RAM_ADDR IRAM_BASE_ADDR +#define CONFIG_SYS_INIT_RAM_SIZE IRAM_SIZE +#define CONFIG_SYS_INIT_SP_OFFSET \ + (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE) +#define CONFIG_SYS_INIT_SP_ADDR \ + (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET) + +#define CONFIG_SYS_MALLOC_LEN (128 * 1024 * 1024) + +#define CONFIG_SYS_MEMTEST_START CONFIG_SYS_SDRAM_BASE +#define CONFIG_SYS_MEMTEST_END \ + (CONFIG_SYS_MEMTEST_START + 500 * 1024 * 1024) + +#define CONFIG_SYS_BOOTMAPSZ 0x10000000 + +/* Serial console */ +#define CONFIG_MXC_UART +#define CONFIG_MXC_UART_BASE UART1_BASE /* select UART1/UART2 */ + +/* Framebuffer */ +#ifdef CONFIG_VIDEO +#define CONFIG_VIDEO_BMP_RLE8 +#define CONFIG_IMX_HDMI +#define CONFIG_IMX_VIDEO_SKIP +#endif + +/* PCI */ +#ifdef CONFIG_CMD_PCI +#define CONFIG_PCI_SCAN_SHOW +#define CONFIG_PCIE_IMX +#define CONFIG_PCIE_IMX_PERST_GPIO IMX_GPIO_NR(7, 12) +#endif + +/* SATA */ +#ifdef CONFIG_CMD_SATA +#define CONFIG_SYS_SATA_MAX_DEVICE 1 +#define CONFIG_DWC_AHSATA_PORT_ID 0 +#define CONFIG_DWC_AHSATA_BASE_ADDR SATA_ARB_BASE_ADDR +#define CONFIG_LBA48 +#define CONFIG_SYS_64BIT_LBA +#endif + +/* USB */ +#ifdef CONFIG_CMD_USB +#define CONFIG_EHCI_HCD_INIT_AFTER_RESET +#define CONFIG_MXC_USB_PORTSC (PORT_PTS_UTMI | PORT_PTS_PTW) +#ifdef CONFIG_CMD_USB_MASS_STORAGE +#define CONFIG_USBD_HS +#endif /* CONFIG_CMD_USB_MASS_STORAGE */ +#endif /* CONFIG_CMD_USB */ + +/* Environment organization */ +#define CONFIG_SYS_MMC_ENV_DEV 2 /* overwritten on SD boot */ +#define CONFIG_SYS_MMC_ENV_PART 1 /* overwritten on SD boot */ +#define CONFIG_ENV_OVERWRITE + +#define CONFIG_BOARD_SIZE_LIMIT 392192 /* (CONFIG_ENV_OFFSET - 1024) */ + +#define CONFIG_EXTRA_ENV_SETTINGS \ + "fdt_addr=0x13000000\0" \ + "fdt_addr_r=0x13000000\0" \ + "initrd_high=0xffffffff\0" \ + "kernel_addr_r=0x10008000\0" \ + "pxefile_addr_r=0x10008000\0" \ + "ramdisk_addr_r=0x18000000\0" \ + "scriptaddr=0x14000000\0" \ + "bootargs_mmc1=console=ttymxc0,115200 di0_primary console=tty1\0" \ + "bootargs_mmc2=video=mxcfb0:dev=hdmi,1920x1080M@60 " \ + "video=mxcfb1:off video=mxcfb2:off fbmem=28M\0" \ + "bootargs_mmc3=root=/dev/mmcblk0p1 rootwait consoleblank=0 quiet\0" \ + "bootargs_mmc=setenv bootargs ${bootargs_mmc1} ${bootargs_mmc2} " \ + "${bootargs_mmc3}\0" \ + "bootargs_upd=setenv bootargs console=ttymxc0,115200 " \ + "rdinit=/sbin/init enable_wait_mode=off\0" \ + "bootcmd_mmc=run bootargs_mmc; mmc dev 2; " \ + "mmc read 0x10800000 0x800 0x4000; bootm 0x10800000\0" \ + "bootcmd_up1=load mmc 1 0x10800000 uImage\0" \ + "bootcmd_up2=load mmc 1 0x10d00000 uramdisk.img; " \ + "run bootargs_upd; " \ + "bootm 0x10800000 0x10d00000\0" \ + "console=ttymxc0\0" \ + "fan=gpio set 92\0" \ + "set_con_serial=setenv stdout serial; " \ + "setenv stderr serial\0" \ + "set_con_hdmi=setenv stdout serial,vga; " \ + "setenv stderr serial,vga\0" \ + "stderr=serial,vga\0" \ + "stdin=serial,usbkbd\0" \ + "stdout=serial,vga\0" \ + "fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" \ + BOOTENV + +#endif /* __TBS2910_CONFIG_H * */ diff --git a/libre/uboot4extlinux-imx/tbs2910_defconfig b/libre/uboot4extlinux-imx/tbs2910_defconfig new file mode 100644 index 000000000..033fdd3cd --- /dev/null +++ b/libre/uboot4extlinux-imx/tbs2910_defconfig @@ -0,0 +1,84 @@ +CONFIG_ARM=y +CONFIG_ARCH_MX6=y +CONFIG_SYS_TEXT_BASE=0x17800000 +CONFIG_TARGET_TBS2910=y +CONFIG_ENV_SIZE=0x2000 +CONFIG_ENV_OFFSET=0x60000 +CONFIG_DM_GPIO=y +CONFIG_NR_DRAM_BANKS=1 +CONFIG_PRE_CON_BUF_ADDR=0x7c000000 +CONFIG_CMD_HDMIDETECT=y +CONFIG_AHCI=y +CONFIG_DISTRO_DEFAULTS=y +CONFIG_SATA_BOOT=y +CONFIG_SD_BOOT=y +CONFIG_BOOTDELAY=3 +# CONFIG_USE_BOOTCOMMAND is not set +CONFIG_USE_PREBOOT=y +CONFIG_PREBOOT="echo PCI:; pci enum; pci 1; usb start; if hdmidet; then run set_con_hdmi; else run set_con_serial; fi" +CONFIG_PRE_CONSOLE_BUFFER=y +CONFIG_DEFAULT_FDT_FILE="imx6q-tbs2910.dtb" +CONFIG_BOUNCE_BUFFER=y +CONFIG_BOARD_EARLY_INIT_F=y +CONFIG_SYS_PROMPT="Matrix U-Boot> " +# CONFIG_CMD_BOOTM is not set +# CONFIG_CMD_ELF is not set +# CONFIG_CMD_FDT is not set +# CONFIG_CMD_GO is not set +CONFIG_CMD_ERASEENV=y +# CONFIG_CMD_CRC32 is not set +CONFIG_CMD_MEMTEST=y +# CONFIG_CMD_FUSE is not set +CONFIG_CMD_GPIO=y +CONFIG_CMD_I2C=y +# CONFIG_CMD_LOADB is not set +# CONFIG_CMD_LOADS is not set +CONFIG_CMD_MMC=y +# CONFIG_CMD_PINMUX is not set +CONFIG_CMD_SATA=y +CONFIG_CMD_USB=y +CONFIG_CMD_USB_MASS_STORAGE=y +CONFIG_CMD_TIME=y +CONFIG_CMD_EXT4_WRITE=y +# CONFIG_ISO_PARTITION is not set +CONFIG_OF_CONTROL=y +CONFIG_OF_EMBED=y +CONFIG_DEFAULT_DEVICE_TREE="imx6q-tbs2910" +CONFIG_ENV_IS_IN_MMC=y +CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_DM=y +# CONFIG_DM_WARN is not set +CONFIG_DWC_AHSATA=y +# CONFIG_BLOCK_CACHE is not set +CONFIG_DM_I2C=y +CONFIG_SYS_I2C_MXC=y +CONFIG_DM_KEYBOARD=y +# CONFIG_MXC_OCOTP is not set +CONFIG_DM_MMC=y +CONFIG_FSL_USDHC=y +CONFIG_PHYLIB=y +CONFIG_PHY_ATHEROS=y +CONFIG_DM_ETH=y +CONFIG_FEC_MXC=y +CONFIG_MII=y +CONFIG_PINCTRL=y +CONFIG_PINCTRL_IMX6=y +# CONFIG_RAM_ROCKCHIP_DEBUG is not set +CONFIG_DM_RTC=y +CONFIG_RTC_DS1307=y +CONFIG_USB=y +CONFIG_DM_USB=y +CONFIG_USB_KEYBOARD=y +CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE=y +CONFIG_USB_GADGET=y +CONFIG_USB_GADGET_MANUFACTURER="TBS" +CONFIG_USB_GADGET_VENDOR_NUM=0x0525 +CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5 +CONFIG_CI_UDC=y +CONFIG_USB_GADGET_DOWNLOAD=y +CONFIG_I2C_EDID=y +CONFIG_VIDEO_IPUV3=y +CONFIG_VIDEO=y +# CONFIG_REGEX is not set +CONFIG_OF_LIBFDT_ASSUME_MASK=0xff +# CONFIG_EFI_LOADER is not set diff --git a/libre/uboot4extlinux-imx/uboot4extlinux-imx.install b/libre/uboot4extlinux-imx/uboot4extlinux-imx.install new file mode 100644 index 000000000..b2860fca2 --- /dev/null +++ b/libre/uboot4extlinux-imx/uboot4extlinux-imx.install @@ -0,0 +1,35 @@ +flash_instructions() { + echo "# dd if=/boot/u-boot/images/u-boot.imx of=/dev/mmcblk0 bs=512 seek=2" +} + +extlinux_warning() { + echo "==> WARNING: Remember to set up your kernels in /boot/extlinux/extlinux.conf" +} + +flash_uboot() { + root=$(mount | awk '/ on \/ / { print $1; }') + if [[ $root =~ ^/dev/mmcblk.*$ ]]; then + root=${root:0:12} + echo "A new U-Boot version needs to be flashed onto $root." + echo "Do you want to do this now? [y|N]" + read -r shouldwe + if [[ $shouldwe =~ ^([yY][eE][sS]|[yY])$ ]]; then + dd if=/boot/u-boot/images/u-boot.imx of=$root bs=512 seek=2 + else + echo "You can do this later by running:" + flash_instructions + fi + else + echo "Flash the new U-Boot version onto your boot device. For example:" + flash_instructions + fi + extlinux_warning +} + +post_install() { + flash_uboot +} + +post_upgrade() { + flash_uboot +} \ No newline at end of file -- cgit v1.2.3