From 393d3e85783d2f68a58d8d85f4bf8c8a6c1382c7 Mon Sep 17 00:00:00 2001 From: Kevin Mihelich Date: Tue, 3 Apr 2018 00:27:04 +0000 Subject: [PATCH] added alarm/uboot-macchiatobin --- .../0001-ATF-toolchain-fixes.patch | 25 ++++ .../0001-DDR-toolchain-fixes.patch | 25 ++++ .../0001-arch-linux-arm-modifications.patch | 122 ++++++++++++++++++ alarm/uboot-macchiatobin/PKGBUILD | 64 +++++++++ alarm/uboot-macchiatobin/boot.txt | 15 +++ alarm/uboot-macchiatobin/mkscr | 9 ++ .../uboot-macchiatobin.install | 20 +++ 7 files changed, 280 insertions(+) create mode 100644 alarm/uboot-macchiatobin/0001-ATF-toolchain-fixes.patch create mode 100644 alarm/uboot-macchiatobin/0001-DDR-toolchain-fixes.patch create mode 100644 alarm/uboot-macchiatobin/0001-arch-linux-arm-modifications.patch create mode 100644 alarm/uboot-macchiatobin/PKGBUILD create mode 100644 alarm/uboot-macchiatobin/boot.txt create mode 100755 alarm/uboot-macchiatobin/mkscr create mode 100644 alarm/uboot-macchiatobin/uboot-macchiatobin.install diff --git a/alarm/uboot-macchiatobin/0001-ATF-toolchain-fixes.patch b/alarm/uboot-macchiatobin/0001-ATF-toolchain-fixes.patch new file mode 100644 index 000000000..d3e617992 --- /dev/null +++ b/alarm/uboot-macchiatobin/0001-ATF-toolchain-fixes.patch @@ -0,0 +1,25 @@ +From cf823a1df66cc258afe1f2c870b4cbd182489f97 Mon Sep 17 00:00:00 2001 +From: Kevin Mihelich +Date: Sun, 25 Feb 2018 12:28:01 -0700 +Subject: [PATCH] ATF toolchain fixes + +--- + Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Makefile b/Makefile +index 5b67763e..5571a9c0 100644 +--- a/Makefile ++++ b/Makefile +@@ -246,7 +246,7 @@ TF_CFLAGS += -nostdinc -ffreestanding -Wall \ + -std=c99 -c -Os \ + $(TF_CFLAGS_$(ARCH)) \ + ${DEFINES} ${INCLUDES} +-TF_CFLAGS += -ffunction-sections -fdata-sections ++TF_CFLAGS += -ffunction-sections -fdata-sections -fno-stack-protector -fno-pie + + LDFLAGS += --fatal-warnings -O1 + LDFLAGS += --gc-sections +-- +2.14.1 + diff --git a/alarm/uboot-macchiatobin/0001-DDR-toolchain-fixes.patch b/alarm/uboot-macchiatobin/0001-DDR-toolchain-fixes.patch new file mode 100644 index 000000000..5488d1cfe --- /dev/null +++ b/alarm/uboot-macchiatobin/0001-DDR-toolchain-fixes.patch @@ -0,0 +1,25 @@ +From bacc2b70d8b7258bb4c07c8ac1c490c604d6efb4 Mon Sep 17 00:00:00 2001 +From: Kevin Mihelich +Date: Sun, 25 Feb 2018 12:28:30 -0700 +Subject: [PATCH] DDR toolchain fixes + +--- + Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Makefile b/Makefile +index 7c70d75..83bdb5e 100755 +--- a/Makefile ++++ b/Makefile +@@ -253,7 +253,7 @@ INCLUDE += $(PLAT_INCLUDES) + MV_DDR_LIBNAME = mv_ddr_lib.a + MV_DDR_LIB = $(OBJ_DIR)/$(MV_DDR_LIBNAME) + +-CFLAGS = -Wall -Werror -Os -ffreestanding -mlittle-endian -g -gdwarf-2 -nostdinc ++CFLAGS = -Wall -Werror -Os -ffreestanding -mlittle-endian -g -gdwarf-2 -nostdinc -fno-stack-protector -fno-pie + # PLATFORM is set in ble/ble.mk + CFLAGS += -march=armv8-a -fpie $(INCLUDE) + CFLAGS += -DMV_DDR_ATF -DCONFIG_APN806 +-- +2.14.1 + diff --git a/alarm/uboot-macchiatobin/0001-arch-linux-arm-modifications.patch b/alarm/uboot-macchiatobin/0001-arch-linux-arm-modifications.patch new file mode 100644 index 000000000..9ab5adc61 --- /dev/null +++ b/alarm/uboot-macchiatobin/0001-arch-linux-arm-modifications.patch @@ -0,0 +1,122 @@ +From e3d5a4003a0d24aba8600300fbbe6b6b75d21464 Mon Sep 17 00:00:00 2001 +From: Kevin Mihelich +Date: Sun, 25 Feb 2018 12:20:18 -0700 +Subject: [PATCH] arch linux arm modifications + +--- + configs/mvebu_mcbin-88f8040_defconfig | 1 + + drivers/usb/eth/r8152.c | 4 +-- + include/configs/mvebu_armada-common.h | 61 ++++++++++++++--------------------- + 3 files changed, 27 insertions(+), 39 deletions(-) + +diff --git a/configs/mvebu_mcbin-88f8040_defconfig b/configs/mvebu_mcbin-88f8040_defconfig +index 8932ceac3c..b85e318e37 100644 +--- a/configs/mvebu_mcbin-88f8040_defconfig ++++ b/configs/mvebu_mcbin-88f8040_defconfig +@@ -84,3 +84,4 @@ CONFIG_USB_XHCI_HCD=y + CONFIG_USB_EHCI_HCD=y + CONFIG_USB_STORAGE=y + CONFIG_SMBIOS_MANUFACTURER="" ++CONFIG_MVEBU_MMC_BOOT +diff --git a/drivers/usb/eth/r8152.c b/drivers/usb/eth/r8152.c +index ed441f3243..e09351b0d2 100644 +--- a/drivers/usb/eth/r8152.c ++++ b/drivers/usb/eth/r8152.c +@@ -26,7 +26,7 @@ struct r8152_dongle { + unsigned short product; + }; + +-static const struct r8152_dongle const r8152_dongles[] = { ++static const struct r8152_dongle r8152_dongles[] = { + /* Realtek */ + { 0x0bda, 0x8050 }, + { 0x0bda, 0x8152 }, +@@ -59,7 +59,7 @@ struct r8152_version { + bool gmii; + }; + +-static const struct r8152_version const r8152_versions[] = { ++static const struct r8152_version r8152_versions[] = { + { 0x4c00, RTL_VER_01, 0 }, + { 0x4c10, RTL_VER_02, 0 }, + { 0x5c00, RTL_VER_03, 1 }, +diff --git a/include/configs/mvebu_armada-common.h b/include/configs/mvebu_armada-common.h +index c406a7aa1b..de084959bc 100644 +--- a/include/configs/mvebu_armada-common.h ++++ b/include/configs/mvebu_armada-common.h +@@ -34,43 +34,7 @@ + #define CONFIG_HAS_ETH1 + #define CONFIG_HAS_ETH2 + #define CONFIG_ETHPRIME "eth0" +-#define CONFIG_ROOTPATH "/srv/nfs/" /* Default Dir for NFS */ +-#define CONFIG_EXTRA_ENV_SETTINGS "kernel_addr=0x5000000\0" \ +- "initrd_addr=0xa00000\0" \ +- "initrd_size=0x2000000\0" \ +- "fdt_addr=0x4f00000\0" \ +- "loadaddr=0x5000000\0" \ +- "fdt_high=0xffffffffffffffff\0" \ +- "hostname=marvell\0" \ +- "ramfs_addr=0x8000000\0" \ +- "ramfs_name=-\0" \ +- "fdt_name=fdt.dtb\0" \ +- "netdev=eth0\0" \ +- "ethaddr=00:51:82:11:22:00\0" \ +- "eth1addr=00:51:82:11:22:01\0" \ +- "eth2addr=00:51:82:11:22:02\0" \ +- "eth3addr=00:51:82:11:22:03\0" \ +- "image_name=Image\0" \ +- "get_ramfs=if test \"${ramfs_name}\"" \ +- " != \"-\"; then setenv " \ +- "ramfs_addr 0x8000000; " \ +- "tftpboot $ramfs_addr " \ +- "$ramfs_name; else setenv " \ +- "ramfs_addr -;fi\0" \ +- "get_images=tftpboot $kernel_addr " \ +- "$image_name; tftpboot " \ +- "$fdt_addr $fdt_name; " \ +- "run get_ramfs\0" \ +- "console=" CONFIG_DEFAULT_CONSOLE "\0"\ +- "root=root=/dev/nfs rw\0" \ +- "set_bootargs=setenv bootargs $console"\ +- " $root ip=$ipaddr:$serverip:" \ +- "$gatewayip:$netmask:$hostname"\ +- ":$netdev:none nfsroot="\ +- "$serverip:$rootpath " \ +- "$extra_params" +-#define CONFIG_BOOTCOMMAND "run get_images; run set_bootargs; " \ +- "booti $kernel_addr $ramfs_addr $fdt_addr" ++ + #define CONFIG_ENV_OVERWRITE /* ethaddr can be reprogrammed */ + /* + * For booting Linux, the board info and command line data +@@ -175,4 +139,27 @@ + */ + #define CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS 10 + ++#include ++ ++#define BOOT_TARGET_DEVICES(func) \ ++ func(MMC, mmc, 1) \ ++ func(MMC, mmc, 0) \ ++ func(USB, usb, 0) \ ++ func(SCSI, scsi, 0) ++ ++#include ++ ++#define CONFIG_EXTRA_ENV_SETTINGS \ ++ "scriptaddr=0x4d00000\0" \ ++ "pxefile_addr_r=0x4e00000\0" \ ++ "fdt_addr_r=0x4f00000\0" \ ++ "kernel_addr_r=0x5000000\0" \ ++ "ramdisk_addr_r=0x8000000\0" \ ++ "fdtfile=" CONFIG_DEFAULT_DEVICE_TREE ".dtb\0" \ ++ "eth1addr=00:51:82:11:22:01\0" \ ++ "eth2addr=00:51:82:11:22:02\0" \ ++ "eth3addr=00:51:82:11:22:03\0" \ ++ "ethaddr=00:51:82:11:22:00\0" \ ++ BOOTENV ++ + #endif /* _CONFIG_MVEBU_ARMADA_H */ +-- +2.14.1 + diff --git a/alarm/uboot-macchiatobin/PKGBUILD b/alarm/uboot-macchiatobin/PKGBUILD new file mode 100644 index 000000000..dce9b7cf5 --- /dev/null +++ b/alarm/uboot-macchiatobin/PKGBUILD @@ -0,0 +1,64 @@ +# U-Boot: MACCHIATObin +# Maintainer: Kevin Mihelich + +buildarch=8 + +pkgname=uboot-macchiatobin +pkgver=2017.03 +pkgrel=1 +pkgdesc="U-Boot for MACCHIATObin" +arch=('aarch64') +url='http://www.denx.de/wiki/U-Boot/WebHome' +license=('GPL' 'custom') +install=$pkgname.install +backup=('boot/boot.txt' 'boot/boot.scr') +makedepends=('bc' 'dtc145' 'git') +options=('!strip') +source=('git+https://github.com/MarvellEmbeddedProcessors/u-boot-marvell#branch=u-boot-2017.03-armada-17.10' + 'git+https://github.com/MarvellEmbeddedProcessors/binaries-marvell#branch=binaries-marvell-armada-17.10' + 'git+https://github.com/MarvellEmbeddedProcessors/atf-marvell#branch=atf-v1.3-armada-17.10' + 'git+https://github.com/MarvellEmbeddedProcessors/mv-ddr-marvell#branch=mv_ddr-armada-17.10' + '0001-arch-linux-arm-modifications.patch' + '0001-ATF-toolchain-fixes.patch' + '0001-DDR-toolchain-fixes.patch' + 'boot.txt' + 'mkscr') +md5sums=('SKIP' + 'SKIP' + 'SKIP' + 'SKIP' + '77079375821a6af000ab0ab9c5007539' + 'd00628523a4fc02898d0115dd9f11d29' + '9fd32c9b80e6773f4188c8b95539a281' + '7eabc1489d5248f4a7809eb2c0d189be' + '021623a04afd29ac3f368977140cfbfd') + +prepare() { + unset CFLAGS CXXFLAGS CPPFLAGS LDFLAGS + cd u-boot-marvell + patch -p1 -i ../0001-arch-linux-arm-modifications.patch + cd ../atf-marvell + patch -p1 -i ../0001-ATF-toolchain-fixes.patch + cd ../mv-ddr-marvell + patch -p1 -i ../0001-DDR-toolchain-fixes.patch +} + +build() { + cd u-boot-marvell + make mvebu_mcbin-88f8040_defconfig + echo 'CONFIG_IDENT_STRING=" Arch Linux ARM"' >> .config + make + + cd .. + export BL33=$(pwd)/u-boot-marvell/u-boot.bin + export SCP_BL2=$(pwd)/binaries-marvell/mrvl_scp_bl2_8040.img + export DDR_PATH=$(pwd)/mv-ddr-marvell + + cd atf-marvell + make USE_COHERENT_MEM=0 LOG_LEVEL=20 MV_DDR_PATH=${DDR_PATH} PLAT=a80x0_mcbin all fip +} + +package() { + install -Dpt "${pkgdir}"/boot atf-marvell/build/a80x0_mcbin/release/flash-image.bin mkscr boot.txt + u-boot-marvell/tools/mkimage -A arm -O linux -T script -C none -n "U-Boot boot script" -d boot.txt "${pkgdir}"/boot/boot.scr +} diff --git a/alarm/uboot-macchiatobin/boot.txt b/alarm/uboot-macchiatobin/boot.txt new file mode 100644 index 000000000..fc48ea760 --- /dev/null +++ b/alarm/uboot-macchiatobin/boot.txt @@ -0,0 +1,15 @@ +# After modifying, run ./mkscr + +test -n "${distro_bootpart}" || setenv distro_bootpart 1 +part uuid ${devtype} ${devnum}:${distro_bootpart} uuid +setenv bootargs "console=ttyS0,115200 root=PARTUUID=${uuid} rw rootwait earlycon" + +if load ${devtype} ${devnum}:${distro_bootpart} ${kernel_addr_r} /boot/Image; then + if load ${devtype} ${devnum}:${distro_bootpart} ${fdt_addr_r} /boot/dtbs/marvell/${fdtfile}; then + if load ${devtype} ${devnum}:${distro_bootpart} ${ramdisk_addr_r} /boot/initramfs-linux.img; then + booti ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr_r}; + else + booti ${kernel_addr_r} - ${fdt_addr_r}; + fi; + fi; +fi diff --git a/alarm/uboot-macchiatobin/mkscr b/alarm/uboot-macchiatobin/mkscr new file mode 100755 index 000000000..272b6a7a5 --- /dev/null +++ b/alarm/uboot-macchiatobin/mkscr @@ -0,0 +1,9 @@ +#!/bin/bash + +if [[ ! -x /usr/bin/mkimage ]]; then + echo "mkimage not found. Please install uboot-tools:" + echo " pacman -S uboot-tools" + exit 1 +fi + +mkimage -A arm -O linux -T script -C none -n "U-Boot boot script" -d boot.txt boot.scr diff --git a/alarm/uboot-macchiatobin/uboot-macchiatobin.install b/alarm/uboot-macchiatobin/uboot-macchiatobin.install new file mode 100644 index 000000000..4b17b6f62 --- /dev/null +++ b/alarm/uboot-macchiatobin/uboot-macchiatobin.install @@ -0,0 +1,20 @@ +flash_uboot() { + dev="/dev/mmcblk1" + + echo "A new U-Boot version needs to be flashed onto ${dev}." + echo "Do you want to do this now? [y|N]" + read -r shouldwe + if [[ $shouldwe =~ ^([yY][eE][sS]|[yY])$ ]]; then + dd if=/boot/flash-image.bin of=${dev} seek=4096 conv=fdatasync,notrunc + else + echo "You can do this later by reinstalling the package." + fi +} + +post_install() { + flash_uboot +} + +post_upgrade() { + flash_uboot +}