Initial commit

This commit is contained in:
domenico
2025-06-24 15:51:28 +02:00
commit 22031d9dab
6862 changed files with 1462554 additions and 0 deletions

View File

@@ -0,0 +1,82 @@
From f3f431a712729a1af94d01bd1bfde17a252ff02c Mon Sep 17 00:00:00 2001
From: Paul Kocialkowski <contact@paulk.fr>
Date: Sun, 26 Jul 2015 18:48:15 +0200
Subject: [PATCH] Reproducible U-Boot build support, using SOURCE_DATE_EPOCH
In order to achieve reproducible builds in U-Boot, timestamps that are defined
at build-time have to be somewhat eliminated. The SOURCE_DATE_EPOCH environment
variable allows setting a fixed value for those timestamps.
Simply by setting SOURCE_DATE_EPOCH to a fixed value, a number of targets can be
built reproducibly. This is the case for e.g. sunxi devices.
However, some other devices might need some more tweaks, especially regarding
the image generation tools.
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
---
Makefile | 7 ++++---
README | 12 ++++++++++++
tools/default_image.c | 21 ++++++++++++++++++++-
3 files changed, 36 insertions(+), 4 deletions(-)
--- a/README
+++ b/README
@@ -2785,6 +2785,18 @@ Low Level (hardware related) configurati
that is executed before the actual U-Boot. E.g. when
compiling a NAND SPL.
+Reproducible builds
+-------------------
+
+In order to achieve reproducible builds, timestamps used in the U-Boot build
+process have to be set to a fixed value.
+
+This is done using the SOURCE_DATE_EPOCH environment variable.
+SOURCE_DATE_EPOCH is to be set on the build host's shell, not as a configuration
+option for U-Boot or an environment variable in U-Boot.
+
+SOURCE_DATE_EPOCH should be set to a number of seconds since the epoch, in UTC.
+
Building the Software:
======================
--- a/tools/default_image.c
+++ b/tools/default_image.c
@@ -101,6 +101,9 @@ static void image_set_header (void *ptr,
struct mkimage_params *params)
{
uint32_t checksum;
+ char *source_date_epoch;
+ struct tm *time_universal;
+ time_t time;
image_header_t * hdr = (image_header_t *)ptr;
@@ -109,9 +112,25 @@ static void image_set_header (void *ptr,
sizeof(image_header_t)),
sbuf->st_size - sizeof(image_header_t));
+source_date_epoch = getenv("SOURCE_DATE_EPOCH");
+ if (source_date_epoch != NULL) {
+ time = (time_t) strtol(source_date_epoch, NULL, 10);
+
+ time_universal = gmtime(&time);
+ if (time_universal == NULL) {
+ fprintf(stderr, "%s: SOURCE_DATE_EPOCH is not valid\n",
+ __func__);
+ time = 0;
+ } else {
+ time = mktime(time_universal);
+ }
+ } else {
+ time = sbuf->st_mtime;
+ }
+
/* Build new header */
image_set_magic (hdr, IH_MAGIC);
- image_set_time (hdr, sbuf->st_mtime);
+ image_set_time(hdr, time);
image_set_size (hdr, sbuf->st_size - sizeof(image_header_t));
image_set_load (hdr, params->addr);
image_set_ep (hdr, params->ep);

View File

@@ -0,0 +1,31 @@
--- a/Makefile
+++ b/Makefile
@@ -389,8 +389,26 @@ $(VERSION_FILE):
@cmp -s $@ $@.tmp && rm -f $@.tmp || mv -f $@.tmp $@
$(TIMESTAMP_FILE):
- @date +'#define U_BOOT_DATE "%b %d %C%y"' > $@
- @date +'#define U_BOOT_TIME "%T"' >> $@
+ (if test -n "$${SOURCE_DATE_EPOCH}"; then \
+ SOURCE_DATE="@$${SOURCE_DATE_EPOCH}"; \
+ DATE=""; \
+ for date in gdate date.gnu date; do \
+ $${date} -u -d "$${SOURCE_DATE}" >/dev/null 2>&1 && DATE="$${date}"; \
+ done; \
+ if test -n "$${DATE}"; then \
+ LC_ALL=C $${DATE} -u -d "$${SOURCE_DATE}" +'#define U_BOOT_DATE "%b %d %C%y"' > $@; \
+ LC_ALL=C $${DATE} -u -d "$${SOURCE_DATE}" +'#define U_BOOT_TIME "%T"' >> $@; \
+ LC_ALL=C $${DATE} -u -d "$${SOURCE_DATE}" +'#define U_BOOT_TZ "%z"' >> $@; \
+ LC_ALL=C $${DATE} -u -d "$${SOURCE_DATE}" +'#define U_BOOT_DMI_DATE "%m/%d/%Y"' >> $@; \
+ else \
+ return 42; \
+ fi; \
+ else \
+ LC_ALL=C date +'#define U_BOOT_DATE "%b %d %C%y"'; \
+ LC_ALL=C date +'#define U_BOOT_TIME "%T"'; \
+ LC_ALL=C date +'#define U_BOOT_TZ "%z"'; \
+ LC_ALL=C date +'#define U_BOOT_DMI_DATE "%m/%d/%Y"'; \
+ fi)
gdbtools:
$(MAKE) -C tools/gdb all || exit 1

View File

@@ -0,0 +1,26 @@
--- a/cpu/mips/Makefile
+++ b/cpu/mips/Makefile
@@ -33,6 +33,7 @@ SOBJS-$(CONFIG_INCA_IP) += incaip_wdt.o
COBJS-$(CONFIG_INCA_IP) += asc_serial.o incaip_clock.o
COBJS-$(CONFIG_PURPLE) += asc_serial.o
COBJS-$(CONFIG_SOC_AU1X00) += au1x00_eth.o au1x00_serial.o au1x00_usb_ohci.o
+COBJS-$(CONFIG_AR71XX) += ar71xx_serial.o
SRCS := $(START:.o=.S) $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c)
OBJS := $(addprefix $(obj),$(SOBJS-y) $(COBJS-y))
--- a/Makefile
+++ b/Makefile
@@ -3474,6 +3474,13 @@ qemu_mips_config : unconfig
@$(MKCONFIG) -a qemu-mips mips mips qemu-mips
#########################################################################
+## MIPS32 AR71XX (24K)
+#########################################################################
+
+nbg460n_550n_550nh_config : unconfig
+ @$(MKCONFIG) -a nbg460n mips mips nbg460n zyxel
+
+#########################################################################
## MIPS64 5Kc
#########################################################################

View File

@@ -0,0 +1,11 @@
diff -ur u-boot-2010.03/drivers/spi/Makefile u-boot-nbg/drivers/spi/Makefile
--- u-boot-2010.03/drivers/spi/Makefile 2010-03-31 23:54:39.000000000 +0200
+++ u-boot-nbg/drivers/spi/Makefile 2010-04-15 19:31:27.000000000 +0200
@@ -25,6 +25,7 @@
LIB := $(obj)libspi.a
+COBJS-$(CONFIG_AR71XX_SPI) += ar71xx_spi.o
COBJS-$(CONFIG_ATMEL_DATAFLASH_SPI) += atmel_dataflash_spi.o
COBJS-$(CONFIG_ATMEL_SPI) += atmel_spi.o
COBJS-$(CONFIG_BFIN_SPI) += bfin_spi.o

View File

@@ -0,0 +1,22 @@
diff -ur u-boot-2010.03/drivers/net/Makefile u-boot-nbg/drivers/net/Makefile
--- u-boot-2010.03/drivers/net/Makefile 2010-03-31 23:54:39.000000000 +0200
+++ u-boot-nbg/drivers/net/Makefile 2010-04-19 23:30:01.000000000 +0200
@@ -27,6 +27,7 @@
COBJS-$(CONFIG_DRIVER_3C589) += 3c589.o
COBJS-$(CONFIG_PPC4xx_EMAC) += 4xx_enet.o
+COBJS-$(CONFIG_AG71XX) += ag71xx.o
COBJS-$(CONFIG_DRIVER_AT91EMAC) += at91_emac.o
COBJS-$(CONFIG_DRIVER_AX88180) += ax88180.o
COBJS-$(CONFIG_BCM570x) += bcm570x.o bcm570x_autoneg.o 5701rls.o
diff -ur u-boot-2010.03/include/netdev.h u-boot-nbg/include/netdev.h
--- u-boot-2010.03/include/netdev.h 2010-03-31 23:54:39.000000000 +0200
+++ u-boot-nbg/include/netdev.h 2010-05-02 11:30:58.000000000 +0200
@@ -42,6 +42,7 @@
/* Driver initialization prototypes */
int au1x00_enet_initialize(bd_t*);
+int ag71xx_register(bd_t * bis, char *phyname[], u16 phyid[], u16 phyfixed[]);
int at91emac_register(bd_t *bis, unsigned long iobase);
int bfin_EMAC_initialize(bd_t *bis);
int cs8900_initialize(u8 dev_num, int base_addr);

View File

@@ -0,0 +1,28 @@
diff -ur u-boot-2010.03/drivers/net/Makefile u-boot-nbg/drivers/net/Makefile
--- u-boot-2010.03/drivers/net/Makefile 2010-03-31 23:54:39.000000000 +0200
+++ u-boot-nbg/drivers/net/Makefile 2010-04-19 23:30:01.000000000 +0200
@@ -65,6 +65,7 @@
COBJS-$(CONFIG_DRIVER_RTL8019) += rtl8019.o
COBJS-$(CONFIG_RTL8139) += rtl8139.o
COBJS-$(CONFIG_RTL8169) += rtl8169.o
+COBJS-$(CONFIG_RTL8366_MII) += phy/rtl8366_mii.o
COBJS-$(CONFIG_DRIVER_S3C4510_ETH) += s3c4510b_eth.o
COBJS-$(CONFIG_SH_ETHER) += sh_eth.o
COBJS-$(CONFIG_SMC91111) += smc91111.o
diff -ur u-boot-2010.03/include/netdev.h u-boot-nbg/include/netdev.h
--- u-boot-2010.03/include/netdev.h 2010-03-31 23:54:39.000000000 +0200
+++ u-boot-nbg/include/netdev.h 2010-05-02 11:30:58.000000000 +0200
@@ -175,5 +175,13 @@
int mv88e61xx_switch_initialize(struct mv88e61xx_config *swconfig);
#endif /* CONFIG_MV88E61XX_SWITCH */
+
+#if defined(CONFIG_RTL8366_MII)
+#define RTL8366_DEVNAME "rtl8366"
+#define RTL8366_WANPHY_ID 4
+#define RTL8366_LANPHY_ID -1
+int rtl8366_mii_register(bd_t *bis);
+int rtl8366s_initialize(void);
+#endif
#endif /* _NETDEV_H_ */

View File

@@ -0,0 +1,11 @@
--- a/include/compiler.h
+++ b/include/compiler.h
@@ -46,7 +46,7 @@ extern int errno;
#ifdef __linux__
# include <endian.h>
# include <byteswap.h>
-#elif defined(__MACH__)
+#elif defined(__MACH__) || defined(__FreeBSD__)
# include <machine/endian.h>
typedef unsigned long ulong;
typedef unsigned int uint;

View File

@@ -0,0 +1,23 @@
--- a/config.mk
+++ b/config.mk
@@ -64,9 +64,17 @@ HOSTSTRIP = strip
#
ifeq ($(HOSTOS),darwin)
-HOSTCC = cc
-HOSTCFLAGS += -traditional-cpp
-HOSTLDFLAGS += -multiply_defined suppress
+#get the major and minor product version (e.g. '10' and '6' for Snow Leopard)
+DARWIN_MAJOR_VERSION = $(shell sw_vers -productVersion | cut -f 1 -d '.')
+DARWIN_MINOR_VERSION = $(shell sw_vers -productVersion | cut -f 2 -d '.')
+
+before-snow-leopard = $(shell if [ $(DARWIN_MAJOR_VERSION) -le 10 -a \
+ $(DARWIN_MINOR_VERSION) -le 5 ] ; then echo "$(1)"; else echo "$(2)"; fi ;)
+
+# Snow Leopards build environment has no longer restrictions as described above
+HOSTCC = $(call before-snow-leopard, "cc", "gcc")
+HOSTCFLAGS += $(call before-snow-leopard, "-traditional-cpp")
+HOSTLDFLAGS += $(call before-snow-leopard, "-multiply_defined suppress")
else
HOSTCC = gcc
endif

View File

@@ -0,0 +1,21 @@
--- a/tools/os_support.c
+++ b/tools/os_support.c
@@ -23,6 +23,6 @@
#ifdef __MINGW32__
#include "mingw_support.c"
#endif
-#ifdef __APPLE__
+#if defined(__APPLE__) && __DARWIN_C_LEVEL < 200809L
#include "getline.c"
#endif
--- a/tools/os_support.h
+++ b/tools/os_support.h
@@ -28,7 +28,7 @@
#include "mingw_support.h"
#endif
-#ifdef __APPLE__
+#if defined(__APPLE__) && __DARWIN_C_LEVEL < 200809L
#include "getline.h"
#endif

View File

@@ -0,0 +1,13 @@
--- a/Makefile
+++ b/Makefile
@@ -139,9 +139,7 @@ endif
# The "tools" are needed early, so put this first
# Don't include stuff already done in $(LIBS)
-SUBDIRS = tools \
- examples/standalone \
- examples/api
+SUBDIRS = tools
.PHONY : $(SUBDIRS)

View File

@@ -0,0 +1,112 @@
--- a/include/asm-mips/io.h
+++ b/include/asm-mips/io.h
@@ -118,12 +118,12 @@ static inline void set_io_port_base(unsi
* Change virtual addresses to physical addresses and vv.
* These are trivial on the 1:1 Linux/MIPS mapping
*/
-extern inline phys_addr_t virt_to_phys(volatile void * address)
+static inline phys_addr_t virt_to_phys(volatile void * address)
{
return CPHYSADDR(address);
}
-extern inline void * phys_to_virt(unsigned long address)
+static inline void * phys_to_virt(unsigned long address)
{
return (void *)KSEG0ADDR(address);
}
@@ -131,12 +131,12 @@ extern inline void * phys_to_virt(unsign
/*
* IO bus memory addresses are also 1:1 with the physical address
*/
-extern inline unsigned long virt_to_bus(volatile void * address)
+static inline unsigned long virt_to_bus(volatile void * address)
{
return CPHYSADDR(address);
}
-extern inline void * bus_to_virt(unsigned long address)
+static inline void * bus_to_virt(unsigned long address)
{
return (void *)KSEG0ADDR(address);
}
@@ -150,12 +150,12 @@ extern unsigned long isa_slot_offset;
extern void * __ioremap(unsigned long offset, unsigned long size, unsigned long flags);
#if 0
-extern inline void *ioremap(unsigned long offset, unsigned long size)
+static inline void *ioremap(unsigned long offset, unsigned long size)
{
return __ioremap(offset, size, _CACHE_UNCACHED);
}
-extern inline void *ioremap_nocache(unsigned long offset, unsigned long size)
+static inline void *ioremap_nocache(unsigned long offset, unsigned long size)
{
return __ioremap(offset, size, _CACHE_UNCACHED);
}
@@ -238,7 +238,7 @@ out:
*/
#define __OUT1(s) \
-extern inline void __out##s(unsigned int value, unsigned int port) {
+static inline void __out##s(unsigned int value, unsigned int port) {
#define __OUT2(m) \
__asm__ __volatile__ ("s" #m "\t%0,%1(%2)"
@@ -252,7 +252,7 @@ __OUT1(s##c_p) __OUT2(m) : : "r" (__iosw
SLOW_DOWN_IO; }
#define __IN1(t,s) \
-extern __inline__ t __in##s(unsigned int port) { t _v;
+static inline t __in##s(unsigned int port) { t _v;
/*
* Required nops will be inserted by the assembler
@@ -267,7 +267,7 @@ __IN1(t,s##_p) __IN2(m) : "=r" (_v) : "i
__IN1(t,s##c_p) __IN2(m) : "=r" (_v) : "ir" (port), "r" (mips_io_port_base)); SLOW_DOWN_IO; return __ioswab##w(_v); }
#define __INS1(s) \
-extern inline void __ins##s(unsigned int port, void * addr, unsigned long count) {
+static inline void __ins##s(unsigned int port, void * addr, unsigned long count) {
#define __INS2(m) \
if (count) \
@@ -295,7 +295,7 @@ __INS1(s##c) __INS2(m) \
: "$1");}
#define __OUTS1(s) \
-extern inline void __outs##s(unsigned int port, const void * addr, unsigned long count) {
+static inline void __outs##s(unsigned int port, const void * addr, unsigned long count) {
#define __OUTS2(m) \
if (count) \
--- a/include/asm-mips/system.h
+++ b/include/asm-mips/system.h
@@ -23,7 +23,7 @@
#include <linux/kernel.h>
#endif
-extern __inline__ void
+static inline void
__sti(void)
{
__asm__ __volatile__(
@@ -47,7 +47,7 @@ __sti(void)
* R4000/R4400 need three nops, the R4600 two nops and the R10000 needs
* no nops at all.
*/
-extern __inline__ void
+static inline void
__cli(void)
{
__asm__ __volatile__(
@@ -208,7 +208,7 @@ do { \
* For 32 and 64 bit operands we can take advantage of ll and sc.
* FIXME: This doesn't work for R3000 machines.
*/
-extern __inline__ unsigned long xchg_u32(volatile int * m, unsigned long val)
+static inline unsigned long xchg_u32(volatile int * m, unsigned long val)
{
#ifdef CONFIG_CPU_HAS_LLSC
unsigned long dummy;

View File

@@ -0,0 +1,12 @@
--- a/common/main.c
+++ b/common/main.c
@@ -47,8 +47,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")));
+void __attribute__((weak)) show_boot_progress(int val) {}
#if defined(CONFIG_BOOT_RETRY_TIME) && defined(CONFIG_RESET_TO_RETRY)
extern int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); /* for do_reset() prototype */