added alarm/uboot-chiliboard

This commit is contained in:
Kevin Mihelich 2015-08-29 17:54:27 +00:00
parent ed3bbf5340
commit 3c034ada06
9 changed files with 2267 additions and 0 deletions

View File

@ -0,0 +1,93 @@
From 0a3f119b5221e16feb1cbe4036cc16d1dc4c194c Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Sat, 7 Feb 2015 22:52:40 +0100
Subject: [PATCH 1/6] 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 <steven@uplinklabs.net>
Date: Sat Oct 25 15:09:42 2014 -0700
compiler/gcc4+: Remove inaccurate comment about 'asm goto' miscompiles
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
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 <linux/compiler-gcc5.h> directly, include <linux/compiler.h> 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.5.0

View File

@ -0,0 +1,76 @@
From a29b67a36a2b59acfc9cb7adc6e3bc06c490d4ee Mon Sep 17 00:00:00 2001
From: Jeroen Hofstee <jeroen@myspectrum.nl>
Date: Sun, 22 Jun 2014 23:10:39 +0200
Subject: [PATCH 2/6] ARM:asm:io.h use static inline
When compiling u-boot with W=1 the extern inline void for
read* is likely causing the most noise. gcc / clang will
warn there is never a actual declaration for these functions.
Instead of declaring these extern make them static inline so
it is actually declared.
cc: Albert ARIBAUD <albert.u.boot@aribaud.net>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
---
arch/arm/include/asm/io.h | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h
index 214f3ea..dc6138a 100644
--- a/arch/arm/include/asm/io.h
+++ b/arch/arm/include/asm/io.h
@@ -77,7 +77,7 @@ static inline phys_addr_t virt_to_phys(void * vaddr)
#define __arch_putl(v,a) (*(volatile unsigned int *)(a) = (v))
#define __arch_putq(v,a) (*(volatile unsigned long long *)(a) = (v))
-extern inline void __raw_writesb(unsigned long addr, const void *data,
+static inline void __raw_writesb(unsigned long addr, const void *data,
int bytelen)
{
uint8_t *buf = (uint8_t *)data;
@@ -85,7 +85,7 @@ extern inline void __raw_writesb(unsigned long addr, const void *data,
__arch_putb(*buf++, addr);
}
-extern inline void __raw_writesw(unsigned long addr, const void *data,
+static inline void __raw_writesw(unsigned long addr, const void *data,
int wordlen)
{
uint16_t *buf = (uint16_t *)data;
@@ -93,7 +93,7 @@ extern inline void __raw_writesw(unsigned long addr, const void *data,
__arch_putw(*buf++, addr);
}
-extern inline void __raw_writesl(unsigned long addr, const void *data,
+static inline void __raw_writesl(unsigned long addr, const void *data,
int longlen)
{
uint32_t *buf = (uint32_t *)data;
@@ -101,21 +101,21 @@ extern inline void __raw_writesl(unsigned long addr, const void *data,
__arch_putl(*buf++, addr);
}
-extern inline void __raw_readsb(unsigned long addr, void *data, int bytelen)
+static inline void __raw_readsb(unsigned long addr, void *data, int bytelen)
{
uint8_t *buf = (uint8_t *)data;
while(bytelen--)
*buf++ = __arch_getb(addr);
}
-extern inline void __raw_readsw(unsigned long addr, void *data, int wordlen)
+static inline void __raw_readsw(unsigned long addr, void *data, int wordlen)
{
uint16_t *buf = (uint16_t *)data;
while(wordlen--)
*buf++ = __arch_getw(addr);
}
-extern inline void __raw_readsl(unsigned long addr, void *data, int longlen)
+static inline void __raw_readsl(unsigned long addr, void *data, int longlen)
{
uint32_t *buf = (uint32_t *)data;
while(longlen--)
--
2.5.0

View File

@ -0,0 +1,31 @@
From dc7efb77bbd59224855713a554bb3721568a85c6 Mon Sep 17 00:00:00 2001
From: Jeroen Hofstee <jeroen@myspectrum.nl>
Date: Thu, 26 Jun 2014 20:18:31 +0200
Subject: [PATCH 3/6] common: main.c: make show_boot_progress __weak
This not only looks a bit better it also prevents a
warning with W=1 (no previous prototype).
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
Acked-by: Simon Glass <sjg@chromium.org>
---
common/main.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/common/main.c b/common/main.c
index 32618f1..2979fbe 100644
--- a/common/main.c
+++ b/common/main.c
@@ -17,8 +17,7 @@ DECLARE_GLOBAL_DATA_PTR;
/*
* Board-specific Platform code can reimplement show_boot_progress () if needed
*/
-void inline __show_boot_progress (int val) {}
-void show_boot_progress (int val) __attribute__((weak, alias("__show_boot_progress")));
+__weak void show_boot_progress(int val) {}
static void modem_init(void)
{
--
2.5.0

View File

@ -0,0 +1,109 @@
From ea9b2d003712ae2c6158abb5c9f285f593e8fcb0 Mon Sep 17 00:00:00 2001
From: Jeroen Hofstee <jeroen@myspectrum.nl>
Date: Mon, 23 Jun 2014 23:20:19 +0200
Subject: [PATCH 4/6] common: board_f: cosmetic use __weak for leds
First of all this looks a lot better, but it also
prevents a gcc warning (W=1), that the weak function
has no previous prototype.
cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
Acked-by: Simon Glass <sjg@chromium.org>
---
common/board_f.c | 29 ++++++++++-------------------
include/status_led.h | 22 +++++++++++-----------
2 files changed, 21 insertions(+), 30 deletions(-)
diff --git a/common/board_f.c b/common/board_f.c
index 4ea4cb2..bdab38e 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -37,6 +37,7 @@
#include <os.h>
#include <post.h>
#include <spi.h>
+#include <status_led.h>
#include <trace.h>
#include <watchdog.h>
#include <asm/errno.h>
@@ -78,25 +79,15 @@ DECLARE_GLOBAL_DATA_PTR;
************************************************************************
* May be supplied by boards if desired
*/
-inline void __coloured_LED_init(void) {}
-void coloured_LED_init(void)
- __attribute__((weak, alias("__coloured_LED_init")));
-inline void __red_led_on(void) {}
-void red_led_on(void) __attribute__((weak, alias("__red_led_on")));
-inline void __red_led_off(void) {}
-void red_led_off(void) __attribute__((weak, alias("__red_led_off")));
-inline void __green_led_on(void) {}
-void green_led_on(void) __attribute__((weak, alias("__green_led_on")));
-inline void __green_led_off(void) {}
-void green_led_off(void) __attribute__((weak, alias("__green_led_off")));
-inline void __yellow_led_on(void) {}
-void yellow_led_on(void) __attribute__((weak, alias("__yellow_led_on")));
-inline void __yellow_led_off(void) {}
-void yellow_led_off(void) __attribute__((weak, alias("__yellow_led_off")));
-inline void __blue_led_on(void) {}
-void blue_led_on(void) __attribute__((weak, alias("__blue_led_on")));
-inline void __blue_led_off(void) {}
-void blue_led_off(void) __attribute__((weak, alias("__blue_led_off")));
+__weak void coloured_LED_init(void) {}
+__weak void red_led_on(void) {}
+__weak void red_led_off(void) {}
+__weak void green_led_on(void) {}
+__weak void green_led_off(void) {}
+__weak void yellow_led_on(void) {}
+__weak void yellow_led_off(void) {}
+__weak void blue_led_on(void) {}
+__weak void blue_led_off(void) {}
/*
* Why is gd allocated a register? Prior to reloc it might be better to
diff --git a/include/status_led.h b/include/status_led.h
index 0eb91b8..b8aaaf7 100644
--- a/include/status_led.h
+++ b/include/status_led.h
@@ -272,19 +272,21 @@ extern void __led_set (led_id_t mask, int state);
# include <asm/status_led.h>
#endif
+#endif /* CONFIG_STATUS_LED */
+
/*
* Coloured LEDs API
*/
#ifndef __ASSEMBLY__
-extern void coloured_LED_init (void);
-extern void red_led_on(void);
-extern void red_led_off(void);
-extern void green_led_on(void);
-extern void green_led_off(void);
-extern void yellow_led_on(void);
-extern void yellow_led_off(void);
-extern void blue_led_on(void);
-extern void blue_led_off(void);
+void coloured_LED_init(void);
+void red_led_on(void);
+void red_led_off(void);
+void green_led_on(void);
+void green_led_off(void);
+void yellow_led_on(void);
+void yellow_led_off(void);
+void blue_led_on(void);
+void blue_led_off(void);
#else
.extern LED_init
.extern red_led_on
@@ -297,6 +299,4 @@ extern void blue_led_off(void);
.extern blue_led_off
#endif
-#endif /* CONFIG_STATUS_LED */
-
#endif /* _STATUS_LED_H_ */
--
2.5.0

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,184 @@
From b08bd8f1ab63ea9039dcd65655c7e59cf3bae61d Mon Sep 17 00:00:00 2001
From: Kevin Mihelich <kevin@archlinuxarm.org>
Date: Sat, 29 Aug 2015 10:33:56 -0600
Subject: [PATCH 6/6] arch linux arm modifications
---
include/configs/chiliboard.h | 100 +++++++++++++++++++------------------------
1 file changed, 44 insertions(+), 56 deletions(-)
diff --git a/include/configs/chiliboard.h b/include/configs/chiliboard.h
index eacc9af..9045db4 100644
--- a/include/configs/chiliboard.h
+++ b/include/configs/chiliboard.h
@@ -124,7 +124,6 @@
* as that will normally be within the kernel lowmem and thus visible via
* bootm_size and we only run on platforms with 256MB or more of memory.
*/
-#ifdef CONFIG_RAM128MB
#define DEFAULT_LINUX_BOOT_ENV \
"loadaddr=0x82000000\0" \
"kernel_addr_r=0x82000000\0" \
@@ -133,16 +132,6 @@
"rdaddr=0x84080000\0" \
"ramdisk_addr_r=0x84080000\0" \
"bootm_size=0x8000000\0"
-#else
-#define DEFAULT_LINUX_BOOT_ENV \
- "loadaddr=0x82000000\0" \
- "kernel_addr_r=0x82000000\0" \
- "fdtaddr=0x88000000\0" \
- "fdt_addr_r=0x88000000\0" \
- "rdaddr=0x88080000\0" \
- "ramdisk_addr_r=0x88080000\0" \
- "bootm_size=0x10000000\0"
-#endif
/*
* Default to a quick boot delay.
@@ -258,6 +247,7 @@
#define CONFIG_CMD_ASKENV
#define CONFIG_CMD_ECHO
#define CONFIG_CMD_BOOTZ
+#define CONFIG_SUPPORT_RAW_INITRD
/*
* Common filesystems support. When we have removable storage we
@@ -398,6 +388,9 @@
#define CONFIG_EFI_PARTITION
#define CONFIG_PARTITION_UUIDS
#define CONFIG_CMD_PART
+#define CONFIG_CMD_SETEXPR
+
+#define CONFIG_IDENT_STRING " Arch Linux ARM"
#ifdef CONFIG_NAND
#ifndef CONFIG_NAND512MB
@@ -441,8 +434,9 @@
#define CONFIG_EXTRA_ENV_SETTINGS \
DEFAULT_LINUX_BOOT_ENV \
"boot_fdt=try\0" \
- "bootpart=0:2\0" \
+ "bootpart=0:1\0" \
"bootdir=/boot\0" \
+ "fdtdir=/boot/dtbs\0" \
"bootfile=zImage\0" \
"fdtfile=undefined\0" \
"console=ttyO0,115200n8\0" \
@@ -450,9 +444,6 @@
"uuid_disk=${uuid_gpt_disk};" \
"name=rootfs,start=2MiB,size=-,uuid=${uuid_gpt_rootfs}\0" \
"optargs=\0" \
- "mmcdev=0\0" \
- "mmcroot=/dev/mmcblk0p2 rw\0" \
- "mmcrootfstype=ext4 rootwait\0" \
"rootpath=/export/rootfs\0" \
"nfsopts=nolock\0" \
"static_ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}" \
@@ -461,8 +452,7 @@
"ramrootfstype=ext2\0" \
"mmcargs=setenv bootargs console=${console} " \
"${optargs} " \
- "root=${mmcroot} " \
- "rootfstype=${mmcrootfstype}\0" \
+ "root=${root}\0" \
"spiroot=/dev/mtdblock4 rw\0" \
"spirootfstype=jffs2\0" \
"spisrcaddr=0xe0000\0" \
@@ -477,46 +467,47 @@
"root=/dev/nfs " \
"nfsroot=${serverip}:${rootpath},${nfsopts} rw " \
"ip=dhcp\0" \
- "bootenv=uEnv.txt\0" \
- "loadbootenv=load mmc ${mmcdev} ${loadaddr} ${bootenv}\0" \
- "importbootenv=echo Importing environment from mmc ...; " \
- "env import -t $loadaddr $filesize\0" \
"ramargs=setenv bootargs console=${console} " \
"${optargs} " \
"root=${ramroot} " \
"rootfstype=${ramrootfstype}\0" \
- "loadramdisk=load mmc ${mmcdev} ${rdaddr} ramdisk.gz\0" \
- "loadimage=load mmc ${bootpart} ${loadaddr} ${bootdir}/${bootfile}\0" \
- "loadfdt=load mmc ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile}\0" \
- "mmcloados=run mmcargs; " \
- "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
- "if run loadfdt; then " \
- "bootz ${loadaddr} - ${fdtaddr}; " \
- "else " \
- "if test ${boot_fdt} = try; then " \
- "bootz; " \
- "else " \
- "echo WARN: Cannot load the DT; " \
- "fi; " \
- "fi; " \
- "else " \
- "bootz; " \
- "fi;\0" \
- "mmcboot=mmc dev ${mmcdev}; " \
- "if mmc rescan; then " \
- "echo SD/MMC found on device ${mmcdev};" \
- "if run loadbootenv; then " \
- "echo Loaded environment from ${bootenv};" \
- "run importbootenv;" \
- "fi;" \
- "if test -n $uenvcmd; then " \
- "echo Running uenvcmd ...;" \
- "run uenvcmd;" \
- "fi;" \
- "if run loadimage; then " \
- "run mmcloados;" \
- "fi;" \
- "fi;\0" \
+ "loadimage=load ${devtype} ${bootpart} ${loadaddr} ${bootdir}/${bootfile}\0" \
+ "loadrd=load ${devtype} ${bootpart} ${rdaddr} ${bootdir}/${rdfile}\0" \
+ "loadfdt=echo loading ${fdtdir}/${fdtfile} ...; load ${devtype} ${bootpart} ${fdtaddr} ${fdtdir}/${fdtfile}\0" \
+ "mmcboot=for devtype in mmc; do " \
+ "for devnum in 0 1; do " \
+ "if ${devtype} dev ${devnum}; then " \
+ "echo ${devtype} found on device ${devnum};" \
+ "setenv bootpart ${devnum}:1;" \
+ "part uuid ${devtype} ${bootpart} uuid;" \
+ "setenv root PARTUUID=${uuid} rw rootwait;" \
+ "echo Checking for: ${bootdir}/uEnv.txt ...;" \
+ "if test -e ${devtype} ${bootpart} ${bootdir}/uEnv.txt; then " \
+ "load ${devtype} ${bootpart} ${loadaddr} ${bootdir}/uEnv.txt;" \
+ "env import -t ${loadaddr} ${filesize};" \
+ "echo Loaded environment from ${bootdir}/uEnv.txt;" \
+ "echo Checking if uenvcmd is set ...;" \
+ "if test -n ${uenvcmd}; then " \
+ "echo Running uenvcmd ...;" \
+ "run uenvcmd;" \
+ "fi;" \
+ "fi;" \
+ "if run loadimage; then " \
+ "run mmcargs;" \
+ "if run loadfdt; then " \
+ "if run loadrd; then " \
+ "bootz ${loadaddr} ${rdaddr}:${filesize} ${fdtaddr};" \
+ "else " \
+ "bootz ${loadaddr} - ${fdtaddr};" \
+ "fi;" \
+ "fi;" \
+ "else " \
+ "echo No kernel found;" \
+ "fi;" \
+ "setexpr devnum ${devnum} + 1;" \
+ "fi;" \
+ "done;" \
+ "done;\0" \
"spiboot=echo Booting from spi ...; " \
"run spiargs; " \
"sf probe ${spibusno}:0; " \
@@ -541,9 +532,6 @@
#define CONFIG_BOOTCOMMAND \
"run findfdt; " \
"run mmcboot;" \
- "setenv mmcdev 1; " \
- "setenv bootpart 1:2; " \
- "run mmcboot;" \
"run nandboot;"
/* NS16550 Configuration */
--
2.5.0

View File

@ -0,0 +1,56 @@
# U-Boot: Chiliboard
# Maintainer: Kevin Mihelich <kevin@archlinuxarm.org>
buildarch=4
pkgname=uboot-chiliboard
pkgver=2014.07
pkgrel=1
pkgdesc="U-Boot for Chiliboard"
arch=('armv7h')
url="http://git.denx.de/u-boot.git/"
makedepends=('git' 'bc')
license=('GPL')
install=${pkgname}.install
source=("ftp://ftp.denx.de/pub/u-boot/u-boot-${pkgver}.tar.bz2"
'0001-Add-linux-compiler-gcc5.h-to-fix-builds-with-gcc5.patch'
'0002-ARM-asm-io.h-use-static-inline.patch'
'0003-common-main.c-make-show_boot_progress-__weak.patch'
'0004-common-board_f-cosmetic-use-__weak-for-leds.patch'
'0005-chiliboard-support.patch'
'0006-arch-linux-arm-modifications.patch'
'uEnv.txt')
md5sums=('36d4bad687edcafa396fee607e505d4e'
'e070e8b5cf8628b6440dfc9dbd87cb65'
'318310de19110167fe15ceac3ae32f7d'
'1792346431786e1442c4059cd3f288ed'
'2a32a77f123391c02935754ced2743c2'
'5951c799b35c526f02edbcb3eb1295fc'
'be92986c37aaaed20f702e0cda798b26'
'0afad1f6f3f8609db6e1f5bb322b2a1a')
prepare() {
cd u-boot-${pkgver}
git apply ../0001-Add-linux-compiler-gcc5.h-to-fix-builds-with-gcc5.patch
git apply ../0002-ARM-asm-io.h-use-static-inline.patch
git apply ../0003-common-main.c-make-show_boot_progress-__weak.patch
git apply ../0004-common-board_f-cosmetic-use-__weak-for-leds.patch
git apply ../0005-chiliboard-support.patch
git apply ../0006-arch-linux-arm-modifications.patch
}
build() {
cd u-boot-${pkgver}
unset CFLAGS CXXFLAGS LDFLAGS
make distclean
make chiliboard_config
make
}
package() {
cd u-boot-${pkgver}
mkdir -p "${pkgdir}"/boot
cp MLO u-boot.img "${srcdir}"/uEnv.txt "${pkgdir}"/boot
}

View File

@ -0,0 +1 @@
optargs=

View File

@ -0,0 +1,32 @@
flash_instructions() {
echo "# dd if=/boot/MLO of=/dev/mmcblk0 count=1 seek=1 conv=notrunc bs=128k"
echo "# dd if=/boot/u-boot.img of=/dev/mmcblk0 count=2 seek=1 conv=notrunc bs=384k"
}
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 this now? [y|N]"
read -r shouldwe
if [[ $shouldwe =~ ^([yY][eE][sS]|[yY])$ ]]; then
dd if=/boot/MLO of=$root count=1 seek=1 conv=notrunc bs=128k
dd if=/boot/u-boot.img of=$root count=2 seek=1 conv=notrunc bs=384k
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
}
post_install() {
flash_uboot
}
post_upgrade() {
flash_uboot
}