diff --git a/alarm/uboot-odroid-c2/0001-remove-cross-compiling.patch b/alarm/uboot-odroid-c2/0001-remove-cross-compiling.patch new file mode 100644 index 000000000..1b8473fe0 --- /dev/null +++ b/alarm/uboot-odroid-c2/0001-remove-cross-compiling.patch @@ -0,0 +1,29 @@ +From 24ba32a8a4a560f821f7754b676a19de7597b23e Mon Sep 17 00:00:00 2001 +From: Kevin Mihelich +Date: Wed, 3 Feb 2016 19:29:25 -0700 +Subject: [PATCH 1/4] remove cross compiling + +--- + Makefile | 6 ------ + 1 file changed, 6 deletions(-) + +diff --git a/Makefile b/Makefile +index 1da09c2..2968eb4 100644 +--- a/Makefile ++++ b/Makefile +@@ -244,12 +244,6 @@ export HOSTARCH HOSTOS + # set default to nothing for native builds + ifeq ($(HOSTARCH),$(ARCH)) + CROSS_COMPILE ?= +-else +-ifeq ($(CROSS_COMPILE),) +-CROSS_COMPILE = /opt/toolchains/gcc-linaro-aarch64-none-elf-4.9-2014.09_linux/bin/aarch64-none-elf- +-export CROSS_COMPILE +-endif +- + endif + + KCONFIG_CONFIG ?= .config +-- +2.7.0 + diff --git a/alarm/uboot-odroid-c2/0002-sd_fusing-tweaks.patch b/alarm/uboot-odroid-c2/0002-sd_fusing-tweaks.patch new file mode 100644 index 000000000..2a7e0c3c6 --- /dev/null +++ b/alarm/uboot-odroid-c2/0002-sd_fusing-tweaks.patch @@ -0,0 +1,43 @@ +From dc03be243f1d4b1c410b748373a9fda99c237797 Mon Sep 17 00:00:00 2001 +From: Kevin Mihelich +Date: Wed, 3 Feb 2016 20:59:26 -0700 +Subject: [PATCH 2/4] sd_fusing tweaks + +--- + sd_fuse/sd_fusing.sh | 13 ++++++------- + 1 file changed, 6 insertions(+), 7 deletions(-) + +diff --git a/sd_fuse/sd_fusing.sh b/sd_fuse/sd_fusing.sh +index 538185b..c14e0e2 100755 +--- a/sd_fuse/sd_fusing.sh ++++ b/sd_fuse/sd_fusing.sh +@@ -15,20 +15,19 @@ if [ -z $1 ]; then + fi + + if [ ! -f $BL1 ]; then +- echo "error: $BL1 is not exist" ++ echo "error: $BL1 does not exist" + exit 1 + fi + + if [ ! -f $UBOOT ]; then +- echo "error: $UBOOT is not exist" ++ echo "error: $UBOOT does not exist" + exit 1 + fi + +-sudo dd if=$BL1 of=$1 conv=fsync bs=1 count=442 +-sudo dd if=$BL1 of=$1 conv=fsync bs=512 skip=1 seek=1 +-sudo dd if=$UBOOT of=$1 conv=fsync bs=512 seek=97 ++dd if=$BL1 of=$1 conv=fsync bs=1 count=442 ++dd if=$BL1 of=$1 conv=fsync bs=512 skip=1 seek=1 ++dd if=$UBOOT of=$1 conv=fsync bs=512 seek=97 + + sync + +-sudo eject $1 +-echo Finished. ++echo "Successfully wrote U-Boot to $1" +-- +2.7.0 + diff --git a/alarm/uboot-odroid-c2/0003-Add-linux-compiler-gcc5.h-to-fix-builds-with-gcc5.patch b/alarm/uboot-odroid-c2/0003-Add-linux-compiler-gcc5.h-to-fix-builds-with-gcc5.patch new file mode 100644 index 000000000..dc7bbe791 --- /dev/null +++ b/alarm/uboot-odroid-c2/0003-Add-linux-compiler-gcc5.h-to-fix-builds-with-gcc5.patch @@ -0,0 +1,93 @@ +From ce0efbe9297fafe9a18a6fdbf909600115e21746 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Sat, 7 Feb 2015 22:52:40 +0100 +Subject: [PATCH 3/4] Add linux/compiler-gcc5.h to fix builds with gcc5 + +Add linux/compiler-gcc5/h from the kernel sources at: + +commit 5631b8fba640a4ab2f8a954f63a603fa34eda96b +Author: Steven Noonan +Date: Sat Oct 25 15:09:42 2014 -0700 + + compiler/gcc4+: Remove inaccurate comment about 'asm goto' miscompiles + +Signed-off-by: Hans de Goede +--- + include/linux/compiler-gcc5.h | 65 +++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 65 insertions(+) + create mode 100644 include/linux/compiler-gcc5.h + +diff --git a/include/linux/compiler-gcc5.h b/include/linux/compiler-gcc5.h +new file mode 100644 +index 0000000..c8c5659 +--- /dev/null ++++ b/include/linux/compiler-gcc5.h +@@ -0,0 +1,65 @@ ++#ifndef __LINUX_COMPILER_H ++#error "Please don't include directly, include instead." ++#endif ++ ++#define __used __attribute__((__used__)) ++#define __must_check __attribute__((warn_unused_result)) ++#define __compiler_offsetof(a, b) __builtin_offsetof(a, b) ++ ++/* Mark functions as cold. gcc will assume any path leading to a call ++ to them will be unlikely. This means a lot of manual unlikely()s ++ are unnecessary now for any paths leading to the usual suspects ++ like BUG(), printk(), panic() etc. [but let's keep them for now for ++ older compilers] ++ ++ Early snapshots of gcc 4.3 don't support this and we can't detect this ++ in the preprocessor, but we can live with this because they're unreleased. ++ Maketime probing would be overkill here. ++ ++ gcc also has a __attribute__((__hot__)) to move hot functions into ++ a special section, but I don't see any sense in this right now in ++ the kernel context */ ++#define __cold __attribute__((__cold__)) ++ ++#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__) ++ ++#ifndef __CHECKER__ ++# define __compiletime_warning(message) __attribute__((warning(message))) ++# define __compiletime_error(message) __attribute__((error(message))) ++#endif /* __CHECKER__ */ ++ ++/* ++ * Mark a position in code as unreachable. This can be used to ++ * suppress control flow warnings after asm blocks that transfer ++ * control elsewhere. ++ * ++ * Early snapshots of gcc 4.5 don't support this and we can't detect ++ * this in the preprocessor, but we can live with this because they're ++ * unreleased. Really, we need to have autoconf for the kernel. ++ */ ++#define unreachable() __builtin_unreachable() ++ ++/* Mark a function definition as prohibited from being cloned. */ ++#define __noclone __attribute__((__noclone__)) ++ ++/* ++ * Tell the optimizer that something else uses this function or variable. ++ */ ++#define __visible __attribute__((externally_visible)) ++ ++/* ++ * GCC 'asm goto' miscompiles certain code sequences: ++ * ++ * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670 ++ * ++ * Work it around via a compiler barrier quirk suggested by Jakub Jelinek. ++ * ++ * (asm goto is automatically volatile - the naming reflects this.) ++ */ ++#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0) ++ ++#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP ++#define __HAVE_BUILTIN_BSWAP32__ ++#define __HAVE_BUILTIN_BSWAP64__ ++#define __HAVE_BUILTIN_BSWAP16__ ++#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */ +-- +2.7.0 + diff --git a/alarm/uboot-odroid-c2/0004-arch-linux-arm-modifications.patch b/alarm/uboot-odroid-c2/0004-arch-linux-arm-modifications.patch new file mode 100644 index 000000000..58ce659a3 --- /dev/null +++ b/alarm/uboot-odroid-c2/0004-arch-linux-arm-modifications.patch @@ -0,0 +1,44 @@ +From 6af9b7ee486ca363c9417870abe9646f80f3bc0d Mon Sep 17 00:00:00 2001 +From: Kevin Mihelich +Date: Wed, 3 Feb 2016 21:23:59 -0700 +Subject: [PATCH 4/4] arch linux arm modifications + +--- + common/cmd_cfgload.c | 2 +- + include/configs/odroidc2.h | 7 +++++++ + 2 files changed, 8 insertions(+), 1 deletion(-) + +diff --git a/common/cmd_cfgload.c b/common/cmd_cfgload.c +index 6774e37..bb08f96 100644 +--- a/common/cmd_cfgload.c ++++ b/common/cmd_cfgload.c +@@ -52,7 +52,7 @@ static char* read_cfgload(void) + + setenv("filesize", "0"); + +- sprintf(cmd, "fatload mmc 0:1 0x%p boot.ini", (void *)p); ++ sprintf(cmd, "load mmc 0:1 0x%p /boot/boot.ini", (void *)p); + run_command(cmd, 0); + + filesize = getenv_ulong("filesize", 16, 0); +diff --git a/include/configs/odroidc2.h b/include/configs/odroidc2.h +index c1140b4..1268ca5 100644 +--- a/include/configs/odroidc2.h ++++ b/include/configs/odroidc2.h +@@ -74,6 +74,13 @@ + + #define CONFIG_BOOTDELAY 1 // Seconds + ++/* Arch Linux ARM */ ++#define CONFIG_CMD_FS_GENERIC ++#define CONFIG_SUPPORT_RAW_INITRD ++#define CONFIG_IDENT_STRING " Arch Linux ARM" ++#define CONFIG_CMD_PART ++#define CONFIG_PARTITION_UUIDS ++ + /* args/envs */ + #define CONFIG_SYS_MAXARGS 64 + +-- +2.7.0 + diff --git a/alarm/uboot-odroid-c2/PKGBUILD b/alarm/uboot-odroid-c2/PKGBUILD new file mode 100644 index 000000000..68f55611a --- /dev/null +++ b/alarm/uboot-odroid-c2/PKGBUILD @@ -0,0 +1,58 @@ +# U-Boot: ODROID-C2 +# Maintainer: Kevin Mihelich + +# Note: must be built on x86 with an old cross toolchain + +buildarch=8 +noautobuild=1 + +pkgname=uboot-odroid-c2 +pkgver=2015.01 +pkgrel=1 +pkgdesc="U-Boot for ODROID-C2" +arch=('aarch64') +url="https://github.com/hardkernel/u-boot" +license=('GPL') +install=$pkgname.install +makedepends=('git' 'bc') +backup=('boot/boot.ini') +_commit=5785ef87af8998195c94af38a6b6d0b6ef327afa +source=("https://github.com/hardkernel/u-boot/archive/${_commit}.tar.gz" + 'boot.ini' + '0001-remove-cross-compiling.patch' + '0002-sd_fusing-tweaks.patch' + '0003-Add-linux-compiler-gcc5.h-to-fix-builds-with-gcc5.patch' + '0004-arch-linux-arm-modifications.patch') +md5sums=('46c3c2c4e28e18c04e81fc878868f5ca' + '04b71c2e7ec5734f9646cfed8d26f7ae' + '2ade162338fe32a4a156eede084222c0' + '296596234d264ae7d5278e2c4068144f' + '75d6a8bf332b61b8499bb49e99918078' + 'e15e3965405942b388f5aa51b4880cce') + +prepare() { + cd u-boot-${_commit} + + git apply ../0001-remove-cross-compiling.patch + git apply ../0002-sd_fusing-tweaks.patch + git apply ../0003-Add-linux-compiler-gcc5.h-to-fix-builds-with-gcc5.patch + git apply ../0004-arch-linux-arm-modifications.patch +} + +build() { + cd u-boot-${_commit} + + unset CFLAGS CXXFLAGS CPPFLAGS LDFLAGS + + make distclean + make odroidc2_config + make -j1 EXTRAVERSION=-${pkgrel} +} + +package() { + cd u-boot-${_commit}/sd_fuse + + mkdir -p "${pkgdir}"/boot + cp bl1.bin.hardkernel sd_fusing.sh u-boot.bin "${pkgdir}"/boot + cp "${srcdir}"/boot.ini "${pkgdir}"/boot +} diff --git a/alarm/uboot-odroid-c2/boot.ini b/alarm/uboot-odroid-c2/boot.ini new file mode 100644 index 000000000..1aae57bc2 --- /dev/null +++ b/alarm/uboot-odroid-c2/boot.ini @@ -0,0 +1,85 @@ +ODROIDC2-UBOOT-CONFIG + +# Possible screen resolutions +# Uncomment only a single Line! The line with setenv written. +# At least one mode must be selected. + +# 480 Lines (720x480) +# setenv m "480i60hz" # Interlaced 60Hz +# setenv m "480i_rpt" # Interlaced for Rear Projection Televisions 60Hz +# setenv m "480p60hz" # 480 Progressive 60Hz +# setenv m "480p_rpt" # 480 Progressive for Rear Projection Televisions 60Hz + +# 576 Lines (720x576) +# setenv m "576i50hz" # Interlaced 50Hz +# setenv m "576i_rpt" # Interlaced for Rear Projection Televisions 50Hz +# setenv m "576p50hz" # Progressive 50Hz +# setenv m "576p_rpt" # Progressive for Rear Projection Televisions 50Hz + +# 720 Lines (1280x720) +# setenv m "720p50hz" # 50Hz +# setenv m "720p60hz" # 60Hz + +# 1080 Lines (1920x1080) +# setenv m "1080i60hz" # Interlaced 60Hz +setenv m "1080p60hz" # Progressive 60Hz +# setenv m "1080i50hz" # Interlaced 50Hz +# setenv m "1080p50hz" # Progressive 50Hz +# setenv m "1080p24hz" # Progressive 24Hz + +# 4K (3840x2160) +# setenv m "2160p30hz" # Progressive 30Hz +# setenv m "2160p25hz" # Progressive 25Hz +# setenv m "2160p24hz" # Progressive 24Hz +# setenv m "smpte24hz" # Progressive 24Hz SMPTE +# setenv m "2160p50hz" # Progressive 50Hz +# setenv m "2160p60hz" # Progressive 60Hz +# setenv m "2160p50hz420" # Progressive 50Hz with YCbCr 4:2:0 (Requires TV/Monitor that supports it) +# setenv m "2160p60hz420" # Progressive 60Hz with YCbCr 4:2:0 (Requires TV/Monitor that supports it) + +### VESA modes ### +# setenv m "640x480p60hz" +# setenv m "800x480p60hz" +# setenv m "800x600p60hz" +# setenv m "1024x600p60hz" +# setenv m "1024x768p60hz" +# setenv m "1280x800p60hz" +# setenv m "1280x1024p60hz" +# setenv m "1360x768p60hz" +# setenv m "1366x768p60hz" +# setenv m "1440x900p60hz" +# setenv m "1600x900p60hz" +# setenv m "1680x1050p60hz" +# setenv m "1920x1200p60hz" + + +# HDMI BPP Mode +setenv m_bpp "32" +# setenv m_bpp "24" +# setenv m_bpp "16" + +# HDMI DVI/VGA modes +# Uncomment only a single Line! The line with setenv written. +# At least one mode must be selected. +# setenv vout "dvi" +# setenv vout "vga" + +# Default Console Device Setting +setenv condev "console=ttyS0,115200n8 console=tty0" # on both + +########################################### + +# Boot Arguments +setenv bootargs "root=/dev/mmcblk0p1 rootwait rw ${condev} no_console_suspend hdmimode=${m} m_bpp=${m_bpp} vout=${vout} fsck.fix=yes" + +# Booting + +setenv loadaddr "0x11000000" +setenv dtb_loadaddr "0x1000000" +setenv initrd_loadaddr "0x13000000" + +load mmc 0:1 ${loadaddr} /boot/Image +load mmc 0:1 ${dtb_loadaddr} /boot/dtbs/meson64_odroidc2.dtb +load mmc 0:1 ${initrd_loadaddr} /boot/initramfs-linux.img + +booti ${loadaddr} ${initrd_loadaddr}:${filesize} ${dtb_loadaddr} diff --git a/alarm/uboot-odroid-c2/uboot-odroid-c2.install b/alarm/uboot-odroid-c2/uboot-odroid-c2.install new file mode 100644 index 000000000..8ded19756 --- /dev/null +++ b/alarm/uboot-odroid-c2/uboot-odroid-c2.install @@ -0,0 +1,32 @@ +sd_fuse() { + if [ ! -b /dev/mmcblk0 ]; then + echo "No MMC device to flash, exiting." + exit 0 + fi + + echo "BL1 fusing" + dd if=/boot/bl1.bin.hardkernel of=/dev/mmcblk0 conv=fsync bs=1 count=442 + dd if=/boot/bl1.bin.hardkernel of=/dev/mmcblk0 conv=fsync bs=512 skip=1 seek=1 + echo "u-boot fusing" + dd if=/boot/u-boot.bin of=/dev/mmcblk0 conv=fsync bs=512 seek=97 +} + +flash_uboot() { + echo "A new U-Boot version needs to be flashed onto /dev/mmcblk0." + echo "Do you want to do this now? [y|N]" + read -r shouldwe + if [[ $shouldwe =~ ^([yY][eE][sS]|[yY])$ ]]; then + sd_fuse + else + echo "You can do this later by running:" + echo "# cd /boot; ./sd_fusing.sh /dev/mmcblk0" + fi +} + +post_install() { + flash_uboot +} + +post_upgrade() { + flash_uboot +}