From 910899f03e45d195cc068f575b3f51a6a38f6892 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Sun, 21 Jan 2018 19:19:16 +0900 Subject: [PATCH 1/5] libfdt: move working_fdt and FDT_RAMDISK_OVERHEAD to include/libfdt.h libfdt_env.h exists to contain system-dependent defines: - typedef of fdt*_t - fdt*_to_cpu(), cpu_to_fdt* working_fdt and FDT_RAMDISK_OVERHEAD are unrelated to the environment, so they must get out of this header. Signed-off-by: Masahiro Yamada Reviewed-by: Simon Glass (cherry picked from commit 25ad202dd3268c3bda692de83485ca7649f2a57c) Signed-off-by: Baruch Siach --- include/libfdt.h | 13 +++++++++++++ include/libfdt_env.h | 5 ----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/include/libfdt.h b/include/libfdt.h index 7ba13e634b65..dbc56ec62e9f 100644 --- a/include/libfdt.h +++ b/include/libfdt.h @@ -1 +1,14 @@ +#ifndef UBOOT_LIBFDT_H +#define UBOOT_LIBFDT_H +/* + * SPDX-License-Identifier: GPL-2.0+ BSD-2-Clause + */ + #include "../lib/libfdt/libfdt.h" + +extern struct fdt_header *working_fdt; /* Pointer to the working fdt */ + +/* adding a ramdisk needs 0x44 bytes in version 2008.10 */ +#define FDT_RAMDISK_OVERHEAD 0x80 + +#endif /* UBOOT_LIBFDT_H */ diff --git a/include/libfdt_env.h b/include/libfdt_env.h index 273b5d30f867..ea26979fc221 100644 --- a/include/libfdt_env.h +++ b/include/libfdt_env.h @@ -12,8 +12,6 @@ #include "compiler.h" #include "linux/types.h" -extern struct fdt_header *working_fdt; /* Pointer to the working fdt */ - typedef __be16 fdt16_t; typedef __be32 fdt32_t; typedef __be64 fdt64_t; @@ -23,7 +21,4 @@ typedef __be64 fdt64_t; #define fdt64_to_cpu(x) be64_to_cpu(x) #define cpu_to_fdt64(x) cpu_to_be64(x) -/* adding a ramdisk needs 0x44 bytes in version 2008.10 */ -#define FDT_RAMDISK_OVERHEAD 0x80 - #endif /* _LIBFDT_ENV_H */ From 4be972c6a59988d829791862a851cd3e42a38de9 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Sun, 21 Jan 2018 19:19:18 +0900 Subject: [PATCH 2/5] libfdt: migrate include/libfdt_env.h to a wrapper libfdt_env.h is supposed to provide system-dependent defines. scripts/dtc/libfdt/libfdt_env.h from upstream DTC is suitable for user-space, so we should use this for USE_HOSTCC case. For compiling U-Boot, we need to override such system-dependent defines, so use imported from Linux. selects a proper one. Maybe, we should split header inclusion completely, but I do not want too many patches at one. I can rip off the include/libfdt_env.h from HOST_EXTRACFLAGS. Signed-off-by: Masahiro Yamada Reviewed-by: Simon Glass (cherry picked from commit 662282203ac535d98d523700bfdba09664b2225d) Signed-off-by: Baruch Siach --- include/libfdt_env.h | 29 +++++------------------------ tools/Makefile | 2 +- 2 files changed, 6 insertions(+), 25 deletions(-) diff --git a/include/libfdt_env.h b/include/libfdt_env.h index ea26979fc221..d7e9d3286354 100644 --- a/include/libfdt_env.h +++ b/include/libfdt_env.h @@ -1,24 +1,5 @@ -/* - * libfdt - Flat Device Tree manipulation (build/run environment adaptation) - * Copyright (C) 2007 Gerald Van Baren, Custom IDEAS, vanbaren@cideas.com - * Original version written by David Gibson, IBM Corporation. - * - * SPDX-License-Identifier: LGPL-2.1+ - */ - -#ifndef _LIBFDT_ENV_H -#define _LIBFDT_ENV_H - -#include "compiler.h" -#include "linux/types.h" - -typedef __be16 fdt16_t; -typedef __be32 fdt32_t; -typedef __be64 fdt64_t; - -#define fdt32_to_cpu(x) be32_to_cpu(x) -#define cpu_to_fdt32(x) cpu_to_be32(x) -#define fdt64_to_cpu(x) be64_to_cpu(x) -#define cpu_to_fdt64(x) cpu_to_be64(x) - -#endif /* _LIBFDT_ENV_H */ +#ifdef USE_HOSTCC +#include "../scripts/dtc/libfdt/libfdt_env.h" +#else +#include +#endif diff --git a/tools/Makefile b/tools/Makefile index 4d32fe5910f2..4a73cc4d8a25 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -238,7 +238,7 @@ endif # !LOGO_BMP # Define __KERNEL_STRICT_NAMES to prevent typedef overlaps # Define _GNU_SOURCE to obtain the getline prototype from stdio.h # -HOST_EXTRACFLAGS += -include $(srctree)/include/libfdt_env.h \ +HOST_EXTRACFLAGS += -include $(srctree)/include/compiler.h \ $(patsubst -I%,-idirafter%, $(filter -I%, $(UBOOTINCLUDE))) \ -I$(srctree)/lib/libfdt \ -I$(srctree)/tools \ From 80b4803b7815bc66c9562f4fee49e52778537688 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Sun, 21 Jan 2018 19:19:15 +0900 Subject: [PATCH 3/5] tools: include necessary headers explicitly Several host-tools use "bool" type without including . This relies on the crappy header inclusion chain. tools/Makefile has the following line: HOST_EXTRACFLAGS += -include $(srctree)/include/libfdt_env.h \ All host-tools are forced to include libfdt_env.h even if they are totally unrelated to FDT. Then, is indirectly included as follows: include/libfdt_env.h -> include/linux/types.h -> I am fixing this horrible crap. In advance, I need to add necessary include directives explicitly. tools/fdtgrep.c needs more; for open() and for errno. Signed-off-by: Masahiro Yamada Reviewed-by: Joe Hershberger Reviewed-by: Simon Glass (cherry picked from commit d2bf1152c078e7db7ffade193da8cfb1b8430ce0) Signed-off-by: Baruch Siach --- tools/fdtgrep.c | 3 +++ tools/gen_ethaddr_crc.c | 1 + tools/ifdtool.c | 1 + tools/imagetool.h | 1 + tools/mips-relocs.c | 1 + 5 files changed, 7 insertions(+) diff --git a/tools/fdtgrep.c b/tools/fdtgrep.c index 5897b6d5f780..b46f775d1546 100644 --- a/tools/fdtgrep.c +++ b/tools/fdtgrep.c @@ -10,7 +10,10 @@ #include #include +#include #include +#include +#include #include #include #include diff --git a/tools/gen_ethaddr_crc.c b/tools/gen_ethaddr_crc.c index fe9896dca94d..8cf86f4835d8 100644 --- a/tools/gen_ethaddr_crc.c +++ b/tools/gen_ethaddr_crc.c @@ -6,6 +6,7 @@ */ #include +#include #include #include #include diff --git a/tools/ifdtool.c b/tools/ifdtool.c index 195b1533ab69..729991ee33f7 100644 --- a/tools/ifdtool.c +++ b/tools/ifdtool.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include diff --git a/tools/imagetool.h b/tools/imagetool.h index a8d505423b87..e67de9b5ad34 100644 --- a/tools/imagetool.h +++ b/tools/imagetool.h @@ -12,6 +12,7 @@ #include "os_support.h" #include #include +#include #include #include #include diff --git a/tools/mips-relocs.c b/tools/mips-relocs.c index 8be69d320fb3..27d47308e003 100644 --- a/tools/mips-relocs.c +++ b/tools/mips-relocs.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include From 66c5834496424835e8334c98f3f1ae5f1d85c571 Mon Sep 17 00:00:00 2001 From: Paul Kocialkowski Date: Fri, 2 Mar 2018 23:13:42 +0100 Subject: [PATCH 4/5] tools: Include U-Boot libfdt headers from their actual path There are no headers for libfdt in lib/libfdt, as they are instead located in scripts/dtc/libfdt. Specifying lib/libfdt for headers inclusion in host tools results in using the system libfdt headers, which is not what we want. Change this to the proper path. Signed-off-by: Paul Kocialkowski (cherry picked from commit e0d20dc1521e74b82dbd69be53a048847798a90a) Signed-off-by: Baruch Siach --- tools/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/Makefile b/tools/Makefile index 4a73cc4d8a25..fd53b9a1180a 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -240,7 +240,7 @@ endif # !LOGO_BMP # HOST_EXTRACFLAGS += -include $(srctree)/include/compiler.h \ $(patsubst -I%,-idirafter%, $(filter -I%, $(UBOOTINCLUDE))) \ - -I$(srctree)/lib/libfdt \ + -I$(srctree)/scripts/dtc/libfdt \ -I$(srctree)/tools \ -DUSE_HOSTCC \ -D__KERNEL_STRICT_NAMES \ From 49d9dd8628bae9d8e612bac5dfbb2ad44f30afd8 Mon Sep 17 00:00:00 2001 From: Baruch Siach Date: Thu, 3 May 2018 13:32:08 +0300 Subject: [PATCH 5/5] mvebu: bubt: always define CONFIG_MVEBU_UBOOT_DFLT_NAME MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Commit 2fde99bd69e5 (mvebu: bubt: Key default bubt image rom based on selected boot device) made CONFIG_MVEBU_UBOOT_DFLT_NAME depend on CONFIG_ENV_IS_ON_SELECTED_BOOT_DEVICE. This breaks the build when CONFIG_ENV_IS_ON_SELECTED_BOOT_DEVICE is not defined: cmd/mvebu/bubt.c: In function ‘do_bubt_cmd’: cmd/mvebu/bubt.c:944:10: error: ‘CONFIG_MVEBU_UBOOT_DFLT_NAME’ undeclared (first use in this function); did you mean ‘CONFIG_SMBIOS_PRODUCT_NAME’? CONFIG_MVEBU_UBOOT_DFLT_NAME, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ clearfog_defconfig does not define CONFIG_ENV_IS_ON_SELECTED_BOOT_DEVICE, so this config is currently broken. Remove the dependency to make sure CONFIG_MVEBU_UBOOT_DFLT_NAME is always defined. Signed-off-by: Baruch Siach --- cmd/mvebu/Kconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/cmd/mvebu/Kconfig b/cmd/mvebu/Kconfig index 99fcc50958b7..8d6ade5eb827 100644 --- a/cmd/mvebu/Kconfig +++ b/cmd/mvebu/Kconfig @@ -11,7 +11,6 @@ config CMD_MVEBU_BUBT config MVEBU_UBOOT_DFLT_NAME string "Default image name for bubt command" - depends on ENV_IS_ON_SELECTED_BOOT_DEVICE default "u-boot-spl-mmc.kwb" if MVEBU_SPL_BOOT_DEVICE_MMC default "u-boot-spl-nand.kwb" if MVEBU_SPL_BOOT_DEVICE_NAND default "u-boot-spl-sata.kwb" if MVEBU_SPL_BOOT_DEVICE_SATA