2017.09 GA, rebase of patches

This commit is contained in:
Peter Robinson 2017-09-19 09:30:31 +01:00
parent d01c0543b8
commit 77489d6a2c
12 changed files with 7674 additions and 2647 deletions

View File

@ -589,83 +589,6 @@ index 0d3b7a35f4..a47b95264c 100644
--
2.13.3
From 8f96a0198893ace6d53993ac091e81e7c0d1764c Mon Sep 17 00:00:00 2001
From: Rob Clark <robdclark@gmail.com>
Date: Sat, 24 Jun 2017 10:01:45 -0400
Subject: [PATCH 10/23] db410c: config updates
Signed-off-by: Rob Clark <robdclark@gmail.com>
---
configs/dragonboard410c_defconfig | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/configs/dragonboard410c_defconfig b/configs/dragonboard410c_defconfig
index c78b4a6fd5..d9cb269085 100644
--- a/configs/dragonboard410c_defconfig
+++ b/configs/dragonboard410c_defconfig
@@ -9,6 +9,7 @@ CONFIG_ENV_IS_NOWHERE=y
CONFIG_SYS_PROMPT="dragonboard410c => "
# CONFIG_CMD_IMI is not set
# CONFIG_CMD_IMLS is not set
+CONFIG_CMD_POWEROFF=y
CONFIG_CMD_MD5SUM=y
CONFIG_CMD_MEMINFO=y
CONFIG_CMD_UNZIP=y
@@ -21,11 +22,14 @@ CONFIG_CMD_TIMER=y
CONFIG_CLK=y
CONFIG_MSM_GPIO=y
CONFIG_PM8916_GPIO=y
+CONFIG_DM_KEYBOARD=y
CONFIG_LED=y
CONFIG_LED_GPIO=y
CONFIG_DM_MMC=y
CONFIG_MMC_SDHCI=y
CONFIG_MMC_SDHCI_MSM=y
+CONFIG_DM_ETH=y
+# CONFIG_NETDEVICES is not set
CONFIG_DM_PMIC=y
CONFIG_PMIC_PM8916=y
CONFIG_MSM_SERIAL=y
@@ -38,4 +42,11 @@ CONFIG_USB_EHCI_MSM=y
CONFIG_USB_ULPI_VIEWPORT=y
CONFIG_USB_ULPI=y
CONFIG_USB_STORAGE=y
+CONFIG_USB_KEYBOARD=y
+CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE=y
+CONFIG_DM_VIDEO=y
+# CONFIG_VIDEO_BPP8 is not set
+CONFIG_NO_FB_CLEAR=y
+CONFIG_VIDEO_SIMPLE=y
+CONFIG_FAT_WRITE=y
CONFIG_OF_LIBFDT_OVERLAY=y
--
2.13.3
From 4667c7da8cfb1883d5e734d1017b33e354e699eb Mon Sep 17 00:00:00 2001
From: Rob Clark <robdclark@gmail.com>
Date: Fri, 21 Jul 2017 16:24:03 -0400
Subject: [PATCH 11/23] db410c: enable r8152 usb eth
Signed-off-by: Rob Clark <robdclark@gmail.com>
---
include/configs/dragonboard410c.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/configs/dragonboard410c.h b/include/configs/dragonboard410c.h
index 626dff8dcd..bbc9685e0e 100644
--- a/include/configs/dragonboard410c.h
+++ b/include/configs/dragonboard410c.h
@@ -44,6 +44,7 @@
#define CONFIG_USB_ETHER_ASIX88179
#define CONFIG_USB_ETHER_MCS7830
#define CONFIG_USB_ETHER_SMSC95XX
+#define CONFIG_USB_ETHER_RTL8152
/* Extra Commands */
/* Enable that for switching of boot partitions */
--
2.13.3
From 47f22a41df082c62411389ab5bf6e9ae26d93083 Mon Sep 17 00:00:00 2001
From: Rob Clark <robdclark@gmail.com>
Date: Wed, 19 Jul 2017 10:39:12 -0400
@ -764,3 +687,61 @@ index d2d29cc98f..703dd748f5 100644
--
2.13.3
From 2bf6ff0703fa92755469d8f218a75b07008e9768 Mon Sep 17 00:00:00 2001
From: Peter Robinson <pbrobinson@gmail.com>
Date: Mon, 18 Sep 2017 09:34:30 +0100
Subject: [PATCH] db410c: config updates
Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
---
configs/dragonboard410c_defconfig | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/configs/dragonboard410c_defconfig b/configs/dragonboard410c_defconfig
index 2224b3850a..32efdfa46b 100644
--- a/configs/dragonboard410c_defconfig
+++ b/configs/dragonboard410c_defconfig
@@ -10,6 +10,7 @@ CONFIG_BOOTARGS="console=ttyMSM0,115200n8"
CONFIG_SYS_PROMPT="dragonboard410c => "
# CONFIG_CMD_IMI is not set
# CONFIG_CMD_IMLS is not set
+CONFIG_CMD_POWEROFF=y
CONFIG_CMD_MD5SUM=y
CONFIG_CMD_MEMINFO=y
CONFIG_CMD_UNZIP=y
@@ -22,11 +23,14 @@ CONFIG_CMD_TIMER=y
CONFIG_CLK=y
CONFIG_MSM_GPIO=y
CONFIG_PM8916_GPIO=y
+CONFIG_DM_KEYBOARD=y
CONFIG_LED=y
CONFIG_LED_GPIO=y
CONFIG_DM_MMC=y
CONFIG_MMC_SDHCI=y
CONFIG_MMC_SDHCI_MSM=y
+CONFIG_DM_ETH=y
+# CONFIG_NETDEVICES is not set
CONFIG_DM_PMIC=y
CONFIG_PMIC_PM8916=y
CONFIG_MSM_SERIAL=y
@@ -39,9 +43,17 @@ CONFIG_USB_EHCI_MSM=y
CONFIG_USB_ULPI_VIEWPORT=y
CONFIG_USB_ULPI=y
CONFIG_USB_STORAGE=y
+CONFIG_USB_KEYBOARD=y
CONFIG_USB_HOST_ETHER=y
CONFIG_USB_ETHER_ASIX=y
CONFIG_USB_ETHER_ASIX88179=y
CONFIG_USB_ETHER_MCS7830=y
+CONFIG_USB_ETHER_RTL8152=y
CONFIG_USB_ETHER_SMSC95XX=y
+CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE=y
+CONFIG_DM_VIDEO=y
+# CONFIG_VIDEO_BPP8 is not set
+CONFIG_NO_FB_CLEAR=y
+CONFIG_VIDEO_SIMPLE=y
+CONFIG_FAT_WRITE=y
CONFIG_OF_LIBFDT_OVERLAY=y
--
2.13.5

View File

@ -1,69 +0,0 @@
From patchwork Tue Sep 5 18:20:09 2017
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: [U-Boot] env: Fix out of tree building of tools-all
X-Patchwork-Submitter: Tom Rini <trini@konsulko.com>
X-Patchwork-Id: 810244
Message-Id: <1504635609-23585-1-git-send-email-trini@konsulko.com>
To: u-boot@lists.denx.de
Date: Tue, 5 Sep 2017 14:20:09 -0400
From: Tom Rini <trini@konsulko.com>
List-Id: U-Boot discussion <u-boot.lists.denx.de>
With the move of environment code from common/ to env/ a number of
changes needed to be made to various make targets. We missed updating
some of the files required for out of tree builds of the tools. Correct
the 'environ' target to know that we need to work under tools/env/ still
(not tools/environ/) and then update the wrappers in env_attr.c and
env_flags.c to point to the new correct file.
Reported-by: Peter Robinson <pbrobinson@gmail.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
---
Makefile | 2 +-
tools/env/env_attr.c | 2 +-
tools/env/env_flags.c | 2 +-
tools/env/fw_env.c | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/Makefile b/Makefile
index 792162521155..020ebd50ad22 100644
--- a/Makefile
+++ b/Makefile
@@ -1466,7 +1466,7 @@ checkarmreloc: u-boot
fi
environ: scripts_basic
- $(Q)$(MAKE) $(build)=tools/$@
+ $(Q)$(MAKE) $(build)=tools/env
tools-only: scripts_basic $(version_h) $(timestamp_h)
$(Q)$(MAKE) $(build)=tools
diff --git a/tools/env/env_attr.c b/tools/env/env_attr.c
index 502d4c900bf2..4d8536335c30 100644
--- a/tools/env/env_attr.c
+++ b/tools/env/env_attr.c
@@ -1 +1 @@
-#include "../../common/env_attr.c"
+#include "../../env/attr.c"
diff --git a/tools/env/env_flags.c b/tools/env/env_flags.c
index b261cb8e3907..71e13e2021f6 100644
--- a/tools/env/env_flags.c
+++ b/tools/env/env_flags.c
@@ -1 +1 @@
-#include "../../common/env_flags.c"
+#include "../../env/flags.c"
diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c
index 965e1662d702..ab06415898c2 100644
--- a/tools/env/fw_env.c
+++ b/tools/env/fw_env.c
@@ -755,7 +755,7 @@ static int flash_read_buf (int dev, int fd, void *buf, size_t count,
/*
* If a block is bad, we retry in the next block at the same
- * offset - see common/env_nand.c::writeenv()
+ * offset - see env/nand.c::writeenv()
*/
lseek (fd, blockstart + block_seek, SEEK_SET);

View File

@ -1,6 +1,6 @@
From 09339c34eeab4a73d5dfa48034b6c8ae8a775c14 Mon Sep 17 00:00:00 2001
From 8de891d0767aafb383b6f533b08a5c0b75b4718b Mon Sep 17 00:00:00 2001
From: Peter Robinson <pbrobinson@gmail.com>
Date: Tue, 14 Feb 2017 13:15:23 +0000
Date: Mon, 18 Sep 2017 15:48:32 +0100
Subject: [PATCH] arm: mvebu: enable generic distro boot config
Switch all of the mvebu boards to support disto generic booting
@ -8,33 +8,17 @@ This will enable Fedora, Debian and other distros to support
mvebu systems easier. Tested on SolidRun ClearFog
Signed-off-by: Dennis Gilmore <dgilmore@redhat.com>
Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
---
include/configs/clearfog.h | 5 ---
include/configs/mv-common.h | 84 +++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 84 insertions(+), 5 deletions(-)
1 file changed, 84 insertions(+)
diff --git a/include/configs/clearfog.h b/include/configs/clearfog.h
index 0c51d2a..0034604 100644
--- a/include/configs/clearfog.h
+++ b/include/configs/clearfog.h
@@ -79,11 +79,6 @@
#define CONFIG_SYS_ALT_MEMTEST
-/* Keep device tree and initrd in lower memory so the kernel can access them */
-#define CONFIG_EXTRA_ENV_SETTINGS \
- "fdt_high=0x10000000\0" \
- "initrd_high=0x10000000\0"
-
/* SPL */
/*
* Select the boot device here
diff --git a/include/configs/mv-common.h b/include/configs/mv-common.h
index 25562fa..aebfabe 100644
index 7c2bab2fc6..2819493fca 100644
--- a/include/configs/mv-common.h
+++ b/include/configs/mv-common.h
@@ -139,4 +139,88 @@
#define CONFIG_LZO
@@ -130,4 +130,88 @@
#define CONFIG_MTD_PARTITIONS
#endif
+#ifndef CONFIG_SPL_BUILD
@ -123,5 +107,5 @@ index 25562fa..aebfabe 100644
+
#endif /* _MV_COMMON_H */
--
2.9.3
2.13.5

View File

@ -1,64 +0,0 @@
From 2ae1d3eefc1850a37b9a2922da25b96784c5fbc1 Mon Sep 17 00:00:00 2001
From: Peter Robinson <pbrobinson@gmail.com>
Date: Tue, 15 Aug 2017 11:17:47 +0100
Subject: [PATCH] rpi: re-add CONFIG_OF_EMBED
Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
---
configs/rpi_2_defconfig | 1 +
configs/rpi_3_32b_defconfig | 1 +
configs/rpi_3_defconfig | 1 +
configs/rpi_defconfig | 1 +
4 files changed, 4 insertions(+)
diff --git a/configs/rpi_2_defconfig b/configs/rpi_2_defconfig
index 63d1e4042d..98353d0683 100644
--- a/configs/rpi_2_defconfig
+++ b/configs/rpi_2_defconfig
@@ -4,6 +4,7 @@
CONFIG_DEFAULT_DEVICE_TREE="bcm2836-rpi-2-b"
CONFIG_DISTRO_DEFAULTS=y
CONFIG_OF_BOARD_SETUP=y
+CONFIG_OF_EMBED=y
# CONFIG_DISPLAY_CPUINFO is not set
# CONFIG_DISPLAY_BOARDINFO is not set
CONFIG_SYS_PROMPT="U-Boot> "
diff --git a/configs/rpi_3_32b_defconfig b/configs/rpi_3_32b_defconfig
index 343cb197a1..51009bccb9 100644
--- a/configs/rpi_3_32b_defconfig
+++ b/configs/rpi_3_32b_defconfig
@@ -5,6 +5,7 @@
CONFIG_DEFAULT_DEVICE_TREE="bcm2837-rpi-3-b"
CONFIG_DISTRO_DEFAULTS=y
CONFIG_OF_BOARD_SETUP=y
+CONFIG_OF_EMBED=y
# CONFIG_DISPLAY_CPUINFO is not set
# CONFIG_DISPLAY_BOARDINFO is not set
CONFIG_SYS_PROMPT="U-Boot> "
diff --git a/configs/rpi_3_defconfig b/configs/rpi_3_defconfig
index 6c9f2e32b5..c3c0185954 100644
--- a/configs/rpi_3_defconfig
+++ b/configs/rpi_3_defconfig
@@ -5,6 +5,7 @@
CONFIG_DEFAULT_DEVICE_TREE="bcm2837-rpi-3-b"
CONFIG_DISTRO_DEFAULTS=y
CONFIG_OF_BOARD_SETUP=y
+CONFIG_OF_EMBED=y
# CONFIG_DISPLAY_CPUINFO is not set
# CONFIG_DISPLAY_BOARDINFO is not set
CONFIG_SYS_PROMPT="U-Boot> "
diff --git a/configs/rpi_defconfig b/configs/rpi_defconfig
index 6b3cec5ce0..ad5be72510 100644
--- a/configs/rpi_defconfig
+++ b/configs/rpi_defconfig
@@ -4,6 +4,7 @@
CONFIG_DEFAULT_DEVICE_TREE="bcm2835-rpi-b"
CONFIG_DISTRO_DEFAULTS=y
CONFIG_OF_BOARD_SETUP=y
+CONFIG_OF_EMBED=y
# CONFIG_DISPLAY_CPUINFO is not set
# CONFIG_DISPLAY_BOARDINFO is not set
CONFIG_SYS_PROMPT="U-Boot> "
--
2.13.4

View File

@ -1 +1 @@
SHA512 (u-boot-2017.09-rc4.tar.bz2) = 3fbada7aab3208e5ec43fe675776da7d9a36acd793c84aadcd52bc6f18a040565e3d3639c0b1801a33a959ee56757331da4630f0de5fa7b46c7ae3b2666e5cf2
SHA512 (u-boot-2017.09.tar.bz2) = dff6e793f135e7d6cb9d85d6ef8e4aa7ed5c1e20eece4f434e8c0a6039eb75c3f2cb7bc550121b1f5a5709e943c7cc5d6d8590e05a47a6b0d0d8f05185fe7ec6

View File

@ -1,51 +0,0 @@
From d667f43d25d9c7fe48bc9d163dc9c9e062361acb Mon Sep 17 00:00:00 2001
From: Peter Robinson <pbrobinson@gmail.com>
Date: Thu, 17 Aug 2017 11:55:55 +0100
Subject: [PATCH] pine64 use DM mmc
Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
---
configs/pine64_plus_defconfig | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/configs/pine64_plus_defconfig b/configs/pine64_plus_defconfig
index a509ca92b2..da3663fbb1 100644
--- a/configs/pine64_plus_defconfig
+++ b/configs/pine64_plus_defconfig
@@ -14,3 +14,9 @@ CONFIG_SPL=y
CONFIG_OF_LIST="sun50i-a64-pine64 sun50i-a64-pine64-plus"
CONFIG_SUN8I_EMAC=y
CONFIG_USB_EHCI_HCD=y
+# CONFIG_SPL_BLK is not set
+CONFIG_DM_MMC=y
+# CONFIG_SPL_DM_MMC is not set
+# CONFIG_SPL_DM_MMC_OPS is not set
+CONFIG_SCSI=y
+CONFIG_DM_SCSI=y
--
2.13.5
From d1569782c6fe336577d801ea8c9300e63eb3e9c1 Mon Sep 17 00:00:00 2001
From: Peter Robinson <pbrobinson@gmail.com>
Date: Thu, 17 Aug 2017 12:01:59 +0100
Subject: [PATCH] add mmc
---
configs/pine64_plus_defconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/configs/pine64_plus_defconfig b/configs/pine64_plus_defconfig
index da3663fbb1..78f9cfe21d 100644
--- a/configs/pine64_plus_defconfig
+++ b/configs/pine64_plus_defconfig
@@ -15,6 +15,7 @@ CONFIG_OF_LIST="sun50i-a64-pine64 sun50i-a64-pine64-plus"
CONFIG_SUN8I_EMAC=y
CONFIG_USB_EHCI_HCD=y
# CONFIG_SPL_BLK is not set
+CONFIG_MMC=y
CONFIG_DM_MMC=y
# CONFIG_SPL_DM_MMC is not set
# CONFIG_SPL_DM_MMC_OPS is not set
--
2.13.5

View File

@ -1,8 +1,8 @@
%global candidate rc4
#global candidate rc4
Name: uboot-tools
Version: 2017.09
Release: 0.6%{?candidate:.%{candidate}}%{?dist}
Release: 1%{?candidate:.%{candidate}}%{?dist}
Summary: U-Boot utilities
License: GPLv2+ BSD LGPL-2.1+ LGPL-2.0+
URL: http://www.denx.de/wiki/U-Boot
@ -14,19 +14,17 @@ Source3: aarch64-boards
Source4: aarch64-chromebooks
# Fedoraisms patches, general fixes
Patch1: uefi-use-Fedora-specific-path-name.patch
Patch2: uefi-fixes.patch
Patch3: env-Fix-out-of-tree-building-of-tools-all.patch
Patch1: uefi-vsprintf.patch
Patch2: uefi-improve-fat.patch
Patch3: uefi-efi_loader-enough-UEFI-for-standard-distro-boot.patch
Patch4: uefi-use-Fedora-specific-path-name.patch
# Board fixes and enablement
Patch10: dragonboard-fixes.patch
Patch11: rpi-Revert-dm-Drop-CONFIG_OF_EMBED.patch
Patch12: qemu-machine-virt-ARM.patch
Patch13: sti-STiH410-B2260-support.patch
Patch11: qemu-machine-virt-ARM.patch
Patch12: sti-STiH410-B2260-support.patch
Patch13: mvebu-enable-generic-distro-boot-config.patch
# Patch15: mx6-Initial-Hummingboard-2-support.patch
# Patch16: sunxi-dm-pine64.patch
# Patch17: mvebu-enable-generic-distro-boot-config.patch
BuildRequires: bc
BuildRequires: dtc
@ -278,6 +276,9 @@ cp -p board/warp7/README builds/docs/README.warp7
%endif
%changelog
* Mon Sep 18 2017 Peter Robinson <pbrobinson@fedoraproject.org> 2017.09-1
- 2017.09
* Tue Sep 12 2017 Than Ngo <than@redhat.com> - 2017.09-0.6.rc4
- fixed the check for rockchip rk3368 boards

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

2620
uefi-improve-fat.patch Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
From 95140df8476e255cb279a60228b9c703b3ca318f Mon Sep 17 00:00:00 2001
From 0b10d2ebcaf9244eba57790ede30fed6bc6c4223 Mon Sep 17 00:00:00 2001
From: Peter Robinson <pbrobinson@gmail.com>
Date: Wed, 12 Jul 2017 08:43:31 +0100
Date: Mon, 18 Sep 2017 09:24:37 +0100
Subject: [PATCH] use Fedora specific EFI path/name
Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
@ -9,7 +9,7 @@ Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h
index 4b2c493ae3..704dee7772 100644
index e0d0034ed3..18da4ff737 100644
--- a/include/config_distro_bootcmd.h
+++ b/include/config_distro_bootcmd.h
@@ -88,7 +88,7 @@
@ -21,16 +21,16 @@ index 4b2c493ae3..704dee7772 100644
#elif defined(CONFIG_ARM)
#define BOOTEFI_NAME "bootarm.efi"
#endif
@@ -113,7 +113,7 @@
#define BOOTENV_SHARED_EFI \
"boot_efi_binary=" \
@@ -118,7 +118,7 @@
"bootefi bootmgr ${fdtcontroladdr};" \
"fi;" \
"load ${devtype} ${devnum}:${distro_bootpart} " \
- "${kernel_addr_r} efi/boot/"BOOTEFI_NAME"; " \
+ "${kernel_addr_r} efi/fedora/"BOOTEFI_NAME"; " \
"if fdt addr ${fdt_addr_r}; then " \
"bootefi ${kernel_addr_r} ${fdt_addr_r};" \
"else " \
@@ -136,9 +136,9 @@
@@ -141,9 +141,9 @@
"fi;" \
"done;" \
"if test -e ${devtype} ${devnum}:${distro_bootpart} " \
@ -43,5 +43,5 @@ index 4b2c493ae3..704dee7772 100644
"echo EFI LOAD FAILED: continuing...; " \
"fi; " \
--
2.13.0
2.13.5

544
uefi-vsprintf.patch Normal file
View File

@ -0,0 +1,544 @@
From 4a85663ec7eddd955d22f1b0f34a9708eac82314 Mon Sep 17 00:00:00 2001
From: Rob Clark <robdclark@gmail.com>
Date: Sat, 9 Sep 2017 06:47:39 -0400
Subject: [PATCH 002/105] kbuild: Enable -fshort-wchar
EFI_LOADER really wants UTF-16 strings (ie. %ls and L"string" are 16bit
chars instead of 32bit chars). But rather than enabling -fshort-wchar
conditionally if EFI_LOADER is enabled, it was deemed preferrable to
globally switch.
Signed-off-by: Rob Clark <robdclark@gmail.com>
Acked-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---
Makefile | 1 +
1 file changed, 1 insertion(+)
diff --git a/Makefile b/Makefile
index 8086f3c93e..8250b3409a 100644
--- a/Makefile
+++ b/Makefile
@@ -360,6 +360,7 @@ KBUILD_CPPFLAGS := -D__KERNEL__ -D__UBOOT__
KBUILD_CFLAGS := -Wall -Wstrict-prototypes \
-Wno-format-security \
-fno-builtin -ffreestanding
+KBUILD_CFLAGS += -fshort-wchar
KBUILD_AFLAGS := -D__ASSEMBLY__
# Read UBOOTRELEASE from include/config/uboot.release (if it exists)
--
2.13.5
From 78178bb0c9dfe2a91a636a411291d8bab50e8a7d Mon Sep 17 00:00:00 2001
From: Rob Clark <robdclark@gmail.com>
Date: Sat, 9 Sep 2017 06:47:40 -0400
Subject: [PATCH 003/105] lib: add some utf16 handling helpers
We'll eventually want these in a few places in efi_loader, and also
vsprintf.
Signed-off-by: Rob Clark <robdclark@gmail.com>
---
include/charset.h | 65 ++++++++++++++++++++++++++++
lib/Makefile | 1 +
lib/charset.c | 101 +++++++++++++++++++++++++++++++++++++++++++
lib/efi_loader/efi_console.c | 17 ++------
4 files changed, 170 insertions(+), 14 deletions(-)
create mode 100644 include/charset.h
create mode 100644 lib/charset.c
diff --git a/include/charset.h b/include/charset.h
new file mode 100644
index 0000000000..39279f746a
--- /dev/null
+++ b/include/charset.h
@@ -0,0 +1,65 @@
+/*
+ * charset conversion utils
+ *
+ * Copyright (c) 2017 Rob Clark
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#ifndef __CHARSET_H_
+#define __CHARSET_H_
+
+#define MAX_UTF8_PER_UTF16 4
+
+/**
+ * utf16_strlen() - Get the length of an utf16 string
+ *
+ * Returns the number of 16 bit characters in an utf16 string, not
+ * including the terminating NULL character.
+ *
+ * @in the string to measure
+ * @return the string length
+ */
+size_t utf16_strlen(const uint16_t *in);
+
+/**
+ * utf16_strnlen() - Get the length of a fixed-size utf16 string.
+ *
+ * Returns the number of 16 bit characters in an utf16 string,
+ * not including the terminating NULL character, but at most
+ * 'count' number of characters. In doing this, utf16_strnlen()
+ * looks at only the first 'count' characters.
+ *
+ * @in the string to measure
+ * @count the maximum number of characters to count
+ * @return the string length, up to a maximum of 'count'
+ */
+size_t utf16_strnlen(const uint16_t *in, size_t count);
+
+/**
+ * utf16_strcpy() - UTF16 equivalent of strcpy()
+ */
+uint16_t *utf16_strcpy(uint16_t *dest, const uint16_t *src);
+
+/**
+ * utf16_strdup() - UTF16 equivalent of strdup()
+ */
+uint16_t *utf16_strdup(const uint16_t *s);
+
+/**
+ * utf16_to_utf8() - Convert an utf16 string to utf8
+ *
+ * Converts 'size' characters of the utf16 string 'src' to utf8
+ * written to the 'dest' buffer.
+ *
+ * NOTE that a single utf16 character can generate up to 4 utf8
+ * characters. See MAX_UTF8_PER_UTF16.
+ *
+ * @dest the destination buffer to write the utf8 characters
+ * @src the source utf16 string
+ * @size the number of utf16 characters to convert
+ * @return the pointer to the first unwritten byte in 'dest'
+ */
+uint8_t *utf16_to_utf8(uint8_t *dest, const uint16_t *src, size_t size);
+
+#endif /* __CHARSET_H_ */
diff --git a/lib/Makefile b/lib/Makefile
index da6a11aca3..15bba9eac2 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -18,6 +18,7 @@ obj-$(CONFIG_OF_LIVE) += of_live.o
obj-$(CONFIG_CMD_DHRYSTONE) += dhry/
obj-$(CONFIG_AES) += aes.o
+obj-y += charset.o
obj-$(CONFIG_USB_TTY) += circbuf.o
obj-y += crc7.o
obj-y += crc8.o
diff --git a/lib/charset.c b/lib/charset.c
new file mode 100644
index 0000000000..ff76e88c77
--- /dev/null
+++ b/lib/charset.c
@@ -0,0 +1,101 @@
+/*
+ * charset conversion utils
+ *
+ * Copyright (c) 2017 Rob Clark
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#include <common.h>
+#include <charset.h>
+#include <malloc.h>
+
+/*
+ * utf8/utf16 conversion mostly lifted from grub
+ */
+
+size_t utf16_strlen(const uint16_t *in)
+{
+ size_t i;
+ for (i = 0; in[i]; i++);
+ return i;
+}
+
+size_t utf16_strnlen(const uint16_t *in, size_t count)
+{
+ size_t i;
+ for (i = 0; count-- && in[i]; i++);
+ return i;
+}
+
+uint16_t *utf16_strcpy(uint16_t *dest, const uint16_t *src)
+{
+ uint16_t *tmp = dest;
+
+ while ((*dest++ = *src++) != '\0')
+ /* nothing */;
+ return tmp;
+
+}
+
+uint16_t *utf16_strdup(const uint16_t *s)
+{
+ uint16_t *new;
+ if (!s || !(new = malloc((utf16_strlen(s) + 1) * 2)))
+ return NULL;
+ utf16_strcpy(new, s);
+ return new;
+}
+
+/* Convert UTF-16 to UTF-8. */
+uint8_t *utf16_to_utf8(uint8_t *dest, const uint16_t *src, size_t size)
+{
+ uint32_t code_high = 0;
+
+ while (size--) {
+ uint32_t code = *src++;
+
+ if (code_high) {
+ if (code >= 0xDC00 && code <= 0xDFFF) {
+ /* Surrogate pair. */
+ code = ((code_high - 0xD800) << 10) + (code - 0xDC00) + 0x10000;
+
+ *dest++ = (code >> 18) | 0xF0;
+ *dest++ = ((code >> 12) & 0x3F) | 0x80;
+ *dest++ = ((code >> 6) & 0x3F) | 0x80;
+ *dest++ = (code & 0x3F) | 0x80;
+ } else {
+ /* Error... */
+ *dest++ = '?';
+ /* *src may be valid. Don't eat it. */
+ src--;
+ }
+
+ code_high = 0;
+ } else {
+ if (code <= 0x007F) {
+ *dest++ = code;
+ } else if (code <= 0x07FF) {
+ *dest++ = (code >> 6) | 0xC0;
+ *dest++ = (code & 0x3F) | 0x80;
+ } else if (code >= 0xD800 && code <= 0xDBFF) {
+ code_high = code;
+ continue;
+ } else if (code >= 0xDC00 && code <= 0xDFFF) {
+ /* Error... */
+ *dest++ = '?';
+ } else if (code < 0x10000) {
+ *dest++ = (code >> 12) | 0xE0;
+ *dest++ = ((code >> 6) & 0x3F) | 0x80;
+ *dest++ = (code & 0x3F) | 0x80;
+ } else {
+ *dest++ = (code >> 18) | 0xF0;
+ *dest++ = ((code >> 12) & 0x3F) | 0x80;
+ *dest++ = ((code >> 6) & 0x3F) | 0x80;
+ *dest++ = (code & 0x3F) | 0x80;
+ }
+ }
+ }
+
+ return dest;
+}
diff --git a/lib/efi_loader/efi_console.c b/lib/efi_loader/efi_console.c
index 5ebce4b544..3fc82b8726 100644
--- a/lib/efi_loader/efi_console.c
+++ b/lib/efi_loader/efi_console.c
@@ -7,6 +7,7 @@
*/
#include <common.h>
+#include <charset.h>
#include <efi_loader.h>
static bool console_size_queried;
@@ -138,20 +139,8 @@ static efi_status_t EFIAPI efi_cout_reset(
static void print_unicode_in_utf8(u16 c)
{
- char utf8[4] = { 0 };
- char *b = utf8;
-
- if (c < 0x80) {
- *(b++) = c;
- } else if (c < 0x800) {
- *(b++) = 192 + c / 64;
- *(b++) = 128 + c % 64;
- } else {
- *(b++) = 224 + c / 4096;
- *(b++) = 128 + c / 64 % 64;
- *(b++) = 128 + c % 64;
- }
-
+ char utf8[MAX_UTF8_PER_UTF16] = { 0 };
+ utf16_to_utf8((u8 *)utf8, &c, 1);
puts(utf8);
}
--
2.13.5
From 274325c50951dd16ad2a6f45e79dc062ad47011b Mon Sep 17 00:00:00 2001
From: Rob Clark <robdclark@gmail.com>
Date: Sat, 9 Sep 2017 06:47:41 -0400
Subject: [PATCH 004/105] vsprintf.c: add UTF-16 string (%ls) support
This is convenient for efi_loader which deals a lot with UTF-16. Only
enabled with CC_SHORT_WCHAR, leaving room to add a UTF-32 version when
CC_SHORT_WCHAR is not enabled.
Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
---
examples/api/Makefile | 1 +
lib/vsprintf.c | 30 ++++++++++++++++++++++++++++--
2 files changed, 29 insertions(+), 2 deletions(-)
diff --git a/examples/api/Makefile b/examples/api/Makefile
index dab6398bab..87c15d0f68 100644
--- a/examples/api/Makefile
+++ b/examples/api/Makefile
@@ -34,6 +34,7 @@ EXT_COBJ-y += lib/div64.o
EXT_COBJ-y += lib/string.o
EXT_COBJ-y += lib/time.o
EXT_COBJ-y += lib/vsprintf.o
+EXT_COBJ-y += lib/charset.o
EXT_SOBJ-$(CONFIG_PPC) += arch/powerpc/lib/ppcstring.o
ifeq ($(ARCH),arm)
EXT_SOBJ-$(CONFIG_USE_ARCH_MEMSET) += arch/arm/lib/memset.o
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 874a2951f7..97bed9d36d 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -17,6 +17,7 @@
#include <linux/ctype.h>
#include <common.h>
+#include <charset.h>
#include <div64.h>
#define noinline __attribute__((noinline))
@@ -270,6 +271,26 @@ static char *string(char *buf, char *end, char *s, int field_width,
return buf;
}
+static char *string16(char *buf, char *end, u16 *s, int field_width,
+ int precision, int flags)
+{
+ u16 *str = s ? s : L"<NULL>";
+ int utf16_len = utf16_strnlen(str, precision);
+ u8 utf8[utf16_len * MAX_UTF8_PER_UTF16];
+ int utf8_len, i;
+
+ utf8_len = utf16_to_utf8(utf8, str, utf16_len) - utf8;
+
+ if (!(flags & LEFT))
+ while (utf8_len < field_width--)
+ ADDCH(buf, ' ');
+ for (i = 0; i < utf8_len; ++i)
+ ADDCH(buf, utf8[i]);
+ while (utf8_len < field_width--)
+ ADDCH(buf, ' ');
+ return buf;
+}
+
#ifdef CONFIG_CMD_NET
static const char hex_asc[] = "0123456789abcdef";
#define hex_asc_lo(x) hex_asc[((x) & 0x0f)]
@@ -528,8 +549,13 @@ repeat:
continue;
case 's':
- str = string(str, end, va_arg(args, char *),
- field_width, precision, flags);
+ if (qualifier == 'l' && !IS_ENABLED(CONFIG_SPL_BUILD)) {
+ str = string16(str, end, va_arg(args, u16 *),
+ field_width, precision, flags);
+ } else {
+ str = string(str, end, va_arg(args, char *),
+ field_width, precision, flags);
+ }
continue;
case 'p':
--
2.13.5
From 22ada0c8e6d50281af72176eecdfc356c794639c Mon Sep 17 00:00:00 2001
From: Rob Clark <robdclark@gmail.com>
Date: Sat, 9 Sep 2017 06:47:42 -0400
Subject: [PATCH 005/105] vsprintf.c: add GUID printing
This works (roughly) the same way as linux's, but we currently always
print lower-case (ie. we just keep %pUB and %pUL for compat with linux),
mostly just because that is what uuid_bin_to_str() supports.
%pUb: 01020304-0506-0708-090a-0b0c0d0e0f10
%pUl: 04030201-0605-0807-090a-0b0c0d0e0f10
It will be used by a later efi_loader paths for efi variables and for
device-path-to-text protocol, and also quite useful for debug prints
of protocol GUIDs.
Signed-off-by: Rob Clark <robdclark@gmail.com>
Tested-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
---
examples/api/Makefile | 1 +
include/config_fallbacks.h | 1 +
lib/vsprintf.c | 46 ++++++++++++++++++++++++++++++++++++++++++++--
3 files changed, 46 insertions(+), 2 deletions(-)
diff --git a/examples/api/Makefile b/examples/api/Makefile
index 87c15d0f68..899527267d 100644
--- a/examples/api/Makefile
+++ b/examples/api/Makefile
@@ -35,6 +35,7 @@ EXT_COBJ-y += lib/string.o
EXT_COBJ-y += lib/time.o
EXT_COBJ-y += lib/vsprintf.o
EXT_COBJ-y += lib/charset.o
+EXT_COBJ-$(CONFIG_LIB_UUID) += lib/uuid.o
EXT_SOBJ-$(CONFIG_PPC) += arch/powerpc/lib/ppcstring.o
ifeq ($(ARCH),arm)
EXT_SOBJ-$(CONFIG_USE_ARCH_MEMSET) += arch/arm/lib/memset.o
diff --git a/include/config_fallbacks.h b/include/config_fallbacks.h
index 46b7a2a6f2..2c4d43d672 100644
--- a/include/config_fallbacks.h
+++ b/include/config_fallbacks.h
@@ -58,6 +58,7 @@
#if (CONFIG_IS_ENABLED(PARTITION_UUIDS) || \
CONFIG_IS_ENABLED(EFI_PARTITION) || \
+ CONFIG_IS_ENABLED(EFI_LOADER) || \
defined(CONFIG_RANDOM_UUID) || \
defined(CONFIG_CMD_UUID) || \
defined(CONFIG_BOOTP_PXE)) && \
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 97bed9d36d..dd572d2868 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -18,6 +18,7 @@
#include <common.h>
#include <charset.h>
+#include <uuid.h>
#include <div64.h>
#define noinline __attribute__((noinline))
@@ -366,6 +367,40 @@ static char *ip4_addr_string(char *buf, char *end, u8 *addr, int field_width,
}
#endif
+#ifdef CONFIG_LIB_UUID
+/*
+ * This works (roughly) the same way as linux's, but we currently always
+ * print lower-case (ie. we just keep %pUB and %pUL for compat with linux),
+ * mostly just because that is what uuid_bin_to_str() supports.
+ *
+ * %pUb: 01020304-0506-0708-090a-0b0c0d0e0f10
+ * %pUl: 04030201-0605-0807-090a-0b0c0d0e0f10
+ */
+static char *uuid_string(char *buf, char *end, u8 *addr, int field_width,
+ int precision, int flags, const char *fmt)
+{
+ char uuid[UUID_STR_LEN + 1];
+ int str_format = UUID_STR_FORMAT_STD;
+
+ switch (*(++fmt)) {
+ case 'L':
+ case 'l':
+ str_format = UUID_STR_FORMAT_GUID;
+ break;
+ case 'B':
+ case 'b':
+ /* this is the default */
+ break;
+ default:
+ break;
+ }
+
+ uuid_bin_to_str(addr, uuid, str_format);
+
+ return string(buf, end, uuid, field_width, precision, flags);
+}
+#endif
+
/*
* Show a '%p' thing. A kernel extension is that the '%p' is followed
* by an extra set of alphanumeric characters that are extended format
@@ -399,8 +434,8 @@ static char *pointer(const char *fmt, char *buf, char *end, void *ptr,
flags);
#endif
-#ifdef CONFIG_CMD_NET
switch (*fmt) {
+#ifdef CONFIG_CMD_NET
case 'a':
flags |= SPECIAL | ZEROPAD;
@@ -430,8 +465,15 @@ static char *pointer(const char *fmt, char *buf, char *end, void *ptr,
precision, flags);
flags &= ~SPECIAL;
break;
- }
#endif
+#ifdef CONFIG_LIB_UUID
+ case 'U':
+ return uuid_string(buf, end, ptr, field_width, precision,
+ flags, fmt);
+#endif
+ default:
+ break;
+ }
flags |= SMALL;
if (field_width == -1) {
field_width = 2*sizeof(void *);
--
2.13.5
From 7e3e20560784b048ff19e90cd36b6680626b1ab3 Mon Sep 17 00:00:00 2001
From: Rob Clark <robdclark@gmail.com>
Date: Sat, 9 Sep 2017 06:47:43 -0400
Subject: [PATCH 006/105] examples: add fallback memcpy
Solves build issue:
Building current source for 134 boards (12 threads, 1 job per thread)
arm: + lsxhl
+examples/api/vsprintf.o: In function `string16':
+lib/vsprintf.c:278: undefined reference to `memcpy'
+examples/api/uuid.o: In function `uuid_bin_to_str':
+lib/uuid.c:197: undefined reference to `memcpy'
+lib/uuid.c:199: undefined reference to `memcpy'
+make[3]: *** [examples/api/demo] Error 1
+make[2]: *** [examples/api] Error 2
+make[1]: *** [examples] Error 2
+make: *** [sub-make] Error 2
133 0 1 /134 sheevaplug
Signed-off-by: Rob Clark <robdclark@gmail.com>
---
examples/api/glue.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/examples/api/glue.c b/examples/api/glue.c
index 8aabf32c89..575c1e55f3 100644
--- a/examples/api/glue.c
+++ b/examples/api/glue.c
@@ -416,3 +416,15 @@ void ub_display_clear(void)
{
syscall(API_DISPLAY_CLEAR, NULL);
}
+
+__weak void *memcpy(void *dest, const void *src, size_t size)
+{
+ unsigned char *dptr = dest;
+ const unsigned char *ptr = src;
+ const unsigned char *end = src + size;
+
+ while (ptr < end)
+ *dptr++ = *ptr++;
+
+ return dest;
+}
--
2.13.5