Skip to content

Commit

Permalink
odroid-c1: fix u-boot compile on gcc 5.x
Browse files Browse the repository at this point in the history
Signed-off-by: Armin Kuster <[email protected]>
  • Loading branch information
akuster committed May 22, 2016
1 parent 3bee566 commit db8ad3a
Show file tree
Hide file tree
Showing 7 changed files with 350 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
From c7f28da02c384e527bb6cf574e637d1a594ab7ef Mon Sep 17 00:00:00 2001
From: Armin Kuster <[email protected]>
Date: Sat, 7 May 2016 12:17:37 -0700
Subject: [PATCH] ARM:asm:io.h use static inline

Signed-off-by: Armin Kuster <[email protected]>
---
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 385faed..fc87233 100644
--- a/arch/arm/include/asm/io.h
+++ b/arch/arm/include/asm/io.h
@@ -75,42 +75,42 @@ static inline phys_addr_t virt_to_phys(void * vaddr)
#define __arch_putw(v,a) (*(volatile unsigned short *)(a) = (v))
#define __arch_putl(v,a) (*(volatile unsigned int *)(a) = (v))

-extern inline void __raw_writesb(unsigned int addr, const void *data, int bytelen)
+static inline void __raw_writesb(unsigned int addr, const void *data, int bytelen)
{
uint8_t *buf = (uint8_t *)data;
while(bytelen--)
__arch_putb(*buf++, addr);
}

-extern inline void __raw_writesw(unsigned int addr, const void *data, int wordlen)
+static inline void __raw_writesw(unsigned int addr, const void *data, int wordlen)
{
uint16_t *buf = (uint16_t *)data;
while(wordlen--)
__arch_putw(*buf++, addr);
}

-extern inline void __raw_writesl(unsigned int addr, const void *data, int longlen)
+static inline void __raw_writesl(unsigned int addr, const void *data, int longlen)
{
uint32_t *buf = (uint32_t *)data;
while(longlen--)
__arch_putl(*buf++, addr);
}

-extern inline void __raw_readsb(unsigned int addr, void *data, int bytelen)
+static inline void __raw_readsb(unsigned int addr, void *data, int bytelen)
{
uint8_t *buf = (uint8_t *)data;
while(bytelen--)
*buf++ = __arch_getb(addr);
}

-extern inline void __raw_readsw(unsigned int addr, void *data, int wordlen)
+static inline void __raw_readsw(unsigned int addr, void *data, int wordlen)
{
uint16_t *buf = (uint16_t *)data;
while(wordlen--)
*buf++ = __arch_getw(addr);
}

-extern inline void __raw_readsl(unsigned int addr, void *data, int longlen)
+static inline void __raw_readsl(unsigned int addr, void *data, int longlen)
{
uint32_t *buf = (uint32_t *)data;
while(longlen--)
--
1.9.1

Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
From 1276681a32e5624365249760999335cf8e0c8f33 Mon Sep 17 00:00:00 2001
From: Armin Kuster <[email protected]>
Date: Sat, 7 May 2016 12:27:47 -0700
Subject: [PATCH] board.c: fix inline issue

Signed-off-by: Armin Kuster <[email protected]>
---
arch/arm/lib/board.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c
index 79b839f..2678fd5 100644
--- a/arch/arm/lib/board.c
+++ b/arch/arm/lib/board.c
@@ -120,23 +120,23 @@ int __g_nTStep_4BC722B3__ = 0;
************************************************************************
* May be supplied by boards if desired
*/
-void inline __coloured_LED_init (void) {}
+void static inline __coloured_LED_init (void) {}
void coloured_LED_init (void) __attribute__((weak, alias("__coloured_LED_init")));
-void inline __red_LED_on (void) {}
+void static inline __red_LED_on (void) {}
void red_LED_on (void) __attribute__((weak, alias("__red_LED_on")));
-void inline __red_LED_off(void) {}
+void static inline __red_LED_off(void) {}
void red_LED_off(void) __attribute__((weak, alias("__red_LED_off")));
-void inline __green_LED_on(void) {}
+void static inline __green_LED_on(void) {}
void green_LED_on(void) __attribute__((weak, alias("__green_LED_on")));
-void inline __green_LED_off(void) {}
+void static inline __green_LED_off(void) {}
void green_LED_off(void) __attribute__((weak, alias("__green_LED_off")));
-void inline __yellow_LED_on(void) {}
+void static inline __yellow_LED_on(void) {}
void yellow_LED_on(void) __attribute__((weak, alias("__yellow_LED_on")));
-void inline __yellow_LED_off(void) {}
+void static inline __yellow_LED_off(void) {}
void yellow_LED_off(void) __attribute__((weak, alias("__yellow_LED_off")));
-void inline __blue_LED_on(void) {}
+void static inline __blue_LED_on(void) {}
void blue_LED_on(void) __attribute__((weak, alias("__blue_LED_on")));
-void inline __blue_LED_off(void) {}
+void static inline __blue_LED_off(void) {}
void blue_LED_off(void) __attribute__((weak, alias("__blue_LED_off")));

/************************************************************************
--
1.9.1

85 changes: 85 additions & 0 deletions recipes-bsp/u-boot-hardkernel/files/0001-compile-add-gcc5.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
From e675d3fa55a705511773a7754f3023bbd02979fb Mon Sep 17 00:00:00 2001
From: Armin Kuster <[email protected]>
Date: Sat, 7 May 2016 12:21:43 -0700
Subject: [PATCH] compile: add gcc5

Signed-off-by: Armin Kuster <[email protected]>
---
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 */
--
1.9.1

Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
From 0a9fea1c2cc14e70d60d060130d8823e742c5438 Mon Sep 17 00:00:00 2001
From: Jeroen Hofstee <[email protected]>
Date: Sat, 10 Aug 2013 17:16:50 +0200
Subject: [PATCH] compiler_gcc: do not redefine __gnu_attributes

gcc allows extensions to be non compiler specific by defining
__* macros for the attributes supported by gcc. Having a
different definition causes many warnings during the build
(cdefs.h on FreeBSD uses __attribute((__pure__)) where u-boot
uses __attribute__((pure)) for example). Do not redefine
these macros to suppress these warnings.

This patch ignores the checkpatch warning:
WARNING: __packed is preferred over __attribute__((packed))

Signed-off-by: Jeroen Hofstee <[email protected]>
---
include/linux/compiler-gcc.h | 12 +++++++++---
include/linux/compiler-gcc4.h | 4 +++-
2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index 73dcf80..9896e54 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -50,7 +50,9 @@
#endif

#define __deprecated __attribute__((deprecated))
-#define __packed __attribute__((packed))
+#ifndef __packed
+# define __packed __attribute__((packed))
+#endif
#define __weak __attribute__((weak))

/*
@@ -73,8 +75,12 @@
* would be.
* [...]
*/
-#define __pure __attribute__((pure))
-#define __aligned(x) __attribute__((aligned(x)))
+#ifndef __pure
+# define __pure __attribute__((pure))
+#endif
+#ifndef __aligned
+# define __aligned(x) __attribute__((aligned(x)))
+#endif
#define __printf(a,b) __attribute__((format(printf,a,b)))
#define noinline __attribute__((noinline))
#define __attribute_const__ __attribute__((__const__))
diff --git a/include/linux/compiler-gcc4.h b/include/linux/compiler-gcc4.h
index 94dea3f..27d11ca 100644
--- a/include/linux/compiler-gcc4.h
+++ b/include/linux/compiler-gcc4.h
@@ -12,7 +12,9 @@
#define __used __attribute__((__used__))
#define __must_check __attribute__((warn_unused_result))
#define __compiler_offsetof(a,b) __builtin_offsetof(a,b)
-#define __always_inline inline __attribute__((always_inline))
+#ifndef __always_inline
+# define __always_inline inline __attribute__((always_inline))
+#endif

/*
* A trick to suppress uninitialized variable warning without generating any
--
1.9.1

Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
From a36aec5d3b2f182cd110d31d1337fe161acfe502 Mon Sep 17 00:00:00 2001
From: Armin Kuster <[email protected]>
Date: Sat, 7 May 2016 12:30:29 -0700
Subject: [PATCH] main: fix inline issue

Signed-off-by: Armin Kuster <[email protected]>
---
common/main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/main.c b/common/main.c
index 5312e7d..ff000b7 100644
--- a/common/main.c
+++ b/common/main.c
@@ -63,7 +63,7 @@ extern int __g_nTStep_4BC722B3__;
/*
* Board-specific Platform code can reimplement show_boot_progress () if needed
*/
-void inline __show_boot_progress (int val) {}
+void static inline __show_boot_progress (int val) {}
void show_boot_progress (int val) __attribute__((weak, alias("__show_boot_progress")));

#if defined(CONFIG_UPDATE_TFTP)
--
1.9.1

Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
From bde456a5cee7720fbef24ebba76cf0e8e698c262 Mon Sep 17 00:00:00 2001
From: Armin Kuster <[email protected]>
Date: Sat, 7 May 2016 12:47:12 -0700
Subject: [PATCH] usb: use define not func

Signed-off-by: Armin Kuster <[email protected]>
---
common/usb.c | 4 ++--
include/usb.h | 4 +++-
2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/common/usb.c b/common/usb.c
index ea62c30..08f592f 100644
--- a/common/usb.c
+++ b/common/usb.c
@@ -90,12 +90,12 @@ static int hub_port_reset(struct usb_device *dev, int port,
* wait_ms
*/

-inline void wait_ms(unsigned long ms)
+/*static inline void wait_ms(unsigned long ms)
{
while (ms-- > 0)
udelay(1000);
}
-
+*/
/***************************************************************************
* Init USB Device
*/
diff --git a/include/usb.h b/include/usb.h
index 97ea37b..0f97021 100644
--- a/include/usb.h
+++ b/include/usb.h
@@ -197,7 +197,9 @@ int usb_submit_int_msg(struct usb_device *dev, unsigned long pipe,
void *buffer, int transfer_len, int interval);
void usb_disable_asynch(int disable);
int usb_maxpacket(struct usb_device *dev, unsigned long pipe);
-inline void wait_ms(unsigned long ms);
+//static inline void wait_ms(unsigned long ms);
+
+#define wait_ms(a) udelay(a*1000);
int usb_get_configuration_no(struct usb_device *dev, unsigned char *buffer,
int cfgno);
int usb_get_report(struct usb_device *dev, int ifnum, unsigned char type,
--
1.9.1

7 changes: 6 additions & 1 deletion recipes-bsp/u-boot-hardkernel/u-boot-hardkernel_2011.03.bb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ UBOOT_BRANCH ?= "odroidc-v2011.03"
SRCREV = "f631c80969b33b796d2d4c077428b4765393ed2b"

PV = "v2011.03+git${SRCPV}"
PR = "r7"

PROVIDES =+ "u-boot ${PN}-config"
PACKAGES =+ "u-boot-ini"
Expand All @@ -17,6 +16,12 @@ SRC_URI = " \
${UBOOT_REPO_URI};branch=${UBOOT_BRANCH} \
file://0001-ucl-use-host-compiler-supplied-by-OE.patch \
file://0003-use-lldiv-for-64-bit-division.patch \
file://0001-compiler_gcc-do-not-redefine-__gnu_attributes.patch \
file://0001-ARM-asm-io.h-use-static-inline.patch \
file://0001-board.c-fix-inline-issue.patch \
file://0001-compile-add-gcc5.patch \
file://0001-main-fix-inline-issue.patch \
file://0001-usb-use-define-not-func.patch \
"

SRC_URI_append_odroid-c1 = " \
Expand Down

0 comments on commit db8ad3a

Please sign in to comment.