Merge ~xnox/ubuntu/+source/u-boot:fixup-fdtdir-properly into ubuntu/+source/u-boot:ubuntu/devel

Proposed by Dimitri John Ledkov
Status: Needs review
Proposed branch: ~xnox/ubuntu/+source/u-boot:fixup-fdtdir-properly
Merge into: ubuntu/+source/u-boot:ubuntu/devel
Diff against target: 260 lines (+141/-47)
7 files modified
debian/changelog (+17/-0)
debian/patches/0001-cmd-pxe-Use-internal-FDT-if-retrieving-from-FDTDIR-f.patch (+57/-0)
debian/patches/0001-cmd-pxe_utils-sysboot-fix-crash-if-either-board-or-s.patch (+39/-0)
debian/patches/riscv64/sifive-unleashed-default-fdt-files.patch (+0/-21)
debian/patches/riscv64/sifive-unmatched-default-fdt-files.patch (+24/-0)
debian/patches/series (+4/-2)
dev/null (+0/-24)
Reviewer Review Type Date Requested Status
Dave Jones (community) Approve
git-ubuntu developers Pending
Review via email: mp+401545@code.launchpad.net

Commit message

fixup fdtdir things properly.

this is for ii opening & sruing through to back to focal

To post a comment you must log in.
Revision history for this message
Dave Jones (waveform) wrote :

The patches all look sane, so +1 from me.

The one thing that worries me is I'm not sure "soc" or "board" are ever *meant* to be blank in the env, but I can't find anything to that effect in the docs/comments. Anyway, they evidently are in this case so the workaround's necessary.

review: Approve

Unmerged commits

1774cfd... by Dimitri John Ledkov

sifive-unleashed-default-fdt-files.patch: split into unleashed & unmatched separate patches, for ease of upstreaming to meta-sifive and u-boot upstreams.

e7d08ec... by Dimitri John Ledkov

Fix LP: #1925267 LP: #1923162 using upstream friendly patches:

* Fix LP: #1925267 LP: #1923162 using upstream friendly patches:
  - riscv64/qemu-skip-fdtdir.patch: drop patch,
    functionality replaced by cherrypick & fix up.
  - 0001-cmd-pxe-Use-internal-FDT-if-retrieving-from-FDTDIR-f.patch:
    cherrypick post-2021.01 patch to gracefully carry-on booting using
    internal FDT if there isn't a different one in FDTDIR.
  - 0001-cmd-pxe_utils-sysboot-fix-crash-if-either-board-or-s.patch: fix
    crash on trying to use fdtdir when either "soc" or "board" environment
    variables are not set (like on qemu-riscv64).

b046cee... by Dimitri John Ledkov

2021.01+dfsg-3ubuntu8 (patches unapplied)

Imported using git-ubuntu import.

cf5c992... by Dimitri John Ledkov

2021.01+dfsg-3ubuntu7 (patches unapplied)

Imported using git-ubuntu import.

f2b547d... by Dimitri John Ledkov

2021.01+dfsg-3ubuntu6 (patches unapplied)

Imported using git-ubuntu import.

25523ec... by Dimitri John Ledkov

2021.01+dfsg-3ubuntu5 (patches unapplied)

Imported using git-ubuntu import.

7966246... by Dimitri John Ledkov

2021.01+dfsg-3ubuntu4 (patches unapplied)

Imported using git-ubuntu import.

0bc3ac5... by Dimitri John Ledkov

2021.01+dfsg-3ubuntu3 (patches unapplied)

Imported using git-ubuntu import.

41dcfe4... by Dimitri John Ledkov

2021.01+dfsg-3ubuntu2 (patches unapplied)

Imported using git-ubuntu import.

967141b... by Dave Jones

2021.01+dfsg-3ubuntu1 (patches unapplied)

Imported using git-ubuntu import.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/debian/changelog b/debian/changelog
index df5f9f4..d82e11c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,20 @@
1u-boot (2021.01+dfsg-3ubuntu9) UNRELEASED; urgency=medium
2
3 * Fix LP: #1925267 LP: #1923162 using upstream friendly patches:
4 - riscv64/qemu-skip-fdtdir.patch: drop patch,
5 functionality replaced by cherrypick & fix up.
6 - 0001-cmd-pxe-Use-internal-FDT-if-retrieving-from-FDTDIR-f.patch:
7 cherrypick post-2021.01 patch to gracefully carry-on booting using
8 internal FDT if there isn't a different one in FDTDIR.
9 - 0001-cmd-pxe_utils-sysboot-fix-crash-if-either-board-or-s.patch: fix
10 crash on trying to use fdtdir when either "soc" or "board" environment
11 variables are not set (like on qemu-riscv64).
12 * sifive-unleashed-default-fdt-files.patch: split into unleashed &
13 unmatched separate patches, for ease of upstreaming to meta-sifive and
14 u-boot upstreams.
15
16 -- Dimitri John Ledkov <xnox@ubuntu.com> Wed, 21 Apr 2021 14:11:38 +0100
17
1u-boot (2021.01+dfsg-3ubuntu8) hirsute; urgency=medium18u-boot (2021.01+dfsg-3ubuntu8) hirsute; urgency=medium
219
3 * Skip processing fdtdir on qemu-riscv64_smode target, as it crashes the20 * Skip processing fdtdir on qemu-riscv64_smode target, as it crashes the
diff --git a/debian/patches/0001-cmd-pxe-Use-internal-FDT-if-retrieving-from-FDTDIR-f.patch b/debian/patches/0001-cmd-pxe-Use-internal-FDT-if-retrieving-from-FDTDIR-f.patch
4new file mode 10064421new file mode 100644
index 0000000..27a0c1f
--- /dev/null
+++ b/debian/patches/0001-cmd-pxe-Use-internal-FDT-if-retrieving-from-FDTDIR-f.patch
@@ -0,0 +1,57 @@
1From db3667413d99b8ec1b1e7e9b34c20a8883ec413d Mon Sep 17 00:00:00 2001
2From: Anton Leontiev <aleontiev@elvees.com>
3Date: Tue, 3 Sep 2019 10:52:24 +0300
4Subject: [PATCH] cmd: pxe: Use internal FDT if retrieving from FDTDIR fails
5
6As FDTDIR label doesn't specify exact file to be loaded, it should
7not fail if no file exists in the directory. In this case try to boot
8with internal FDT if it exists.
9
10Signed-off-by: Anton Leontiev <aleontiev@elvees.com>
11---
12 cmd/pxe_utils.c | 21 ++++++++++++++-------
13 1 file changed, 14 insertions(+), 7 deletions(-)
14
15diff --git a/cmd/pxe_utils.c b/cmd/pxe_utils.c
16index 8716e782f6..235522f4bb 100644
17--- a/cmd/pxe_utils.c
18+++ b/cmd/pxe_utils.c
19@@ -451,11 +451,14 @@ static int label_boot(struct cmd_tbl *cmdtp, struct pxe_label *label)
20
21 /*
22 * fdt usage is optional:
23- * It handles the following scenarios. All scenarios are exclusive
24+ * It handles the following scenarios.
25 *
26- * Scenario 1: If fdt_addr_r specified and "fdt" label is defined in
27- * pxe file, retrieve fdt blob from server. Pass fdt_addr_r to bootm,
28- * and adjust argc appropriately.
29+ * Scenario 1: If fdt_addr_r specified and "fdt" or "fdtdir" label is
30+ * defined in pxe file, retrieve fdt blob from server. Pass fdt_addr_r to
31+ * bootm, and adjust argc appropriately.
32+ *
33+ * If retrieve fails and no exact fdt blob is specified in pxe file with
34+ * "fdt" label, try Scenario 2.
35 *
36 * Scenario 2: If there is an fdt_addr specified, pass it along to
37 * bootm, and adjust argc appropriately.
38@@ -521,9 +524,13 @@ static int label_boot(struct cmd_tbl *cmdtp, struct pxe_label *label)
39
40 free(fdtfilefree);
41 if (err < 0) {
42- printf("Skipping %s for failure retrieving fdt\n",
43- label->name);
44- goto cleanup;
45+ bootm_argv[3] = NULL;
46+
47+ if (label->fdt) {
48+ printf("Skipping %s for failure retrieving FDT\n",
49+ label->name);
50+ goto cleanup;
51+ }
52 }
53 } else {
54 bootm_argv[3] = NULL;
55--
562.27.0
57
diff --git a/debian/patches/0001-cmd-pxe_utils-sysboot-fix-crash-if-either-board-or-s.patch b/debian/patches/0001-cmd-pxe_utils-sysboot-fix-crash-if-either-board-or-s.patch
0new file mode 10064458new file mode 100644
index 0000000..489e1a1
--- /dev/null
+++ b/debian/patches/0001-cmd-pxe_utils-sysboot-fix-crash-if-either-board-or-s.patch
@@ -0,0 +1,39 @@
1From 077ee0830ec3ed3b8db334717910fbbfc1b4e302 Mon Sep 17 00:00:00 2001
2From: Dimitri John Ledkov <xnox@ubuntu.com>
3Date: Wed, 21 Apr 2021 11:44:34 +0100
4Subject: [PATCH] cmd: pxe_utils: sysboot: fix crash if either board or soc are
5 not set.
6
7If the environment does not have "soc" or "board" set, and fdtdir
8option is specified in extlinux.conf, the bootloader will crash whilst
9dereferencing a null pointer. Add a guard against null soc or
10board. Fixes a crash of qemu-riscv64_smode configuration, which does
11not have CONFIG_SYS_SOC defined.
12
13Signed-off-by: Dimitri John Ledkov <xnox@ubuntu.com>
14---
15 cmd/pxe_utils.c | 8 ++++++++
16 1 file changed, 8 insertions(+)
17
18diff --git a/cmd/pxe_utils.c b/cmd/pxe_utils.c
19index 71c5af4c25..9a30629e26 100644
20--- a/cmd/pxe_utils.c
21+++ b/cmd/pxe_utils.c
22@@ -587,6 +587,14 @@ static int label_boot(struct cmd_tbl *cmdtp, struct pxe_label *label)
23 f2 = "-";
24 f3 = env_get("board");
25 f4 = ".dtb";
26+ if (!f1) {
27+ f1 = "";
28+ f2 = "";
29+ }
30+ if (!f3) {
31+ f2 = "";
32+ f3 = "";
33+ }
34 }
35
36 len = strlen(label->fdtdir);
37--
382.27.0
39
diff --git a/debian/patches/riscv64/qemu-skip-fdtdir.patch b/debian/patches/riscv64/qemu-skip-fdtdir.patch
0deleted file mode 10064440deleted file mode 100644
index 70b9436..0000000
--- a/debian/patches/riscv64/qemu-skip-fdtdir.patch
+++ /dev/null
@@ -1,24 +0,0 @@
1Description: Skip processing fdtdir on qemu-riscv64_smode target
2 it crashes the riscv qemu VM.
3Author: Dimitri John Ledkov <xnox@ubuntu.com>
4Bug-Ubuntu: https://bugs.launchpad.net/bugs/1925267
5
6
7--- u-boot-2021.01+dfsg.orig/cmd/pxe_utils.c
8+++ u-boot-2021.01+dfsg/cmd/pxe_utils.c
9@@ -471,6 +471,7 @@ static int label_boot(struct cmd_tbl *cm
10
11 if (label->fdt) {
12 fdtfile = label->fdt;
13+#if !(defined(CONFIG_TARGET_QEMU_VIRT) && defined(CONFIG_RISCV_SMODE))
14 } else if (label->fdtdir) {
15 char *f1, *f2, *f3, *f4, *slash;
16
17@@ -513,6 +514,7 @@ static int label_boot(struct cmd_tbl *cm
18 snprintf(fdtfilefree, len, "%s%s%s%s%s%s",
19 label->fdtdir, slash, f1, f2, f3, f4);
20 fdtfile = fdtfilefree;
21+#endif
22 }
23
24 if (fdtfile) {
diff --git a/debian/patches/riscv64/sifive-default-fdt-files.patch b/debian/patches/riscv64/sifive-unleashed-default-fdt-files.patch
25similarity index 68%0similarity index 68%
26rename from debian/patches/riscv64/sifive-default-fdt-files.patch1rename from debian/patches/riscv64/sifive-default-fdt-files.patch
27rename to debian/patches/riscv64/sifive-unleashed-default-fdt-files.patch2rename to debian/patches/riscv64/sifive-unleashed-default-fdt-files.patch
index 01ffec0..3407169 100644
--- a/debian/patches/riscv64/sifive-default-fdt-files.patch
+++ b/debian/patches/riscv64/sifive-unleashed-default-fdt-files.patch
@@ -10,15 +10,6 @@ Index: u-boot-2021.01+dfsg/configs/sifive_fu540_defconfig
10 CONFIG_RISCV=y10 CONFIG_RISCV=y
11 CONFIG_SPL_GPIO_SUPPORT=y11 CONFIG_SPL_GPIO_SUPPORT=y
12 CONFIG_SYS_MALLOC_F_LEN=0x300012 CONFIG_SYS_MALLOC_F_LEN=0x3000
13Index: u-boot-2021.01+dfsg/configs/sifive_hifive_unmatched_fu740_defconfig
14===================================================================
15--- u-boot-2021.01+dfsg.orig/configs/sifive_hifive_unmatched_fu740_defconfig
16+++ u-boot-2021.01+dfsg/configs/sifive_hifive_unmatched_fu740_defconfig
17@@ -1,3 +1,4 @@
18+CONFIG_DEFAULT_FDT_FILE="sifive/hifive-unmatched-a00.dtb"
19 CONFIG_RISCV=y
20 CONFIG_SPL_GPIO_SUPPORT=y
21 CONFIG_SYS_MALLOC_F_LEN=0x3000
22Index: u-boot-2021.01+dfsg/include/configs/sifive-fu540.h13Index: u-boot-2021.01+dfsg/include/configs/sifive-fu540.h
23===================================================================14===================================================================
24--- u-boot-2021.01+dfsg.orig/include/configs/sifive-fu540.h15--- u-boot-2021.01+dfsg.orig/include/configs/sifive-fu540.h
@@ -31,15 +22,3 @@ Index: u-boot-2021.01+dfsg/include/configs/sifive-fu540.h
31 BOOTENV \22 BOOTENV \
32 BOOTENV_SF23 BOOTENV_SF
33 24
34Index: u-boot-2021.01+dfsg/include/configs/sifive-hifive-unmatched-fu740.h
35===================================================================
36--- u-boot-2021.01+dfsg.orig/include/configs/sifive-hifive-unmatched-fu740.h
37+++ u-boot-2021.01+dfsg/include/configs/sifive-hifive-unmatched-fu740.h
38@@ -84,6 +84,7 @@
39 "type_guid_gpt_loader2=" TYPE_GUID_LOADER2 "\0" \
40 "type_guid_gpt_system=" TYPE_GUID_SYSTEM "\0" \
41 "partitions=" PARTS_DEFAULT "\0" \
42+ "fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" \
43 BOOTENV
44
45 #define CONFIG_PREBOOT \
diff --git a/debian/patches/riscv64/sifive-unmatched-default-fdt-files.patch b/debian/patches/riscv64/sifive-unmatched-default-fdt-files.patch
46new file mode 10064425new file mode 100644
index 0000000..73fdbc8
--- /dev/null
+++ b/debian/patches/riscv64/sifive-unmatched-default-fdt-files.patch
@@ -0,0 +1,24 @@
1Description: set default FDT filenames to load from boot disk
2Bug: https://github.com/sifive/meta-sifive/issues/16
3
4Index: u-boot-2021.01+dfsg/configs/sifive_hifive_unmatched_fu740_defconfig
5===================================================================
6--- u-boot-2021.01+dfsg.orig/configs/sifive_hifive_unmatched_fu740_defconfig
7+++ u-boot-2021.01+dfsg/configs/sifive_hifive_unmatched_fu740_defconfig
8@@ -1,3 +1,4 @@
9+CONFIG_DEFAULT_FDT_FILE="sifive/hifive-unmatched-a00.dtb"
10 CONFIG_RISCV=y
11 CONFIG_SPL_GPIO_SUPPORT=y
12 CONFIG_SYS_MALLOC_F_LEN=0x3000
13Index: u-boot-2021.01+dfsg/include/configs/sifive-hifive-unmatched-fu740.h
14===================================================================
15--- u-boot-2021.01+dfsg.orig/include/configs/sifive-hifive-unmatched-fu740.h
16+++ u-boot-2021.01+dfsg/include/configs/sifive-hifive-unmatched-fu740.h
17@@ -84,6 +84,7 @@
18 "type_guid_gpt_loader2=" TYPE_GUID_LOADER2 "\0" \
19 "type_guid_gpt_system=" TYPE_GUID_SYSTEM "\0" \
20 "partitions=" PARTS_DEFAULT "\0" \
21+ "fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" \
22 BOOTENV
23
24 #define CONFIG_PREBOOT \
diff --git a/debian/patches/series b/debian/patches/series
index 71f2ca7..c222e62 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,5 @@
10001-cmd-pxe-Use-internal-FDT-if-retrieving-from-FDTDIR-f.patch
20001-cmd-pxe_utils-sysboot-fix-crash-if-either-board-or-s.patch
1add-debian-revision-to-u-boot-version3add-debian-revision-to-u-boot-version
24
3tools-generic-builds.patch5tools-generic-builds.patch
@@ -14,6 +16,7 @@ test-imagetools-test-fixes
1416
15exynos/0001-arm-config-fix-default-console-only-to-specify-the-d.patch17exynos/0001-arm-config-fix-default-console-only-to-specify-the-d.patch
1618
19riscv64/sifive-unleashed-default-fdt-files.patch
17riscv64/qemu-riscv64_smode-sifive-fu540-fix-extlinux-define-.patch20riscv64/qemu-riscv64_smode-sifive-fu540-fix-extlinux-define-.patch
18riscv64/sifive-fu540-compressed-booti-support.patch21riscv64/sifive-fu540-compressed-booti-support.patch
19riscv64/0001-clk-sifive-fu540-prci-Extract-prci-core-to-common-ba.patch22riscv64/0001-clk-sifive-fu540-prci-Extract-prci-core-to-common-ba.patch
@@ -57,9 +60,8 @@ riscv64/0038-cmd-pwm-Rework-argc-sanity-checking.patch
57riscv64/0039-riscv-sifive-unmatched-enable-PWM.patch60riscv64/0039-riscv-sifive-unmatched-enable-PWM.patch
58riscv64/0040-riscv-sifive-unmatched-update-for-rev3-16GB-1866.patch61riscv64/0040-riscv-sifive-unmatched-update-for-rev3-16GB-1866.patch
59riscv64/0041-Fix-CRC32-checksum-for-SiFive-HiFive-EEPROM.patch62riscv64/0041-Fix-CRC32-checksum-for-SiFive-HiFive-EEPROM.patch
60riscv64/sifive-default-fdt-files.patch63riscv64/sifive-unmatched-default-fdt-files.patch
61riscv64/use-preboot-unmatched.patch64riscv64/use-preboot-unmatched.patch
62riscv64/qemu-skip-fdtdir.patch
6365
64n900/bootz_and_raw_initrd.patch66n900/bootz_and_raw_initrd.patch
6567

Subscribers

People subscribed via source and target branches