Skip to contentSkip to conversation

bootstd: Improve ChromiumOS support

PATCH In review Simon Glass 3 participants 39 messages Jul 30, 2023 – Aug 11, 2023 x86

lore
Share & tools
lore
#0 lore raw

cover bootstd: Improve ChromiumOS support

The ChromiumOS bootmeth is fairly basic at present. It is able to boot only x86 kernels and contains quite a few hard-coded offsets.

This series tidies it up by bringing in some vboot structures and adding support for ARM.

It adds a few more features to bootstd, including display of x86 setup information.

So far this does not actually boot correctly on any ARM Chromebook:

jerry - hangs when booting kernel
bob - Bad Linux ARM64 Image magic! with lz4-compressed kernel

Further work can address these issues.

Simon Glass (16):
bootstd: cros: Correct reporting of I/O errors
bootstd: cros: Move partition reading into a function
bootstd: cros: Bring in some ChromiumOS structures
bootstd: cros: Support a kernel on either partition
bootstd: cros: Decode some kernel preamble fields
bootstd: cros: Simplify setup and cmdline expressions
bootstd: Move common zimage functions to bootm.h
bootstd: cros: Add docs for the kernel layout
bootstd: cros: Add private info for ChromiumOS
bootstd: Add private bootmeth data to the bootflow
bootstd: cros: Add a function to read info from partition
bootstd: cros: Add a function to read a kernel
bootstd: cros: Split up reading info and kernel
bootstd: Allow display of the x86 setup information
bootstd: Add a command to read all files for a bootflow
bootstd: cros: Add ARM support

 arch/x86/include/asm/zimage.h |  37 ----
 arch/x86/lib/zimage.c         |   8 +-
 boot/Kconfig                  |   4 +-
 boot/bootflow.c               |  15 ++
 boot/bootm.c                  |  37 ++++
 boot/bootmeth-uclass.c        |  10 +
 boot/bootmeth_cros.c          | 363 ++++++++++++++++++++++++++++------
 boot/bootmeth_cros.h          | 197 ++++++++++++++++++
 cmd/bootflow.c                |  47 ++++-
 doc/usage/cmd/bootflow.rst    | 139 ++++++++++++-
 include/bootflow.h            |  15 +-
 include/bootm.h               |  47 +++++
 include/bootmeth.h            |  23 +++
 13 files changed, 836 insertions(+), 106 deletions(-)
 create mode 100644 boot/bootmeth_cros.h
Signature · 1 line
2.41.0.487.g6d72f3e995-goog
#1 lore raw

PATCH 1/16 bootstd: cros: Correct reporting of I/O errors

Return -EIO when the read failed, rather than the number of blocks read.

---

 boot/bootmeth_cros.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
boot/bootmeth_cros.c +2 -2
index aa19ae097f56..6179a547f74a 100644
@@ -106,7 +106,7 @@ static int cros_read_bootflow(struct udevice *dev, struct bootflow *bflow)
 		return log_msg_ret("hdr", -ENOMEM);
 	ret = blk_read(bflow->blk, info.start, num_blks, hdr);
 	if (ret != num_blks)
-		return log_msg_ret("inf", ret);
+		return log_msg_ret("inf", -EIO);
 
 	if (memcmp("CHROMEOS", hdr, 8))
 		return -ENOENT;
@@ -125,7 +125,7 @@ static int cros_read_bootflow(struct udevice *dev, struct bootflow *bflow)
 		  bflow->blk->name, (ulong)info.start, num_blks);
 	ret = blk_read(bflow->blk, (ulong)info.start + 0x80, num_blks, buf);
 	if (ret != num_blks)
-		return log_msg_ret("inf", ret);
+		return log_msg_ret("inf", -EIO);
 	base = map_to_sysmem(buf);
 
 	setup = base + start - OFFSET_BASE - SETUP_OFFSET;
Signature · 1 line
2.41.0.487.g6d72f3e995-goog
#2 lore raw

Re: [PATCH 01/16] bootstd: cros: Correct reporting of I/O errors

Return -EIO when the read failed, rather than the number of blocks read.

---

 boot/bootmeth_cros.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Applied to u-boot-dm/next, thanks!

#3 lore raw

PATCH 2/16 bootstd: cros: Move partition reading into a function

In reply to Simon Glass

Move the code which reads a partition into its own function. Add a constant for the number of bytes to 'probe' at the start of the partition.

---

 boot/bootmeth_cros.c | 66 +++++++++++++++++++++++++++++++++-----------
 1 file changed, 50 insertions(+), 16 deletions(-)
boot/bootmeth_cros.c +50 -16
index 6179a547f74a..f6fb521f2065 100644
@@ -23,6 +23,8 @@
 #include <linux/sizes.h>
 
 enum {
+	PROBE_SIZE	= SZ_4K,	/* initial bytes read from partition */
+
 	/* Offsets in the kernel-partition header */
 	KERN_START	= 0x4f0,
 	KERN_SIZE	= 0x518,
@@ -77,6 +79,51 @@ static int copy_cmdline(const char *from, const char *uuid, char **bufp)
 	return 0;
 }
 
+/**
+ * scan_part() - Scan a kernel partition to see if has a ChromeOS header
+ *
+ * This reads the first PROBE_SIZE of a partition, loookng for CHROMEOS
+ *
+ * @blk: Block device to scan
+ * @partnum: Partition number to scan
+ * @info: Please to put partition info
+ * @hdrp: Return allocated keyblock header on success
+ */
+static int scan_part(struct udevice *blk, int partnum,
+		     struct disk_partition *info, void **hdrp)
+{
+	struct blk_desc *desc = dev_get_uclass_plat(blk);
+	struct vb2_keyblock *hdr;
+	ulong num_blks;
+	int ret;
+
+	ret = part_get_info(desc, partnum, info);
+	if (ret)
+		return log_msg_ret("part", ret);
+
+	/* Make a buffer for the header information */
+	num_blks = PROBE_SIZE >> desc->log2blksz;
+	log_debug("Reading header, blk=%s, start=%lx, blocks=%lx\n",
+		  blk->name, (ulong)info->start, num_blks);
+	hdr = memalign(SZ_1K, PROBE_SIZE);
+	if (!hdr)
+		return log_msg_ret("hdr", -ENOMEM);
+	ret = blk_read(blk, info->start, num_blks, hdr);
+	if (ret != num_blks) {
+		free(hdr);
+		return log_msg_ret("inf", -EIO);
+	}
+
+	if (memcmp("CHROMEOS", hdr, 8)) {
+		free(hdr);
+		return -ENOENT;
+	}
+
+	*hdrp = hdr;
+
+	return 0;
+}
+
 static int cros_read_bootflow(struct udevice *dev, struct bootflow *bflow)
 {
 	struct blk_desc *desc = dev_get_uclass_plat(bflow->blk);
@@ -93,23 +140,10 @@ static int cros_read_bootflow(struct udevice *dev, struct bootflow *bflow)
 		return log_msg_ret("max", -ENOENT);
 
 	/* Check partition 2 */
-	ret = part_get_info(desc, 2, &info);
+	ret = scan_part(bflow->blk, 2, &info, &hdr);
 	if (ret)
-		return log_msg_ret("part", ret);
-
-	/* Make a buffer for the header information */
-	num_blks = SZ_4K >> desc->log2blksz;
-	log_debug("Reading header, blk=%s, start=%lx, blocks=%lx\n",
-		  bflow->blk->name, (ulong)info.start, num_blks);
-	hdr = memalign(SZ_1K, SZ_4K);
-	if (!hdr)
-		return log_msg_ret("hdr", -ENOMEM);
-	ret = blk_read(bflow->blk, info.start, num_blks, hdr);
-	if (ret != num_blks)
-		return log_msg_ret("inf", -EIO);
-
-	if (memcmp("CHROMEOS", hdr, 8))
-		return -ENOENT;
+		return log_msg_ret("scan", ret);
+	bflow->part = 2;
 
 	log_info("Header at %lx\n", (ulong)map_to_sysmem(hdr));
 	start = *(u32 *)(hdr + KERN_START);
Signature · 1 line
2.41.0.487.g6d72f3e995-goog
#4 lore raw

Re: [PATCH 02/16] bootstd: cros: Move partition reading into a function

Move the code which reads a partition into its own function. Add a constant for the number of bytes to 'probe' at the start of the partition.

---

 boot/bootmeth_cros.c | 66 +++++++++++++++++++++++++++++++++-----------
 1 file changed, 50 insertions(+), 16 deletions(-)

Applied to u-boot-dm/next, thanks!

#5 lore raw

PATCH 3/16 bootstd: cros: Bring in some ChromiumOS structures

In reply to Simon Glass

Add a header file with structures for booting ChromiumOS, taken from the vboot tree. Using these makes it easier to understand the code.

Note that the code style has not been updated for U-Boot, with use of uint64_t, __attribute__((packed)) and one comment-style nit. This should make it easier to keep the code in sync. It was taken from commit:

5b8596ce ("2sha256_arm: Fix data abort issue")

Update the CHROMEOS string to use the defined values.

---

 boot/bootmeth_cros.c |   6 +-
 boot/bootmeth_cros.h | 197 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 201 insertions(+), 2 deletions(-)
 create mode 100644 boot/bootmeth_cros.h
boot/bootmeth_cros.c +4 -2
index f6fb521f2065..385eca37381c 100644
@@ -21,6 +21,7 @@
 #include <asm/zimage.h>
 #endif
 #include <linux/sizes.h>
+#include "bootmeth_cros.h"
 
 enum {
 	PROBE_SIZE	= SZ_4K,	/* initial bytes read from partition */
@@ -82,7 +83,8 @@ static int copy_cmdline(const char *from, const char *uuid, char **bufp)
 /**
  * scan_part() - Scan a kernel partition to see if has a ChromeOS header
  *
- * This reads the first PROBE_SIZE of a partition, loookng for CHROMEOS
+ * This reads the first PROBE_SIZE of a partition, loookng for
+ * VB2_KEYBLOCK_MAGIC
  *
  * @blk: Block device to scan
  * @partnum: Partition number to scan
@@ -114,7 +116,7 @@ static int scan_part(struct udevice *blk, int partnum,
 		return log_msg_ret("inf", -EIO);
 	}
 
-	if (memcmp("CHROMEOS", hdr, 8)) {
+	if (memcmp(VB2_KEYBLOCK_MAGIC, hdr->magic, VB2_KEYBLOCK_MAGIC_SIZE)) {
 		free(hdr);
 		return -ENOENT;
 	}
boot/bootmeth_cros.h new file +197 -0

197 lines not on this page · raw message

Signature · 1 line
2.41.0.487.g6d72f3e995-goog
#6 lore raw

Re: [PATCH 03/16] bootstd: cros: Bring in some ChromiumOS structures

Add a header file with structures for booting ChromiumOS, taken from the vboot tree. Using these makes it easier to understand the code.

Note that the code style has not been updated for U-Boot, with use of uint64_t, __attribute__((packed)) and one comment-style nit. This should make it easier to keep the code in sync. It was taken from commit:

5b8596ce ("2sha256_arm: Fix data abort issue")

Update the CHROMEOS string to use the defined values.

---

 boot/bootmeth_cros.c |   6 +-
 boot/bootmeth_cros.h | 197 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 201 insertions(+), 2 deletions(-)
 create mode 100644 boot/bootmeth_cros.h

Applied to u-boot-dm/next, thanks!

#7 lore raw

PATCH 4/16 bootstd: cros: Support a kernel on either partition

In reply to Simon Glass

ChromiumOS allows a kernel to be on either partition 2 or 4. Add support for scanning both and using the first one we find with a suitable signature.

Record the partition which is used.

---

 boot/bootmeth_cros.c | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)
boot/bootmeth_cros.c +14 -7
index 385eca37381c..7b25042bfe56 100644
@@ -13,6 +13,7 @@
 #include <bootdev.h>
 #include <bootflow.h>
 #include <bootmeth.h>
+#include <display_options.h>
 #include <dm.h>
 #include <malloc.h>
 #include <mapmem.h>
@@ -133,7 +134,7 @@ static int cros_read_bootflow(struct udevice *dev, struct bootflow *bflow)
 	struct disk_partition info;
 	const char *uuid = NULL;
 	void *buf, *hdr;
-	int ret;
+	int part, ret;
 
 	log_debug("starting, part=%d\n", bflow->part);
 
@@ -141,13 +142,19 @@ static int cros_read_bootflow(struct udevice *dev, struct bootflow *bflow)
 	if (bflow->part)
 		return log_msg_ret("max", -ENOENT);
 
-	/* Check partition 2 */
-	ret = scan_part(bflow->blk, 2, &info, &hdr);
-	if (ret)
-		return log_msg_ret("scan", ret);
-	bflow->part = 2;
+	/* Check partition 2 then 4 */
+	part = 2;
+	ret = scan_part(bflow->blk, part, &info, &hdr);
+	if (ret) {
+		part = 4;
+		ret = scan_part(bflow->blk, part, &info, &hdr);
+		if (ret)
+			return log_msg_ret("scan", ret);
+	}
+	bflow->part = part;
 
-	log_info("Header at %lx\n", (ulong)map_to_sysmem(hdr));
+	log_info("Selected parition %d, header at %lx\n", bflow->part,
+		 (ulong)map_to_sysmem(hdr));
 	start = *(u32 *)(hdr + KERN_START);
 	size = ALIGN(*(u32 *)(hdr + KERN_SIZE), desc->blksz);
 	log_debug("Reading start %lx size %lx\n", start, size);
Signature · 1 line
2.41.0.487.g6d72f3e995-goog
#8 lore raw

Re: [PATCH 04/16] bootstd: cros: Support a kernel on either partition

ChromiumOS allows a kernel to be on either partition 2 or 4. Add support for scanning both and using the first one we find with a suitable signature.

Record the partition which is used.

---

 boot/bootmeth_cros.c | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

Applied to u-boot-dm/next, thanks!

#9 lore raw

PATCH 5/16 bootstd: cros: Decode some kernel preamble fields

In reply to Simon Glass

Decode the kernel start and size using the structures provided. This accesses the same data, just in a cleaner way.

Add some logging for some of the fields in the kernel preamble.

---

 boot/bootmeth_cros.c | 54 ++++++++++++++++++++++++++++++--------------
 1 file changed, 37 insertions(+), 17 deletions(-)
boot/bootmeth_cros.c +37 -17
index 7b25042bfe56..2a745621e30e 100644
@@ -27,10 +27,6 @@
 enum {
 	PROBE_SIZE	= SZ_4K,	/* initial bytes read from partition */
 
-	/* Offsets in the kernel-partition header */
-	KERN_START	= 0x4f0,
-	KERN_SIZE	= 0x518,
-
 	SETUP_OFFSET	= 0x1000,	/* bytes before base */
 	CMDLINE_OFFSET	= 0x2000,	/* bytes before base */
 	OFFSET_BASE	= 0x100000,	/* assumed kernel load-address */
@@ -93,7 +89,7 @@ static int copy_cmdline(const char *from, const char *uuid, char **bufp)
  * @hdrp: Return allocated keyblock header on success
  */
 static int scan_part(struct udevice *blk, int partnum,
-		     struct disk_partition *info, void **hdrp)
+		     struct disk_partition *info, struct vb2_keyblock **hdrp)
 {
 	struct blk_desc *desc = dev_get_uclass_plat(blk);
 	struct vb2_keyblock *hdr;
@@ -130,11 +126,14 @@ static int scan_part(struct udevice *blk, int partnum,
 static int cros_read_bootflow(struct udevice *dev, struct bootflow *bflow)
 {
 	struct blk_desc *desc = dev_get_uclass_plat(bflow->blk);
-	ulong base, start, size, setup, cmdline, num_blks, kern_base;
+	ulong base, start, setup, cmdline, num_blks, kern_base;
+	const struct vb2_kernel_preamble *preamble;
+	ulong body_offset, body_size;
 	struct disk_partition info;
 	const char *uuid = NULL;
-	void *buf, *hdr;
+	struct vb2_keyblock *hdr;
 	int part, ret;
+	void *buf;
 
 	log_debug("starting, part=%d\n", bflow->part);
 
@@ -155,18 +154,39 @@ static int cros_read_bootflow(struct udevice *dev, struct bootflow *bflow)
 
 	log_info("Selected parition %d, header at %lx\n", bflow->part,
 		 (ulong)map_to_sysmem(hdr));
-	start = *(u32 *)(hdr + KERN_START);
-	size = ALIGN(*(u32 *)(hdr + KERN_SIZE), desc->blksz);
-	log_debug("Reading start %lx size %lx\n", start, size);
-	bflow->size = size;
-
-	buf = memalign(SZ_1K, size);
+	preamble = (void *)hdr + hdr->keyblock_size;
+	log_debug("Kernel preamble at %lx, version major %x, minor %x\n",
+		  (ulong)map_to_sysmem(preamble),
+		  preamble->header_version_major,
+		  preamble->header_version_minor);
+
+	start = (ulong)preamble->bootloader_address;
+	log_debug("  - load_address %lx, bl_addr %lx, bl_size %lx\n",
+		  (ulong)preamble->body_load_address,
+		  (ulong)preamble->bootloader_address,
+		  (ulong)preamble->bootloader_size);
+
+	body_offset = hdr->keyblock_size + preamble->preamble_size;
+	body_size = preamble->body_signature.data_size;
+	log_debug("Kernel body at %lx size %lx\n", body_offset, body_size);
+	bflow->size = body_size;
+
+	buf = memalign(SZ_1K, body_size);
 	if (!buf)
 		return log_msg_ret("buf", -ENOMEM);
-	num_blks = size >> desc->log2blksz;
-	log_debug("Reading data, blk=%s, start=%lx, blocks=%lx\n",
-		  bflow->blk->name, (ulong)info.start, num_blks);
-	ret = blk_read(bflow->blk, (ulong)info.start + 0x80, num_blks, buf);
+
+	/* Check that the header is not smaller than permitted */
+	if (body_offset < PROBE_SIZE)
+		return log_msg_ret("san", EFAULT);
+
+	/* Read kernel body */
+	num_blks = body_size >> desc->log2blksz;
+	log_debug("Reading body to %lx, blk=%s, size=%lx, blocks=%lx\n",
+		  (ulong)map_to_sysmem(buf), bflow->blk->name, body_size,
+		  num_blks);
+	ret = blk_read(bflow->blk,
+		       info.start + (body_offset >> desc->log2blksz),
+		       num_blks, buf);
 	if (ret != num_blks)
 		return log_msg_ret("inf", -EIO);
 	base = map_to_sysmem(buf);
Signature · 1 line
2.41.0.487.g6d72f3e995-goog
#10 lore raw

Re: [PATCH 05/16] bootstd: cros: Decode some kernel preamble fields

Decode the kernel start and size using the structures provided. This accesses the same data, just in a cleaner way.

Add some logging for some of the fields in the kernel preamble.

---

 boot/bootmeth_cros.c | 54 ++++++++++++++++++++++++++++++--------------
 1 file changed, 37 insertions(+), 17 deletions(-)

Applied to u-boot-dm/next, thanks!

#11 lore raw

PATCH 6/16 bootstd: cros: Simplify setup and cmdline expressions

In reply to Simon Glass

Create a common base from which the other parts are offset and make all of the offsets related to that. This makes the code a little easier to read.

Use X86_ prefixes for the two values which are x86-specific.

Drop OFFSET_BASE since it is available in a header field.

Drop the unnecessary 'start' variable too.

---

 boot/bootmeth_cros.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
boot/bootmeth_cros.c +10 -10
index 2a745621e30e..05284713f67b 100644
@@ -27,9 +27,9 @@
 enum {
 	PROBE_SIZE	= SZ_4K,	/* initial bytes read from partition */
 
-	SETUP_OFFSET	= 0x1000,	/* bytes before base */
-	CMDLINE_OFFSET	= 0x2000,	/* bytes before base */
-	OFFSET_BASE	= 0x100000,	/* assumed kernel load-address */
+	X86_SETUP_OFFSET = -0x1000,	/* setup offset relative to base */
+	CMDLINE_OFFSET	= -0x2000,	/* cmdline offset relative to base */
+	X86_KERNEL_OFFSET = 0x4000,	/* kernel offset relative to base */
 };
 
 static int cros_check(struct udevice *dev, struct bootflow_iter *iter)
@@ -126,7 +126,7 @@ static int scan_part(struct udevice *blk, int partnum,
 static int cros_read_bootflow(struct udevice *dev, struct bootflow *bflow)
 {
 	struct blk_desc *desc = dev_get_uclass_plat(bflow->blk);
-	ulong base, start, setup, cmdline, num_blks, kern_base;
+	ulong base, setup, cmdline, num_blks, kern_base;
 	const struct vb2_kernel_preamble *preamble;
 	ulong body_offset, body_size;
 	struct disk_partition info;
@@ -160,7 +160,6 @@ static int cros_read_bootflow(struct udevice *dev, struct bootflow *bflow)
 		  preamble->header_version_major,
 		  preamble->header_version_minor);
 
-	start = (ulong)preamble->bootloader_address;
 	log_debug("  - load_address %lx, bl_addr %lx, bl_size %lx\n",
 		  (ulong)preamble->body_load_address,
 		  (ulong)preamble->bootloader_address,
@@ -189,12 +188,13 @@ static int cros_read_bootflow(struct udevice *dev, struct bootflow *bflow)
 		       num_blks, buf);
 	if (ret != num_blks)
 		return log_msg_ret("inf", -EIO);
-	base = map_to_sysmem(buf);
+	base = map_to_sysmem(buf) + preamble->bootloader_address -
+		preamble->body_load_address;
 
-	setup = base + start - OFFSET_BASE - SETUP_OFFSET;
-	cmdline = base + start - OFFSET_BASE - CMDLINE_OFFSET;
-	kern_base = base + start - OFFSET_BASE + SZ_16K;
-	log_debug("base %lx setup %lx, cmdline %lx, kern_base %lx\n", base,
+	setup = base + X86_SETUP_OFFSET;
+	cmdline = base + CMDLINE_OFFSET;
+	kern_base = base + X86_KERNEL_OFFSET;
+	log_debug("base %lx setup %lx cmdline %lx kern_base %lx\n", base,
 		  setup, cmdline, kern_base);
 
 #ifdef CONFIG_X86
Signature · 1 line
2.41.0.487.g6d72f3e995-goog
#12 lore raw

Re: [PATCH 06/16] bootstd: cros: Simplify setup and cmdline expressions

Create a common base from which the other parts are offset and make all of the offsets related to that. This makes the code a little easier to read.

Use X86_ prefixes for the two values which are x86-specific.

Drop OFFSET_BASE since it is available in a header field.

Drop the unnecessary 'start' variable too.

---

 boot/bootmeth_cros.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

Applied to u-boot-dm/next, thanks!

#13 lore raw

PATCH 7/16 bootstd: Move common zimage functions to bootm.h

In reply to Simon Glass

We want to avoid using #ifdefs around header files and in the code. It makes sense to collect the various functions used for loading images into a single header which can be included by all architectures. The best place for this is the arch-neutral bootm.h header, so use that.

Move some zimage functions into this bootm.h header.

---

 arch/x86/include/asm/zimage.h | 27 ---------------------------
 boot/bootmeth_cros.c          |  4 +---
 include/bootm.h               | 28 ++++++++++++++++++++++++++++
 3 files changed, 29 insertions(+), 30 deletions(-)
arch/x86/include/asm/zimage.h +0 -27
index 9ad74dc0b946..000b38ea8993 100644
@@ -72,31 +72,4 @@ int setup_zimage(struct boot_params *setup_base, char *cmd_line, int auto_boot,
  */
 void zimage_dump(struct boot_params *base_ptr);
 
-/**
- * zboot_start() - Boot a zimage
- *
- * Boot a zimage, given the component parts
- *
- * @addr: Address where the bzImage is moved before booting, either
- *	BZIMAGE_LOAD_ADDR or ZIMAGE_LOAD_ADDR
- * @base: Pointer to the boot parameters, typically at address
- *	DEFAULT_SETUP_BASE
- * @initrd: Address of the initial ramdisk, or 0 if none
- * @initrd_size: Size of the initial ramdisk, or 0 if none
- * @cmdline: Command line to use for booting
- * Return: -EFAULT on error (normally it does not return)
- */
-int zboot_start(ulong addr, ulong size, ulong initrd, ulong initrd_size,
-		ulong base, char *cmdline);
-
-/*
- * zimage_get_kernel_version() - Get the version string from a kernel
- *
- * @params: boot_params pointer
- * @kernel_base: base address of kernel
- * Return: Kernel version as a NUL-terminated string
- */
-const char *zimage_get_kernel_version(struct boot_params *params,
-				      void *kernel_base);
-
 #endif
boot/bootmeth_cros.c +1 -3
index 05284713f67b..3b9e75540aa8 100644
@@ -12,15 +12,13 @@
 #include <blk.h>
 #include <bootdev.h>
 #include <bootflow.h>
+#include <bootm.h>
 #include <bootmeth.h>
 #include <display_options.h>
 #include <dm.h>
 #include <malloc.h>
 #include <mapmem.h>
 #include <part.h>
-#ifdef CONFIG_X86
-#include <asm/zimage.h>
-#endif
 #include <linux/sizes.h>
 #include "bootmeth_cros.h"
 
include/bootm.h +28 -0
index 044a4797ed36..6fe418e00272 100644
@@ -9,6 +9,7 @@
 
 #include <image.h>
 
+struct boot_params;
 struct cmd_tbl;
 
 #define BOOTM_ERR_RESET		(-1)
@@ -124,4 +125,31 @@ int bootm_process_cmdline(char *buf, int maxlen, int flags);
  */
 int bootm_process_cmdline_env(int flags);
 
+/**
+ * zboot_start() - Boot a zimage
+ *
+ * Boot a zimage, given the component parts
+ *
+ * @addr: Address where the bzImage is moved before booting, either
+ *	BZIMAGE_LOAD_ADDR or ZIMAGE_LOAD_ADDR
+ * @base: Pointer to the boot parameters, typically at address
+ *	DEFAULT_SETUP_BASE
+ * @initrd: Address of the initial ramdisk, or 0 if none
+ * @initrd_size: Size of the initial ramdisk, or 0 if none
+ * @cmdline: Command line to use for booting
+ * Return: -EFAULT on error (normally it does not return)
+ */
+int zboot_start(ulong addr, ulong size, ulong initrd, ulong initrd_size,
+		ulong base, char *cmdline);
+
+/*
+ * zimage_get_kernel_version() - Get the version string from a kernel
+ *
+ * @params: boot_params pointer
+ * @kernel_base: base address of kernel
+ * Return: Kernel version as a NUL-terminated string
+ */
+const char *zimage_get_kernel_version(struct boot_params *params,
+				      void *kernel_base);
+
 #endif
Signature · 1 line
2.41.0.487.g6d72f3e995-goog
#14 lore raw

Re: [PATCH 07/16] bootstd: Move common zimage functions to bootm.h

We want to avoid using #ifdefs around header files and in the code. It makes sense to collect the various functions used for loading images into a single header which can be included by all architectures. The best place for this is the arch-neutral bootm.h header, so use that.

Move some zimage functions into this bootm.h header.

---

 arch/x86/include/asm/zimage.h | 27 ---------------------------
 boot/bootmeth_cros.c          |  4 +---
 include/bootm.h               | 28 ++++++++++++++++++++++++++++
 3 files changed, 29 insertions(+), 30 deletions(-)

Applied to u-boot-dm/next, thanks!

#15 lore raw

PATCH 8/16 bootstd: cros: Add docs for the kernel layout

In reply to Simon Glass

Provide brief documentation about the ChromiumOS kernel layout.

---

 boot/bootmeth_cros.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)
boot/bootmeth_cros.c +29 -0
index 3b9e75540aa8..a551d43701d8 100644
@@ -22,6 +22,35 @@
 #include <linux/sizes.h>
 #include "bootmeth_cros.h"
 
+/*
+ * Layout of the ChromeOS kernel
+ *
+ * Partitions 2 and 4 contain kernels
+ *
+ * Contents are:
+ *
+ * Offset	Contents
+ *   0		struct vb2_keyblock
+ *   m		struct vb2_kernel_preamble
+ *   m + n	kernel buffer
+ *
+ * m is keyblock->keyblock_size
+ * n is preamble->preamble_size
+ *
+ * The kernel buffer itself consists of various parts:
+ *
+ * Offset	Contents
+ *   m + n	kernel image (Flat vmlinux binary or FIT)
+ *   b - 8KB	Command line text
+ *   b - 4KB	X86 setup block (struct boot_params, extends for about 16KB)
+ *   b          X86 bootloader (continuation of setup block)
+ *   b + 16KB	X86 setup block (copy, used for hold data pointed to)
+ *
+ * b is m + n + preamble->bootloader_address - preamble->body_load_address
+ *
+ * Useful metadata extends from b - 8KB through to b + 32 KB
+ */
+
 enum {
 	PROBE_SIZE	= SZ_4K,	/* initial bytes read from partition */
 
Signature · 1 line
2.41.0.487.g6d72f3e995-goog
#16 lore raw

Re: [PATCH 08/16] bootstd: cros: Add docs for the kernel layout

Provide brief documentation about the ChromiumOS kernel layout.

---

 boot/bootmeth_cros.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

Applied to u-boot-dm/next, thanks!

#17 lore raw

PATCH 9/16 bootstd: cros: Add private info for ChromiumOS

In reply to Simon Glass

Create a new private structure to hold information gleaned from the disk. This will allow separation between reading of the bootflow information and (later) reading the whole kernel.

---

 boot/bootmeth_cros.c | 55 +++++++++++++++++++++++++++++++++-----------
 1 file changed, 42 insertions(+), 13 deletions(-)
boot/bootmeth_cros.c +42 -13
index a551d43701d8..16a42ad46ae0 100644
@@ -59,6 +59,29 @@ enum {
 	X86_KERNEL_OFFSET = 0x4000,	/* kernel offset relative to base */
 };
 
+/**
+ * struct cros_priv - Private data
+ *
+ * This is read from the disk and recorded for use when the full kernel must
+ * be loaded and booted
+ *
+ * @body_offset: Offset of kernel body from start of partition (in bytes)
+ * @body_size: Size of kernel body in bytes
+ * @part_start: Block offset of selected partition from the start of the disk
+ * @body_load_address: Nominal load address for kernel body
+ * @bootloader_address: Address of bootloader, after body is loaded at
+ *	body_load_address
+ * @bootloader_size:  Size of bootloader in bytes
+ */
+struct cros_priv {
+	ulong body_offset;
+	ulong body_size;
+	lbaint_t part_start;
+	ulong body_load_address;
+	ulong bootloader_address;
+	ulong bootloader_size;
+};
+
 static int cros_check(struct udevice *dev, struct bootflow_iter *iter)
 {
 	/* This only works on block and network devices */
@@ -155,7 +178,7 @@ static int cros_read_bootflow(struct udevice *dev, struct bootflow *bflow)
 	struct blk_desc *desc = dev_get_uclass_plat(bflow->blk);
 	ulong base, setup, cmdline, num_blks, kern_base;
 	const struct vb2_kernel_preamble *preamble;
-	ulong body_offset, body_size;
+	struct cros_priv s_priv, *priv = &s_priv;
 	struct disk_partition info;
 	const char *uuid = NULL;
 	struct vb2_keyblock *hdr;
@@ -192,31 +215,37 @@ static int cros_read_bootflow(struct udevice *dev, struct bootflow *bflow)
 		  (ulong)preamble->bootloader_address,
 		  (ulong)preamble->bootloader_size);
 
-	body_offset = hdr->keyblock_size + preamble->preamble_size;
-	body_size = preamble->body_signature.data_size;
-	log_debug("Kernel body at %lx size %lx\n", body_offset, body_size);
-	bflow->size = body_size;
-
-	buf = memalign(SZ_1K, body_size);
+	priv->body_offset = hdr->keyblock_size + preamble->preamble_size;
+	priv->part_start = info.start;
+	priv->body_size = preamble->body_signature.data_size;
+	priv->body_load_address = preamble->body_load_address;
+	priv->bootloader_address = preamble->bootloader_address;
+	priv->bootloader_size = preamble->bootloader_size;
+	log_debug("Kernel body at %lx size %lx\n", priv->body_offset,
+		  priv->body_size);
+	bflow->size = priv->body_size;
+
+	buf = memalign(SZ_1K, priv->body_size);
 	if (!buf)
 		return log_msg_ret("buf", -ENOMEM);
 
 	/* Check that the header is not smaller than permitted */
-	if (body_offset < PROBE_SIZE)
+	if (priv->body_offset < PROBE_SIZE)
 		return log_msg_ret("san", EFAULT);
 
 	/* Read kernel body */
-	num_blks = body_size >> desc->log2blksz;
+	num_blks = priv->body_size >> desc->log2blksz;
 	log_debug("Reading body to %lx, blk=%s, size=%lx, blocks=%lx\n",
-		  (ulong)map_to_sysmem(buf), bflow->blk->name, body_size,
+		  (ulong)map_to_sysmem(buf), bflow->blk->name, priv->body_size,
 		  num_blks);
 	ret = blk_read(bflow->blk,
-		       info.start + (body_offset >> desc->log2blksz),
+		       priv->part_start +
+		       (priv->body_offset >> desc->log2blksz),
 		       num_blks, buf);
 	if (ret != num_blks)
 		return log_msg_ret("inf", -EIO);
-	base = map_to_sysmem(buf) + preamble->bootloader_address -
-		preamble->body_load_address;
+	base = map_to_sysmem(buf) + priv->bootloader_address -
+		priv->body_load_address;
 
 	setup = base + X86_SETUP_OFFSET;
 	cmdline = base + CMDLINE_OFFSET;
Signature · 1 line
2.41.0.487.g6d72f3e995-goog
#18 lore raw

Re: [PATCH 09/16] bootstd: cros: Add private info for ChromiumOS

Create a new private structure to hold information gleaned from the disk. This will allow separation between reading of the bootflow information and (later) reading the whole kernel.

---

 boot/bootmeth_cros.c | 55 +++++++++++++++++++++++++++++++++-----------
 1 file changed, 42 insertions(+), 13 deletions(-)

Applied to u-boot-dm/next, thanks!

#19 lore raw

PATCH 10/16 bootstd: Add private bootmeth data to the bootflow

In reply to Simon Glass

Some bootmeths need to store their own information related to the bootflow, in addition to the generic information in struct bootflow. Add a pointer for this.

---

 boot/bootflow.c    | 1 +
 include/bootflow.h | 2 ++
 2 files changed, 3 insertions(+)
boot/bootflow.c +1 -0
index 81b5829d5b37..daf862fac788 100644
@@ -432,6 +432,7 @@ void bootflow_free(struct bootflow *bflow)
 	free(bflow->buf);
 	free(bflow->os_name);
 	free(bflow->fdt_fname);
+	free(bflow->bootmeth_priv);
 }
 
 void bootflow_remove(struct bootflow *bflow)
include/bootflow.h +2 -0
index 4152577afb71..ff2bddb51515 100644
@@ -83,6 +83,7 @@ enum bootflow_flags_t {
  * @flags: Flags for the bootflow (see enum bootflow_flags_t)
  * @cmdline: OS command line, or NULL if not known (allocated)
  * @x86_setup: Pointer to x86 setup block inside @buf, NULL if not present
+ * @bootmeth_priv: Private data for the bootmeth
  */
 struct bootflow {
 	struct list_head bm_node;
@@ -108,6 +109,7 @@ struct bootflow {
 	int flags;
 	char *cmdline;
 	char *x86_setup;
+	void *bootmeth_priv;
 };
 
 /**
Signature · 1 line
2.41.0.487.g6d72f3e995-goog
#20 lore raw

Re: [PATCH 10/16] bootstd: Add private bootmeth data to the bootflow

Some bootmeths need to store their own information related to the bootflow, in addition to the generic information in struct bootflow. Add a pointer for this.

---

 boot/bootflow.c    | 1 +
 include/bootflow.h | 2 ++
 2 files changed, 3 insertions(+)

Applied to u-boot-dm/next, thanks!

#21 lore raw

PATCH 11/16 bootstd: cros: Add a function to read info from partition

In reply to Simon Glass

The code to read the ChromiumOS information from the partition is currently all in one function. It reads the entire kernel, which is unnecessary unless it is to be booted.

Create a new function which reads just the minimum required data from the disk, then obtains what it needs from there.

For now this function is not used. Future work will plumb it in.

---

 boot/bootmeth_cros.c | 121 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 121 insertions(+)
boot/bootmeth_cros.c +121 -0
index 16a42ad46ae0..82cbdcf2c93a 100644
@@ -72,6 +72,7 @@ enum {
  * @bootloader_address: Address of bootloader, after body is loaded at
  *	body_load_address
  * @bootloader_size:  Size of bootloader in bytes
+ * @info_buf: Buffer containing ChromiumOS info
  */
 struct cros_priv {
 	ulong body_offset;
@@ -80,6 +81,7 @@ struct cros_priv {
 	ulong body_load_address;
 	ulong bootloader_address;
 	ulong bootloader_size;
+	void *info_buf;
 };
 
 static int cros_check(struct udevice *dev, struct bootflow_iter *iter)
@@ -173,6 +175,125 @@ static int scan_part(struct udevice *blk, int partnum,
 	return 0;
 }
 
+/**
+ * cros_read_buf() - Read information into a buf and parse it
+ *
+ * @bflow: Bootflow to update
+ * @buf: Buffer to use
+ * @size: Size of buffer and number of bytes to read thereinto
+ * @start: Start offset to read from on disk
+ * @before_base: Number of bytes to read before the bootloader base
+ * @uuid: UUID string if supported, else NULL
+ * Return: 0 if OK, -ENOMEM if out of memory, -EIO on read failure
+ */
+static int cros_read_buf(struct bootflow *bflow, void *buf, ulong size,
+			 loff_t start, ulong before_base, const char *uuid)
+{
+	struct blk_desc *desc = dev_get_uclass_plat(bflow->blk);
+	ulong base, setup, cmdline, kern_base;
+	ulong num_blks;
+	int ret;
+
+	num_blks = size >> desc->log2blksz;
+	log_debug("Reading info to %lx, blk=%s, size=%lx, blocks=%lx\n",
+		  (ulong)map_to_sysmem(buf), bflow->blk->name, size, num_blks);
+	ret = blk_read(bflow->blk, start, num_blks, buf);
+	if (ret != num_blks)
+		return log_msg_ret("inf", -EIO);
+	base = map_to_sysmem(buf) + before_base;
+
+	setup = base + X86_SETUP_OFFSET;
+	cmdline = base + CMDLINE_OFFSET;
+	kern_base = base + X86_KERNEL_OFFSET;
+	log_debug("base %lx setup %lx cmdline %lx kern_base %lx\n", base,
+		  setup, cmdline, kern_base);
+
+#ifdef CONFIG_X86
+	const char *version;
+
+	version = zimage_get_kernel_version(map_sysmem(setup, 0),
+					    map_sysmem(kern_base, 0));
+	log_debug("version %s\n", version);
+	if (version)
+		bflow->name = strdup(version);
+#endif
+	if (!bflow->name)
+		bflow->name = strdup("ChromeOS");
+	if (!bflow->name)
+		return log_msg_ret("nam", -ENOMEM);
+	bflow->os_name = strdup("ChromeOS");
+	if (!bflow->os_name)
+		return log_msg_ret("os", -ENOMEM);
+
+	ret = copy_cmdline(map_sysmem(cmdline, 0), uuid, &bflow->cmdline);
+	if (ret)
+		return log_msg_ret("cmd", ret);
+	bflow->x86_setup = map_sysmem(setup, 0);
+
+	return 0;
+}
+
+/**
+ * cros_read_info() - Read information and fill out the bootflow
+ *
+ * @bflow: Bootflow to update
+ * @uuid: UUID string if supported, else NULL
+ * @preamble: Kernel preamble information
+ * Return: 0 if OK, -ENOMEM if out of memory, -EIO on read failure
+ */
+static int cros_read_info(struct bootflow *bflow, const char *uuid,
+			  const struct vb2_kernel_preamble *preamble)
+{
+	struct cros_priv *priv = bflow->bootmeth_priv;
+	struct udevice *blk = bflow->blk;
+	struct blk_desc *desc = dev_get_uclass_plat(blk);
+	ulong offset, size, before_base;
+	void *buf;
+	int ret;
+
+	log_debug("Kernel preamble at %lx, version major %x, minor %x\n",
+		  (ulong)map_to_sysmem(preamble),
+		  preamble->header_version_major,
+		  preamble->header_version_minor);
+
+	log_debug("  - load_address %lx, bl_addr %lx, bl_size %lx\n",
+		  (ulong)preamble->body_load_address,
+		  (ulong)preamble->bootloader_address,
+		  (ulong)preamble->bootloader_size);
+
+	priv->body_size = preamble->body_signature.data_size;
+	priv->body_load_address = preamble->body_load_address;
+	priv->bootloader_address = preamble->bootloader_address;
+	priv->bootloader_size = preamble->bootloader_size;
+	log_debug("Kernel body at %lx size %lx\n", priv->body_offset,
+		  priv->body_size);
+
+	/* Work out how many bytes to read before the bootloader base */
+	before_base = -CMDLINE_OFFSET;
+
+	/* Read the cmdline through to the end of the bootloader */
+	size = priv->bootloader_size + before_base;
+	offset = priv->body_offset +
+		(priv->bootloader_address - priv->body_load_address) +
+		CMDLINE_OFFSET;
+	buf = malloc(size);
+	if (!buf)
+		return log_msg_ret("buf", -ENOMEM);
+
+	ret = cros_read_buf(bflow, buf, size,
+			    priv->part_start + (offset >> desc->log2blksz),
+			    before_base, uuid);
+	if (ret) {
+		/* Clear this since the buffer is invalid */
+		bflow->x86_setup = NULL;
+		free(buf);
+		return log_msg_ret("pro", ret);
+	}
+	priv->info_buf = buf;
+
+	return 0;
+}
+
 static int cros_read_bootflow(struct udevice *dev, struct bootflow *bflow)
 {
 	struct blk_desc *desc = dev_get_uclass_plat(bflow->blk);
Signature · 1 line
2.41.0.487.g6d72f3e995-goog
#22 lore raw

Re: [PATCH 11/16] bootstd: cros: Add a function to read info from partition

The code to read the ChromiumOS information from the partition is currently all in one function. It reads the entire kernel, which is unnecessary unless it is to be booted.

Create a new function which reads just the minimum required data from the disk, then obtains what it needs from there.

For now this function is not used. Future work will plumb it in.

---

 boot/bootmeth_cros.c | 121 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 121 insertions(+)

Applied to u-boot-dm/next, thanks!

#23 lore raw

PATCH 12/16 bootstd: cros: Add a function to read a kernel

In reply to Simon Glass

The code to read the ChromiumOS information from the partition is currently all in one function.

Create a new function which reads the kernel, assuming that the metadata has been parsed.

For now this function is not used. Future work will plumb it in.

---

 boot/bootmeth_cros.c | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)
boot/bootmeth_cros.c +39 -0
index 82cbdcf2c93a..8728cd18e3c1 100644
@@ -294,6 +294,45 @@ static int cros_read_info(struct bootflow *bflow, const char *uuid,
 	return 0;
 }
 
+static int cros_read_kernel(struct bootflow *bflow)
+{
+	struct blk_desc *desc = dev_get_uclass_plat(bflow->blk);
+	struct cros_priv *priv = bflow->bootmeth_priv;
+	ulong base, setup;
+	ulong num_blks;
+	void *buf;
+	int ret;
+
+	bflow->size = priv->body_size;
+
+	buf = memalign(SZ_1K, priv->body_size);
+	if (!buf)
+		return log_msg_ret("buf", -ENOMEM);
+
+	/* Check that the header is not smaller than permitted */
+	if (priv->body_offset < PROBE_SIZE)
+		return log_msg_ret("san", EFAULT);
+
+	/* Read kernel body */
+	num_blks = priv->body_size >> desc->log2blksz;
+	log_debug("Reading body to %lx, blk=%s, size=%lx, blocks=%lx\n",
+		  (ulong)map_to_sysmem(buf), bflow->blk->name, priv->body_size,
+		  num_blks);
+	ret = blk_read(bflow->blk,
+		       priv->part_start + (priv->body_offset >> desc->log2blksz),
+		       num_blks, buf);
+	if (ret != num_blks)
+		return log_msg_ret("inf", -EIO);
+	base = map_to_sysmem(buf) + priv->bootloader_address -
+		priv->body_load_address;
+	setup = base + X86_SETUP_OFFSET;
+
+	bflow->buf = buf;
+	bflow->x86_setup = map_sysmem(setup, 0);
+
+	return 0;
+}
+
 static int cros_read_bootflow(struct udevice *dev, struct bootflow *bflow)
 {
 	struct blk_desc *desc = dev_get_uclass_plat(bflow->blk);
Signature · 1 line
2.41.0.487.g6d72f3e995-goog
#24 lore raw

Re: [PATCH 12/16] bootstd: cros: Add a function to read a kernel

The code to read the ChromiumOS information from the partition is currently all in one function.

Create a new function which reads the kernel, assuming that the metadata has been parsed.

For now this function is not used. Future work will plumb it in.

---

 boot/bootmeth_cros.c | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

Applied to u-boot-dm/next, thanks!

#25 lore raw

PATCH 13/16 bootstd: cros: Split up reading info and kernel

In reply to Simon Glass

Use the two new functions to separate reading of the ChromiumOS info from the partition from actually reading the kernel and booting it.

---

 boot/bootmeth_cros.c | 96 +++++++++++---------------------------------
 1 file changed, 23 insertions(+), 73 deletions(-)
boot/bootmeth_cros.c +23 -73
index 8728cd18e3c1..06709dd9171c 100644
@@ -335,15 +335,12 @@ static int cros_read_kernel(struct bootflow *bflow)
 
 static int cros_read_bootflow(struct udevice *dev, struct bootflow *bflow)
 {
-	struct blk_desc *desc = dev_get_uclass_plat(bflow->blk);
-	ulong base, setup, cmdline, num_blks, kern_base;
 	const struct vb2_kernel_preamble *preamble;
-	struct cros_priv s_priv, *priv = &s_priv;
 	struct disk_partition info;
-	const char *uuid = NULL;
 	struct vb2_keyblock *hdr;
+	const char *uuid = NULL;
+	struct cros_priv *priv;
 	int part, ret;
-	void *buf;
 
 	log_debug("starting, part=%d\n", bflow->part);
 
@@ -362,84 +359,32 @@ static int cros_read_bootflow(struct udevice *dev, struct bootflow *bflow)
 	}
 	bflow->part = part;
 
-	log_info("Selected parition %d, header at %lx\n", bflow->part,
-		 (ulong)map_to_sysmem(hdr));
-	preamble = (void *)hdr + hdr->keyblock_size;
-	log_debug("Kernel preamble at %lx, version major %x, minor %x\n",
-		  (ulong)map_to_sysmem(preamble),
-		  preamble->header_version_major,
-		  preamble->header_version_minor);
+	priv = malloc(sizeof(struct cros_priv));
+	if (!priv) {
+		free(hdr);
+		return log_msg_ret("buf", -ENOMEM);
+	}
+	bflow->bootmeth_priv = priv;
 
-	log_debug("  - load_address %lx, bl_addr %lx, bl_size %lx\n",
-		  (ulong)preamble->body_load_address,
-		  (ulong)preamble->bootloader_address,
-		  (ulong)preamble->bootloader_size);
+	log_info("Selected partition %d, header at %lx\n", bflow->part,
+		 (ulong)map_to_sysmem(hdr));
 
+	/* Grab a few things from the preamble */
+	preamble = (void *)hdr + hdr->keyblock_size;
 	priv->body_offset = hdr->keyblock_size + preamble->preamble_size;
 	priv->part_start = info.start;
-	priv->body_size = preamble->body_signature.data_size;
-	priv->body_load_address = preamble->body_load_address;
-	priv->bootloader_address = preamble->bootloader_address;
-	priv->bootloader_size = preamble->bootloader_size;
-	log_debug("Kernel body at %lx size %lx\n", priv->body_offset,
-		  priv->body_size);
-	bflow->size = priv->body_size;
-
-	buf = memalign(SZ_1K, priv->body_size);
-	if (!buf)
-		return log_msg_ret("buf", -ENOMEM);
-
-	/* Check that the header is not smaller than permitted */
-	if (priv->body_offset < PROBE_SIZE)
-		return log_msg_ret("san", EFAULT);
-
-	/* Read kernel body */
-	num_blks = priv->body_size >> desc->log2blksz;
-	log_debug("Reading body to %lx, blk=%s, size=%lx, blocks=%lx\n",
-		  (ulong)map_to_sysmem(buf), bflow->blk->name, priv->body_size,
-		  num_blks);
-	ret = blk_read(bflow->blk,
-		       priv->part_start +
-		       (priv->body_offset >> desc->log2blksz),
-		       num_blks, buf);
-	if (ret != num_blks)
-		return log_msg_ret("inf", -EIO);
-	base = map_to_sysmem(buf) + priv->bootloader_address -
-		priv->body_load_address;
-
-	setup = base + X86_SETUP_OFFSET;
-	cmdline = base + CMDLINE_OFFSET;
-	kern_base = base + X86_KERNEL_OFFSET;
-	log_debug("base %lx setup %lx cmdline %lx kern_base %lx\n", base,
-		  setup, cmdline, kern_base);
-
-#ifdef CONFIG_X86
-	const char *version;
-
-	version = zimage_get_kernel_version(map_sysmem(setup, 0),
-					    map_sysmem(kern_base, 0));
-	log_debug("version %s\n", version);
-	if (version)
-		bflow->name = strdup(version);
-#endif
-	if (!bflow->name)
-		bflow->name = strdup("ChromeOS");
-	if (!bflow->name)
-		return log_msg_ret("nam", -ENOMEM);
-	bflow->os_name = strdup("ChromeOS");
-	if (!bflow->os_name)
-		return log_msg_ret("os", -ENOMEM);
 
+	/* Now read everything we can learn about kernel */
 #if CONFIG_IS_ENABLED(PARTITION_UUIDS)
 	uuid = info.uuid;
 #endif
-	ret = copy_cmdline(map_sysmem(cmdline, 0), uuid, &bflow->cmdline);
+	ret = cros_read_info(bflow, uuid, preamble);
+	preamble = NULL;
+	free(hdr);
 	if (ret)
-		return log_msg_ret("cmd", ret);
-
+		return log_msg_ret("inf", ret);
+	bflow->size = priv->body_size;
 	bflow->state = BOOTFLOWST_READY;
-	bflow->buf = buf;
-	bflow->x86_setup = map_sysmem(setup, 0);
 
 	return 0;
 }
@@ -452,6 +397,11 @@ static int cros_read_file(struct udevice *dev, struct bootflow *bflow,
 
 static int cros_boot(struct udevice *dev, struct bootflow *bflow)
 {
+	int ret;
+
+	ret = cros_read_kernel(bflow);
+	if (ret)
+		return log_msg_ret("rd", ret);
 #ifdef CONFIG_X86
 	zboot_start(map_to_sysmem(bflow->buf), bflow->size, 0, 0,
 		    map_to_sysmem(bflow->x86_setup),
Signature · 1 line
2.41.0.487.g6d72f3e995-goog
#26 lore raw

Re: [PATCH 13/16] bootstd: cros: Split up reading info and kernel

Use the two new functions to separate reading of the ChromiumOS info from the partition from actually reading the kernel and booting it.

---

 boot/bootmeth_cros.c | 96 +++++++++++---------------------------------
 1 file changed, 23 insertions(+), 73 deletions(-)

Applied to u-boot-dm/next, thanks!

#27 lore raw

PATCH 14/16 bootstd: Allow display of the x86 setup information

In reply to Simon Glass

Provide an option to dump this information if available.

Move the funciion prototype to the common x86 header. Allow the command line to be left out since 'bootflow info' show this itself and it is not in the correct place in memory until the kernel is actually booted.

Fix a badly aligned heading while we are here.

---

 arch/x86/include/asm/zimage.h | 10 ------
 arch/x86/lib/zimage.c         |  8 ++---
 cmd/bootflow.c                | 14 +++++++--
 doc/usage/cmd/bootflow.rst    | 59 ++++++++++++++++++++++++++++++++++-
 include/bootflow.h            |  2 +-
 include/bootm.h               | 11 +++++++
 6 files changed, 86 insertions(+), 18 deletions(-)
arch/x86/include/asm/zimage.h +0 -10
index 000b38ea8993..655675b66614 100644
@@ -62,14 +62,4 @@ struct boot_params *load_zimage(char *image, unsigned long kernel_size,
 int setup_zimage(struct boot_params *setup_base, char *cmd_line, int auto_boot,
 		 ulong initrd_addr, ulong initrd_size, ulong cmdline_force);
 
-/**
- * zimage_dump() - Dump the metadata of a zimage
- *
- * This shows all available information in a zimage that has been loaded.
- *
- * @base_ptr: Pointer to the boot parameters, typically at address
- *	DEFAULT_SETUP_BASE
- */
-void zimage_dump(struct boot_params *base_ptr);
-
 #endif
arch/x86/lib/zimage.c +4 -4
index 062e3d3e3151..a41e1ccf8a65 100644
@@ -692,7 +692,7 @@ static void show_loader(struct setup_header *hdr)
 	printf("\n");
 }
 
-void zimage_dump(struct boot_params *base_ptr)
+void zimage_dump(struct boot_params *base_ptr, bool show_cmdline)
 {
 	struct setup_header *hdr;
 	const char *version;
@@ -703,7 +703,7 @@ void zimage_dump(struct boot_params *base_ptr)
 
 	printf("E820: %d entries\n", base_ptr->e820_entries);
 	if (base_ptr->e820_entries) {
-		printf("%18s  %16s  %s\n", "Addr", "Size", "Type");
+		printf("%12s  %10s  %s\n", "Addr", "Size", "Type");
 		for (i = 0; i < base_ptr->e820_entries; i++) {
 			struct e820_entry *entry = &base_ptr->e820_map[i];
 
@@ -749,7 +749,7 @@ void zimage_dump(struct boot_params *base_ptr)
 	print_num("Ext loader ver", hdr->ext_loader_ver);
 	print_num("Ext loader type", hdr->ext_loader_type);
 	print_num("Command line ptr", hdr->cmd_line_ptr);
-	if (hdr->cmd_line_ptr) {
+	if (show_cmdline && hdr->cmd_line_ptr) {
 		printf("   ");
 		/* Use puts() to avoid limits from CONFIG_SYS_PBSIZE */
 		puts((char *)(ulong)hdr->cmd_line_ptr);
@@ -787,7 +787,7 @@ static int do_zboot_dump(struct cmd_tbl *cmdtp, int flag, int argc,
 		printf("No zboot setup_base\n");
 		return CMD_RET_FAILURE;
 	}
-	zimage_dump(base_ptr);
+	zimage_dump(base_ptr, true);
 
 	return 0;
 }
cmd/bootflow.c +12 -2
index c0aa4f84fe8d..9562832ce438 100644
@@ -9,6 +9,7 @@
 #include <common.h>
 #include <bootdev.h>
 #include <bootflow.h>
+#include <bootm.h>
 #include <bootstd.h>
 #include <command.h>
 #include <console.h>
@@ -303,11 +304,14 @@ static int do_bootflow_info(struct cmd_tbl *cmdtp, int flag, int argc,
 {
 	struct bootstd_priv *std;
 	struct bootflow *bflow;
+	bool x86_setup = false;
 	bool dump = false;
 	int ret;
 
-	if (argc > 1 && *argv[1] == '-')
+	if (argc > 1 && *argv[1] == '-') {
 		dump = strchr(argv[1], 'd');
+		x86_setup = strchr(argv[1], 's');
+	}
 
 	ret = bootstd_get_priv(&std);
 	if (ret)
@@ -319,6 +323,12 @@ static int do_bootflow_info(struct cmd_tbl *cmdtp, int flag, int argc,
 	}
 	bflow = std->cur_bootflow;
 
+	if (IS_ENABLED(CONFIG_X86) && x86_setup) {
+		zimage_dump(bflow->x86_setup, false);
+
+		return 0;
+	}
+
 	printf("Name:      %s\n", bflow->name);
 	printf("Device:    %s\n", bflow->dev->name);
 	printf("Block dev: %s\n", bflow->blk ? bflow->blk->name : "(none)");
@@ -508,7 +518,7 @@ static char bootflow_help_text[] =
 	"scan [-abeGl] [bdev]  - scan for valid bootflows (-l list, -a all, -e errors, -b boot, -G no global)\n"
 	"bootflow list [-e]             - list scanned bootflows (-e errors)\n"
 	"bootflow select [<num>|<name>] - select a bootflow\n"
-	"bootflow info [-d]             - show info on current bootflow (-d dump bootflow)\n"
+	"bootflow info [-ds]            - show info on current bootflow (-d dump bootflow)\n"
 	"bootflow boot                  - boot current bootflow (or first available if none selected)\n"
 	"bootflow menu [-t]             - show a menu of available bootflows\n"
 	"bootflow cmdline [set|get|clear|delete|auto] <param> [<value>] - update cmdline";
doc/usage/cmd/bootflow.rst +58 -1

77 lines not on this page · raw message

include/bootflow.h +1 -1
index ff2bddb51515..fdcfeddc1a63 100644
@@ -108,7 +108,7 @@ struct bootflow {
 	ulong fdt_addr;
 	int flags;
 	char *cmdline;
-	char *x86_setup;
+	void *x86_setup;
 	void *bootmeth_priv;
 };
 
include/bootm.h +11 -0
index 6fe418e00272..92870ff1a206 100644
@@ -152,4 +152,15 @@ int zboot_start(ulong addr, ulong size, ulong initrd, ulong initrd_size,
 const char *zimage_get_kernel_version(struct boot_params *params,
 				      void *kernel_base);
 
+/**
+ * zimage_dump() - Dump the metadata of a zimage
+ *
+ * This shows all available information in a zimage that has been loaded.
+ *
+ * @base_ptr: Pointer to the boot parameters, typically at address
+ *	DEFAULT_SETUP_BASE
+ * @show_cmdline: true to show the full command line
+ */
+void zimage_dump(struct boot_params *base_ptr, bool show_cmdline);
+
 #endif
Signature · 1 line
2.41.0.487.g6d72f3e995-goog
#28 lore raw

Re: [PATCH 14/16] bootstd: Allow display of the x86 setup information

Provide an option to dump this information if available.

Move the funciion prototype to the common x86 header. Allow the command line to be left out since 'bootflow info' show this itself and it is not in the correct place in memory until the kernel is actually booted.

Fix a badly aligned heading while we are here.

---

 arch/x86/include/asm/zimage.h | 10 ------
 arch/x86/lib/zimage.c         |  8 ++---
 cmd/bootflow.c                | 14 +++++++--
 doc/usage/cmd/bootflow.rst    | 59 ++++++++++++++++++++++++++++++++++-
 include/bootflow.h            |  2 +-
 include/bootm.h               | 11 +++++++
 6 files changed, 86 insertions(+), 18 deletions(-)

Applied to u-boot-dm/next, thanks!

#29 lore raw

PATCH 15/16 bootstd: Add a command to read all files for a bootflow

In reply to Simon Glass

Some bootflows (such as EFI and ChromiumOS) delay reading the kernel until it is needed to boot. This saves time when scanning and avoids needing to allocate memory for something that may never be used.

To permit reading of these files, add a new 'bootflow read' command.

---

 boot/bootflow.c            | 14 +++++++
 boot/bootmeth-uclass.c     | 10 +++++
 boot/bootmeth_cros.c       | 18 ++++++++-
 cmd/bootflow.c             | 33 +++++++++++++++-
 doc/usage/cmd/bootflow.rst | 80 +++++++++++++++++++++++++++++++++++++-
 include/bootflow.h         | 11 ++++++
 include/bootmeth.h         | 23 +++++++++++
 7 files changed, 186 insertions(+), 3 deletions(-)
boot/bootflow.c +14 -0
index daf862fac788..815eaa4136bb 100644
@@ -445,6 +445,20 @@ void bootflow_remove(struct bootflow *bflow)
 	free(bflow);
 }
 
+int bootflow_read_all(struct bootflow *bflow)
+{
+	int ret;
+
+	if (bflow->state != BOOTFLOWST_READY)
+		return log_msg_ret("rd", -EPROTO);
+
+	ret = bootmeth_read_all(bflow->method, bflow);
+	if (ret)
+		return log_msg_ret("rd2", ret);
+
+	return 0;
+}
+
 int bootflow_boot(struct bootflow *bflow)
 {
 	int ret;
boot/bootmeth-uclass.c +10 -0
index eeded08dd428..4cc3d90d20be 100644
@@ -61,6 +61,16 @@ int bootmeth_set_bootflow(struct udevice *dev, struct bootflow *bflow,
 	return ops->set_bootflow(dev, bflow, buf, size);
 }
 
+int bootmeth_read_all(struct udevice *dev, struct bootflow *bflow)
+{
+	const struct bootmeth_ops *ops = bootmeth_get_ops(dev);
+
+	if (!ops->read_all)
+		return -ENOSYS;
+
+	return ops->read_all(dev, bflow);
+}
+
 int bootmeth_boot(struct udevice *dev, struct bootflow *bflow)
 {
 	const struct bootmeth_ops *ops = bootmeth_get_ops(dev);
boot/bootmeth_cros.c +17 -1
index 06709dd9171c..570e7028329c 100644
@@ -395,13 +395,28 @@ static int cros_read_file(struct udevice *dev, struct bootflow *bflow,
 	return -ENOSYS;
 }
 
-static int cros_boot(struct udevice *dev, struct bootflow *bflow)
+static int cros_read_all(struct udevice *dev, struct bootflow *bflow)
 {
 	int ret;
 
+	if (bflow->buf)
+		return log_msg_ret("ld", -EALREADY);
 	ret = cros_read_kernel(bflow);
 	if (ret)
 		return log_msg_ret("rd", ret);
+
+	return 0;
+}
+
+static int cros_boot(struct udevice *dev, struct bootflow *bflow)
+{
+	int ret;
+
+	if (!bflow->buf) {
+		ret = cros_read_kernel(bflow);
+		if (ret)
+			return log_msg_ret("rd", ret);
+	}
 #ifdef CONFIG_X86
 	zboot_start(map_to_sysmem(bflow->buf), bflow->size, 0, 0,
 		    map_to_sysmem(bflow->x86_setup),
@@ -425,6 +440,7 @@ static struct bootmeth_ops cros_bootmeth_ops = {
 	.read_bootflow	= cros_read_bootflow,
 	.read_file	= cros_read_file,
 	.boot		= cros_boot,
+	.read_all	= cros_read_all,
 };
 
 static const struct udevice_id cros_bootmeth_ids[] = {
cmd/bootflow.c +32 -1
index 9562832ce438..3c3abaf8a3b2 100644
@@ -379,6 +379,35 @@ static int do_bootflow_info(struct cmd_tbl *cmdtp, int flag, int argc,
 	return 0;
 }
 
+static int do_bootflow_read(struct cmd_tbl *cmdtp, int flag, int argc,
+			    char *const argv[])
+{
+	struct bootstd_priv *std;
+	struct bootflow *bflow;
+	int ret;
+
+	ret = bootstd_get_priv(&std);
+	if (ret)
+		return CMD_RET_FAILURE;
+
+	/*
+	 * Require a current bootflow. Users can use 'bootflow scan -b' to
+	 * automatically scan and boot, if needed.
+	 */
+	if (!std->cur_bootflow) {
+		printf("No bootflow selected\n");
+		return CMD_RET_FAILURE;
+	}
+	bflow = std->cur_bootflow;
+	ret = bootflow_read_all(bflow);
+	if (ret) {
+		printf("Failed: err=%dE\n", ret);
+		return CMD_RET_FAILURE;
+	}
+
+	return 0;
+}
+
 static int do_bootflow_boot(struct cmd_tbl *cmdtp, int flag, int argc,
 			    char *const argv[])
 {
@@ -519,7 +548,8 @@ static char bootflow_help_text[] =
 	"bootflow list [-e]             - list scanned bootflows (-e errors)\n"
 	"bootflow select [<num>|<name>] - select a bootflow\n"
 	"bootflow info [-ds]            - show info on current bootflow (-d dump bootflow)\n"
-	"bootflow boot                  - boot current bootflow (or first available if none selected)\n"
+	"bootflow read                  - read all current-bootflow files\n"
+	"bootflow boot                  - boot current bootflow\n"
 	"bootflow menu [-t]             - show a menu of available bootflows\n"
 	"bootflow cmdline [set|get|clear|delete|auto] <param> [<value>] - update cmdline";
 #else
@@ -533,6 +563,7 @@ U_BOOT_CMD_WITH_SUBCMDS(bootflow, "Boot flows", bootflow_help_text,
 	U_BOOT_SUBCMD_MKENT(list, 2, 1, do_bootflow_list),
 	U_BOOT_SUBCMD_MKENT(select, 2, 1, do_bootflow_select),
 	U_BOOT_SUBCMD_MKENT(info, 2, 1, do_bootflow_info),
+	U_BOOT_SUBCMD_MKENT(read, 1, 1, do_bootflow_read),
 	U_BOOT_SUBCMD_MKENT(boot, 1, 1, do_bootflow_boot),
 	U_BOOT_SUBCMD_MKENT(menu, 2, 1, do_bootflow_menu),
 	U_BOOT_SUBCMD_MKENT(cmdline, 4, 1, do_bootflow_cmdline),
doc/usage/cmd/bootflow.rst +79 -1

101 lines not on this page · raw message

include/bootflow.h +11 -0
index fdcfeddc1a63..44d3741eacae 100644
@@ -352,6 +352,17 @@ void bootflow_free(struct bootflow *bflow);
  */
 int bootflow_boot(struct bootflow *bflow);
 
+/**
+ * bootflow_read_all() - Read all bootflow files
+ *
+ * Some bootmeths delay reading of large files until booting is requested. This
+ * causes those files to be read.
+ *
+ * @bflow: Bootflow to read
+ * Return: result of trying to read
+ */
+int bootflow_read_all(struct bootflow *bflow);
+
 /**
  * bootflow_run_boot() - Try to boot a bootflow
  *
include/bootmeth.h +23 -0
index c3df9702e871..4beca16793bc 100644
@@ -120,6 +120,15 @@ struct bootmeth_ops {
 	int (*read_file)(struct udevice *dev, struct bootflow *bflow,
 			 const char *file_path, ulong addr, ulong *sizep);
 
+	/**
+	 * readall() - read all files for a bootflow
+	 *
+	 * @dev:	Bootmethod device to boot
+	 * @bflow:	Bootflow to read
+	 * Return: 0 if OK, -EIO on I/O error, other -ve on other error
+	 */
+	int (*read_all)(struct udevice *dev, struct bootflow *bflow);
+
 	/**
 	 * boot() - boot a bootflow
 	 *
@@ -223,6 +232,20 @@ int bootmeth_set_bootflow(struct udevice *dev, struct bootflow *bflow,
 int bootmeth_read_file(struct udevice *dev, struct bootflow *bflow,
 		       const char *file_path, ulong addr, ulong *sizep);
 
+/**
+ * bootmeth_read_all() - read all bootflow files
+ *
+ * Some bootmeths delay reading of large files until booting is requested. This
+ * causes those files to be read.
+ *
+ * @dev:	Bootmethod device to use
+ * @bflow:	Bootflow to read
+ * Return: does not return on success, since it should boot the
+ *	Operating Systemn. Returns -EFAULT if that fails, other -ve on
+ *	other error
+ */
+int bootmeth_read_all(struct udevice *dev, struct bootflow *bflow);
+
 /**
  * bootmeth_boot() - boot a bootflow
  *
Signature · 1 line
2.41.0.487.g6d72f3e995-goog
#30 lore raw

PATCH 16/16 bootstd: cros: Add ARM support

In reply to Simon Glass

Support booting ChromiumOS on ARM devices using FIT. Add an entry into the boot implementation which does not require a command line. This can be expanded over time as the bootm code is refactored.

---

 boot/Kconfig         |  4 ++--
 boot/bootm.c         | 37 +++++++++++++++++++++++++++++++++++++
 boot/bootmeth_cros.c | 16 ++++++++++------
 include/bootm.h      |  8 ++++++++
 4 files changed, 57 insertions(+), 8 deletions(-)
boot/Kconfig +2 -2
index e8fb03b80168..6fb5b1e8b430 100644
@@ -464,8 +464,8 @@ config BOOTMETH_GLOBAL
 
 config BOOTMETH_CROS
 	bool "Bootdev support for Chromium OS"
-	depends on X86 || SANDBOX
-	default y
+	depends on X86 || ARM || SANDBOX
+	default y if !ARM
 	help
 	  Enables support for booting Chromium OS using bootdevs. This uses the
 	  kernel A slot and obtains the kernel command line from the parameters
boot/bootm.c +37 -0
index 75f0b4a9af8a..b1c3afe0a3ad 100644
@@ -823,6 +823,43 @@ err:
 	return ret;
 }
 
+int bootm_boot_start(ulong addr, const char *cmdline)
+{
+	static struct cmd_tbl cmd = {"bootm"};
+	char addr_str[30];
+	char *argv[] = {addr_str, NULL};
+	int states;
+	int ret;
+
+	/*
+	 * TODO([email protected]): This uses the command-line interface, but
+	 * should not. To clean this up, the various bootm states need to be
+	 * passed an info structure instead of cmdline flags. Then this can
+	 * set up the required info and move through the states without needing
+	 * the command line.
+	 */
+	states = BOOTM_STATE_START | BOOTM_STATE_FINDOS | BOOTM_STATE_PRE_LOAD |
+		BOOTM_STATE_FINDOTHER | BOOTM_STATE_LOADOS |
+		BOOTM_STATE_OS_PREP | BOOTM_STATE_OS_FAKE_GO |
+		BOOTM_STATE_OS_GO;
+	if (IS_ENABLED(CONFIG_SYS_BOOT_RAMDISK_HIGH))
+		states |= BOOTM_STATE_RAMDISK;
+	if (IS_ENABLED(CONFIG_PPC) || IS_ENABLED(CONFIG_MIPS))
+		states |= BOOTM_STATE_OS_CMDLINE;
+	images.state |= states;
+
+	snprintf(addr_str, sizeof(addr_str), "%lx", addr);
+
+	ret = env_set("bootargs", cmdline);
+	if (ret) {
+		printf("Failed to set cmdline\n");
+		return ret;
+	}
+	ret = do_bootm_states(&cmd, 0, 1, argv, states, &images, 1);
+
+	return ret;
+}
+
 #if CONFIG_IS_ENABLED(LEGACY_IMAGE_FORMAT)
 /**
  * image_get_kernel - verify legacy format kernel image
boot/bootmeth_cros.c +10 -6
index 570e7028329c..da9bb6b4281c 100644
@@ -417,13 +417,17 @@ static int cros_boot(struct udevice *dev, struct bootflow *bflow)
 		if (ret)
 			return log_msg_ret("rd", ret);
 	}
-#ifdef CONFIG_X86
-	zboot_start(map_to_sysmem(bflow->buf), bflow->size, 0, 0,
-		    map_to_sysmem(bflow->x86_setup),
-		    bflow->cmdline);
-#endif
 
-	return log_msg_ret("go", -EFAULT);
+	if (IS_ENABLED(CONFIG_X86)) {
+		ret = zboot_start(map_to_sysmem(bflow->buf), bflow->size, 0, 0,
+				  map_to_sysmem(bflow->x86_setup),
+				  bflow->cmdline);
+	} else {
+		ret = bootm_boot_start(map_to_sysmem(bflow->buf),
+				       bflow->cmdline);
+	}
+
+	return log_msg_ret("go", ret);
 }
 
 static int cros_bootmeth_bind(struct udevice *dev)
include/bootm.h +8 -0
index 92870ff1a206..c3c7336207b1 100644
@@ -163,4 +163,12 @@ const char *zimage_get_kernel_version(struct boot_params *params,
  */
 void zimage_dump(struct boot_params *base_ptr, bool show_cmdline);
 
+/*
+ * bootm_boot_start() - Boot an image at the given address
+ *
+ * @addr: Image address
+ * @cmdline: Command line to set
+ */
+int bootm_boot_start(ulong addr, const char *cmdline);
+
 #endif
Signature · 1 line
2.41.0.487.g6d72f3e995-goog
#31 lore raw

Re: [PATCH 16/16] bootstd: cros: Add ARM support

Support booting ChromiumOS on ARM devices using FIT. Add an entry into the boot implementation which does not require a command line. This can be expanded over time as the bootm code is refactored.

---

 boot/Kconfig         |  4 ++--
 boot/bootm.c         | 37 +++++++++++++++++++++++++++++++++++++
 boot/bootmeth_cros.c | 16 ++++++++++------
 include/bootm.h      |  8 ++++++++
 4 files changed, 57 insertions(+), 8 deletions(-)

Applied to u-boot-dm/next, thanks!

#32 lore raw
In reply to Simon Glass

Hi Simon,

Quoted 8 lines · Simon Glass

The ChromiumOS bootmeth is fairly basic at present. It is able to boot only x86 kernels and contains quite a few hard-coded offsets.

This series tidies it up by bringing in some vboot structures and adding support for ARM.

It adds a few more features to bootstd, including display of x86 setup information.

Can't do a detailed review or test for a while, but had a cursory look now and wanted to reply. I'm not sure if you heard of it, but I maintain an alternate implementation of ChromiumOS verified boot userspace called depthcharge-tools [1]. Its main purpose is booting ordinary distros on Chromebooks, but it would be nice if your U-Boot implementation was also compatible with images produced from that.

I guess it boils down to:

- Enable booting from any chromeos_kernel partition (not just 2 & 4)
- Fixup the ramdisk addr/size in x86 setup info after reading the kernel
- Replace %U with chromeos_kernel PARTUUID (you probably already do?)
- Prepend cros_secure to kernel cmdline

There's a ready made debian-installer image if you want to test [2]. Has a partitioning bug defaulting to MBR, but otherwise can install for CrOS verified boot as well. (It's what took my last year away from U-Boot).

[1] depthcharge-tools -- Tools to manage the Chrome OS bootloader
https://github.com/alpernebbi/depthcharge-tools

[2] Debian Installer netboot image for amd64 Chromebooks
https://d-i.debian.org/daily-images/amd64/daily/netboot/depthcharge/

Quoted 6 lines

So far this does not actually boot correctly on any ARM Chromebook:

jerry - hangs when booting kernel
bob - Bad Linux ARM64 Image magic! with lz4-compressed kernel

Further work can address these issues.

I haven't been able to boot recent kernels with extlinux.conf on my pre-bootstd kevin U-Boot builds which I remember were working with older kernels. And I've heard people not being boot with extlinux.conf on veyrons as well. Might be the same, maybe try an older kernel for jerry?

Again, there's a debian-installer arm64 image if you want to test [3], which could work fine on bob (not with depthcharge's size limit though), but kernel support is missing for anything else.

Oh, and postmarketOS also supports CrOS verified boot [4] via depthcharge-tools, but they don't have pre-built images and it's a bit of a hassle.

[3] Debian Installer netboot image for arm64 Chromebooks
https://d-i.debian.org/daily-images/arm64/daily/netboot/depthcharge/

[4] postmarketOS Wiki - Chrome OS devices
https://wiki.postmarketos.org/wiki/Chrome_OS_devices

Anyway, I'm glad you're working on this, looking forward to testing it myself when I get the chance!

Quoted 34 lines

Simon Glass (16):
bootstd: cros: Correct reporting of I/O errors
bootstd: cros: Move partition reading into a function
bootstd: cros: Bring in some ChromiumOS structures
bootstd: cros: Support a kernel on either partition
bootstd: cros: Decode some kernel preamble fields
bootstd: cros: Simplify setup and cmdline expressions
bootstd: Move common zimage functions to bootm.h
bootstd: cros: Add docs for the kernel layout
bootstd: cros: Add private info for ChromiumOS
bootstd: Add private bootmeth data to the bootflow
bootstd: cros: Add a function to read info from partition
bootstd: cros: Add a function to read a kernel
bootstd: cros: Split up reading info and kernel
bootstd: Allow display of the x86 setup information
bootstd: Add a command to read all files for a bootflow
bootstd: cros: Add ARM support

 arch/x86/include/asm/zimage.h |  37 ----
 arch/x86/lib/zimage.c         |   8 +-
 boot/Kconfig                  |   4 +-
 boot/bootflow.c               |  15 ++
 boot/bootm.c                  |  37 ++++
 boot/bootmeth-uclass.c        |  10 +
 boot/bootmeth_cros.c          | 363 ++++++++++++++++++++++++++++------
 boot/bootmeth_cros.h          | 197 ++++++++++++++++++
 cmd/bootflow.c                |  47 ++++-
 doc/usage/cmd/bootflow.rst    | 139 ++++++++++++-
 include/bootflow.h            |  15 +-
 include/bootm.h               |  47 +++++
 include/bootmeth.h            |  23 +++
 13 files changed, 836 insertions(+), 106 deletions(-)
 create mode 100644 boot/bootmeth_cros.h
#33 lore raw

Hi Alper,

Quoted 20 lines · Alper Nebi Yasak

Hi Simon,

Quoted 8 lines · Simon Glass

The ChromiumOS bootmeth is fairly basic at present. It is able to boot only x86 kernels and contains quite a few hard-coded offsets.

This series tidies it up by bringing in some vboot structures and adding support for ARM.

It adds a few more features to bootstd, including display of x86 setup information.

Can't do a detailed review or test for a while, but had a cursory look now and wanted to reply. I'm not sure if you heard of it, but I maintain an alternate implementation of ChromiumOS verified boot userspace called depthcharge-tools [1]. Its main purpose is booting ordinary distros on Chromebooks, but it would be nice if your U-Boot implementation was also compatible with images produced from that.

Quoted 3 lines

I guess it boils down to:

- Enable booting from any chromeos_kernel partition (not just 2 & 4)

How do you know which ones hold kernels, and which root disks correspond to each kernel?

Quoted 1 line

- Fixup the ramdisk addr/size in x86 setup info after reading the kernel

But ChromeOS doesn't use ramdisk, right?

Quoted 1 line

- Replace %U with chromeos_kernel PARTUUID (you probably already do?)

Yes.

Quoted 1 line

- Prepend cros_secure to kernel cmdline

Does it have to be at the start of the cmdline? Also, the cmdline comes from cros at present, so does include that normally. I think the best way is for you to give it a try and see what is needed.

Quoted 10 lines

There's a ready made debian-installer image if you want to test [2]. Has a partitioning bug defaulting to MBR, but otherwise can install for CrOS verified boot as well. (It's what took my last year away from U-Boot).

[1] depthcharge-tools -- Tools to manage the Chrome OS bootloader
https://github.com/alpernebbi/depthcharge-tools

[2] Debian Installer netboot image for amd64 Chromebooks
https://d-i.debian.org/daily-images/amd64/daily/netboot/depthcharge/

I see the installer, but how do I actually run it on bob, say?

Quoted 6 lines
Quoted 6 lines

So far this does not actually boot correctly on any ARM Chromebook:

jerry - hangs when booting kernel
bob - Bad Linux ARM64 Image magic! with lz4-compressed kernel

Quoted 6 lines
Quoted 1 line

Further work can address these issues.

I haven't been able to boot recent kernels with extlinux.conf on my pre-bootstd kevin U-Boot builds which I remember were working with older kernels. And I've heard people not being boot with extlinux.conf on veyrons as well. Might be the same, maybe try an older kernel for jerry?

Ah OK I haven't tried that.

Quoted 9 lines

Again, there's a debian-installer arm64 image if you want to test [3], which could work fine on bob (not with depthcharge's size limit though), but kernel support is missing for anything else.

Oh, and postmarketOS also supports CrOS verified boot [4] via depthcharge-tools, but they don't have pre-built images and it's a bit of a hassle.

Quoted 8 lines

[3] Debian Installer netboot image for arm64 Chromebooks
https://d-i.debian.org/daily-images/arm64/daily/netboot/depthcharge/

[4] postmarketOS Wiki - Chrome OS devices
https://wiki.postmarketos.org/wiki/Chrome_OS_devices

Anyway, I'm glad you're working on this, looking forward to testing it myself when I get the chance!

Great! I hope that the bootmeth can expand to be more useful over time.

Regards,
Simon

Quoted 35 lines
Quoted 35 lines

Simon Glass (16):
bootstd: cros: Correct reporting of I/O errors
bootstd: cros: Move partition reading into a function
bootstd: cros: Bring in some ChromiumOS structures
bootstd: cros: Support a kernel on either partition
bootstd: cros: Decode some kernel preamble fields
bootstd: cros: Simplify setup and cmdline expressions
bootstd: Move common zimage functions to bootm.h
bootstd: cros: Add docs for the kernel layout
bootstd: cros: Add private info for ChromiumOS
bootstd: Add private bootmeth data to the bootflow
bootstd: cros: Add a function to read info from partition
bootstd: cros: Add a function to read a kernel
bootstd: cros: Split up reading info and kernel
bootstd: Allow display of the x86 setup information
bootstd: Add a command to read all files for a bootflow
bootstd: cros: Add ARM support

 arch/x86/include/asm/zimage.h |  37 ----
 arch/x86/lib/zimage.c         |   8 +-
 boot/Kconfig                  |   4 +-
 boot/bootflow.c               |  15 ++
 boot/bootm.c                  |  37 ++++
 boot/bootmeth-uclass.c        |  10 +
 boot/bootmeth_cros.c          | 363 ++++++++++++++++++++++++++++------
 boot/bootmeth_cros.h          | 197 ++++++++++++++++++
 cmd/bootflow.c                |  47 ++++-
 doc/usage/cmd/bootflow.rst    | 139 ++++++++++++-
 include/bootflow.h            |  15 +-
 include/bootm.h               |  47 +++++
 include/bootmeth.h            |  23 +++
 13 files changed, 836 insertions(+), 106 deletions(-)
 create mode 100644 boot/bootmeth_cros.h
#34 lore raw

(Note that I'm not objecting to merging the patchset as is, just detailing future work you/I might want to do for non-CrOS userspace support for this bootmeth.)

Quoted 7 lines · Simon Glass
Quoted 3 lines · Alper Nebi Yasak

I guess it boils down to:

- Enable booting from any chromeos_kernel partition (not just 2 & 4)

How do you know which ones hold kernels, and which root disks correspond to each kernel?

You should search all those with FE3A2A5D-4F32-41A7-B725-ACCC3285A309 as their GPT partition type GUID. They are ordered wrt/ the type-specific Successful, Priority, Tries attribute flags (bits 56, 55-52, 51-48). The firmware is also supposed to modify these (decrement Tries on each boot attempt, set Priority = 0 if Tries == 0). All these are stock depthcharge behaviour, see ChromiumOS docs [5].

The kernels don't necessarily correspond to a specific root, that's a per-OS concept. For example on Debian, I have two or three of these partitions for the same rootfs used in a cyclic fashion to have A/B-style automatic fallback for kernel/initramfs changes. And there may not be a rootfs at all, like how Debian Installer runs entirely from its initramfs.

[5] ChromiumOS Docs - Disk Format - Selecting the kernel
https://chromium.googlesource.com/chromiumos/docs/+/HEAD/disk_format.md#selecting-the-kernel

Quoted 3 lines
Quoted 1 line

- Fixup the ramdisk addr/size in x86 setup info after reading the kernel

But ChromeOS doesn't use ramdisk, right?

Not in this way, AFAIK it embeds one into vmlinuz during compile-time? I guess the ramdisk addr/size in x86 setup is 0/0 for ChromeOS indicating there isn't (an external) one.

But depthcharge is so minimalistic that it loads everything at a fixed address and passes x86 setup unchanged as prepared beforehand, so I can append a ramdisk to vmlinuz and tell Linux where that will end up in memory behind depthcharge's back. (A bit more complicated than that.)

So the thing is, when bootmeth_cros reads the "kernel" data into memory somewhere other than 0x100000, the x86 setup from my images will be pointing to an unrelated location as the ramdisk, which Linux will fail to interpret as a ramdisk and panic.

Quoted 5 lines
Quoted 1 line

- Prepend cros_secure to kernel cmdline

Does it have to be at the start of the cmdline? Also, the cmdline comes from cros at present, so does include that normally. I think the best way is for you to give it a try and see what is needed.

Doesn't have to be at the start, but Depthcharge unconditionally prepends it, I do see multiple "cros_secure"s on ChromeOS /proc/cmdline.

I'd like to have that here too as a way to identify the boot method, since non-CrOS userspaces will not have configured cmdline to have that. In Debian Installer, I do grep cros_secure /proc/cmdline to see if we should set up with depthcharge-tools or something else like GRUB.

(Yeah, I should be testing this, but stretched myself too thin.)

Quoted 11 lines
Quoted 9 lines

There's a ready made debian-installer image if you want to test [2]. Has a partitioning bug defaulting to MBR, but otherwise can install for CrOS verified boot as well. (It's what took my last year away from U-Boot).

[1] depthcharge-tools -- Tools to manage the Chrome OS bootloader
https://github.com/alpernebbi/depthcharge-tools

[2] Debian Installer netboot image for amd64 Chromebooks
https://d-i.debian.org/daily-images/amd64/daily/netboot/depthcharge/

I see the installer, but how do I actually run it on bob, say?

I hoped the names were self-evident, but I know I should be writing docs on them, just postponing until they are in better shape.

Basically gzip -d <disk.img.gz | dd of=/dev/sdX to a USB flash drive or microSD card. It's an compressed GPT disk image containing just one partition. With stock depthcharge, switch to Developer Mode, insert the drive/card and press Ctrl+U on the "OS verification is disabled" warning. With U-Boot and bootmeth_cros I think you would at least need to patch it for the first partition, and for the ramdisk address.

But the arm64 one won't work on stock depthcharge at all, since pre-2018 devices like bob have an ugly size limit this doesn't yet fit into, and anything else lacks kernel support on the Debian side.

... So maybe try the amd64 one on brya?

#35 lore raw

Hi Alper,

Quoted 21 lines · Alper Nebi Yasak

(Note that I'm not objecting to merging the patchset as is, just detailing future work you/I might want to do for non-CrOS userspace support for this bootmeth.)

Quoted 7 lines · Simon Glass
Quoted 3 lines · Alper Nebi Yasak

I guess it boils down to:

- Enable booting from any chromeos_kernel partition (not just 2 & 4)

How do you know which ones hold kernels, and which root disks correspond to each kernel?

You should search all those with FE3A2A5D-4F32-41A7-B725-ACCC3285A309 as their GPT partition type GUID. They are ordered wrt/ the type-specific Successful, Priority, Tries attribute flags (bits 56, 55-52, 51-48). The firmware is also supposed to modify these (decrement Tries on each boot attempt, set Priority = 0 if Tries == 0). All these are stock depthcharge behaviour, see ChromiumOS docs [5].

Quoted 6 lines

The kernels don't necessarily correspond to a specific root, that's a per-OS concept. For example on Debian, I have two or three of these partitions for the same rootfs used in a cyclic fashion to have A/B-style automatic fallback for kernel/initramfs changes. And there may not be a rootfs at all, like how Debian Installer runs entirely from its initramfs.

OK I see.

Quoted 60 lines

[5] ChromiumOS Docs - Disk Format - Selecting the kernel
https://chromium.googlesource.com/chromiumos/docs/+/HEAD/disk_format.md#selecting-the-kernel

Quoted 3 lines
Quoted 1 line

- Fixup the ramdisk addr/size in x86 setup info after reading the kernel

But ChromeOS doesn't use ramdisk, right?

Not in this way, AFAIK it embeds one into vmlinuz during compile-time? I guess the ramdisk addr/size in x86 setup is 0/0 for ChromeOS indicating there isn't (an external) one.

But depthcharge is so minimalistic that it loads everything at a fixed address and passes x86 setup unchanged as prepared beforehand, so I can append a ramdisk to vmlinuz and tell Linux where that will end up in memory behind depthcharge's back. (A bit more complicated than that.)

So the thing is, when bootmeth_cros reads the "kernel" data into memory somewhere other than 0x100000, the x86 setup from my images will be pointing to an unrelated location as the ramdisk, which Linux will fail to interpret as a ramdisk and panic.

Quoted 5 lines
Quoted 1 line

- Prepend cros_secure to kernel cmdline

Does it have to be at the start of the cmdline? Also, the cmdline comes from cros at present, so does include that normally. I think the best way is for you to give it a try and see what is needed.

Doesn't have to be at the start, but Depthcharge unconditionally prepends it, I do see multiple "cros_secure"s on ChromeOS /proc/cmdline.

I'd like to have that here too as a way to identify the boot method, since non-CrOS userspaces will not have configured cmdline to have that. In Debian Installer, I do grep cros_secure /proc/cmdline to see if we should set up with depthcharge-tools or something else like GRUB.

(Yeah, I should be testing this, but stretched myself too thin.)

Quoted 11 lines
Quoted 9 lines

There's a ready made debian-installer image if you want to test [2]. Has a partitioning bug defaulting to MBR, but otherwise can install for CrOS verified boot as well. (It's what took my last year away from U-Boot).

[1] depthcharge-tools -- Tools to manage the Chrome OS bootloader
https://github.com/alpernebbi/depthcharge-tools

[2] Debian Installer netboot image for amd64 Chromebooks
https://d-i.debian.org/daily-images/amd64/daily/netboot/depthcharge/

I see the installer, but how do I actually run it on bob, say?

I hoped the names were self-evident, but I know I should be writing docs on them, just postponing until they are in better shape.

Basically gzip -d <disk.img.gz | dd of=/dev/sdX to a USB flash drive or microSD card. It's an compressed GPT disk image containing just one partition. With stock depthcharge, switch to Developer Mode, insert the drive/card and press Ctrl+U on the "OS verification is disabled" warning. With U-Boot and bootmeth_cros I think you would at least need to patch it for the first partition, and for the ramdisk address.

Quoted 5 lines

But the arm64 one won't work on stock depthcharge at all, since pre-2018 devices like bob have an ugly size limit this doesn't yet fit into, and anything else lacks kernel support on the Debian side.

... So maybe try the amd64 one on brya?

Well I think I will apply this series (with a fix I found) and we can go from there.

I will look at using the EFI partition type to detect kernels. I will also see if I can get a test into CI for the ChromiumOS bootmeth, since it isn't much use without tests.

Then perhaps you might have time to enhance it from there for your use case?

I do imagine one day resurrecting the 2021-era vboot in U-Boot, as a proper bootmeth, but I am not sure when.

The kernel situation on ARM sounds a little grim. I will check internally to see if I can figure that out.

Regards,
Simon

#36 lore raw
In reply to Simon Glass

I have never asked to want receive emails related to chromiumos, so do not send these changes to me.

Quoted 54 lines · On Sunday 30 July 2023 11:16:46 Simon Glass wrote:

The ChromiumOS bootmeth is fairly basic at present. It is able to boot only x86 kernels and contains quite a few hard-coded offsets.

This series tidies it up by bringing in some vboot structures and adding support for ARM.

It adds a few more features to bootstd, including display of x86 setup information.

So far this does not actually boot correctly on any ARM Chromebook:

jerry - hangs when booting kernel
bob - Bad Linux ARM64 Image magic! with lz4-compressed kernel

Further work can address these issues.

Simon Glass (16):
bootstd: cros: Correct reporting of I/O errors
bootstd: cros: Move partition reading into a function
bootstd: cros: Bring in some ChromiumOS structures
bootstd: cros: Support a kernel on either partition
bootstd: cros: Decode some kernel preamble fields
bootstd: cros: Simplify setup and cmdline expressions
bootstd: Move common zimage functions to bootm.h
bootstd: cros: Add docs for the kernel layout
bootstd: cros: Add private info for ChromiumOS
bootstd: Add private bootmeth data to the bootflow
bootstd: cros: Add a function to read info from partition
bootstd: cros: Add a function to read a kernel
bootstd: cros: Split up reading info and kernel
bootstd: Allow display of the x86 setup information
bootstd: Add a command to read all files for a bootflow
bootstd: cros: Add ARM support

 arch/x86/include/asm/zimage.h |  37 ----
 arch/x86/lib/zimage.c         |   8 +-
 boot/Kconfig                  |   4 +-
 boot/bootflow.c               |  15 ++
 boot/bootm.c                  |  37 ++++
 boot/bootmeth-uclass.c        |  10 +
 boot/bootmeth_cros.c          | 363 ++++++++++++++++++++++++++++------
 boot/bootmeth_cros.h          | 197 ++++++++++++++++++
 cmd/bootflow.c                |  47 ++++-
 doc/usage/cmd/bootflow.rst    | 139 ++++++++++++-
 include/bootflow.h            |  15 +-
 include/bootm.h               |  47 +++++
 include/bootmeth.h            |  23 +++
 13 files changed, 836 insertions(+), 106 deletions(-)
 create mode 100644 boot/bootmeth_cros.h
Signature · 1 line
2.41.0.487.g6d72f3e995-goog
#37 lore raw

Hi Pali,

Quoted 3 lines · Pali Rohár

I have never asked to want receive emails related to chromiumos, so do not send these changes to me.

You received the last patch (and therefore the cover letter) because you committed to boot/bootm.c recently, which is affected by that patch.

Quoted 53 lines · On Sunday 30 July 2023 11:16:46 Simon Glass wrote:
Quoted 51 lines

The ChromiumOS bootmeth is fairly basic at present. It is able to boot only x86 kernels and contains quite a few hard-coded offsets.

This series tidies it up by bringing in some vboot structures and adding support for ARM.

It adds a few more features to bootstd, including display of x86 setup information.

So far this does not actually boot correctly on any ARM Chromebook:

jerry - hangs when booting kernel
bob - Bad Linux ARM64 Image magic! with lz4-compressed kernel

Further work can address these issues.

Simon Glass (16):
bootstd: cros: Correct reporting of I/O errors
bootstd: cros: Move partition reading into a function
bootstd: cros: Bring in some ChromiumOS structures
bootstd: cros: Support a kernel on either partition
bootstd: cros: Decode some kernel preamble fields
bootstd: cros: Simplify setup and cmdline expressions
bootstd: Move common zimage functions to bootm.h
bootstd: cros: Add docs for the kernel layout
bootstd: cros: Add private info for ChromiumOS
bootstd: Add private bootmeth data to the bootflow
bootstd: cros: Add a function to read info from partition
bootstd: cros: Add a function to read a kernel
bootstd: cros: Split up reading info and kernel
bootstd: Allow display of the x86 setup information
bootstd: Add a command to read all files for a bootflow
bootstd: cros: Add ARM support

 arch/x86/include/asm/zimage.h |  37 ----
 arch/x86/lib/zimage.c         |   8 +-
 boot/Kconfig                  |   4 +-
 boot/bootflow.c               |  15 ++
 boot/bootm.c                  |  37 ++++
 boot/bootmeth-uclass.c        |  10 +
 boot/bootmeth_cros.c          | 363 ++++++++++++++++++++++++++++------
 boot/bootmeth_cros.h          | 197 ++++++++++++++++++
 cmd/bootflow.c                |  47 ++++-
 doc/usage/cmd/bootflow.rst    | 139 ++++++++++++-
 include/bootflow.h            |  15 +-
 include/bootm.h               |  47 +++++
 include/bootmeth.h            |  23 +++
 13 files changed, 836 insertions(+), 106 deletions(-)
 create mode 100644 boot/bootmeth_cros.h
Quoted 3 lines
Quoted 3 lines

--
2.41.0.487.g6d72f3e995-goog

Regards,
Simon

#38 lore raw
Quoted 10 lines · On Sunday 06 August 2023 08:28:12 Simon Glass wrote:

Hi Pali,

Quoted 3 lines · Pali Rohár

I have never asked to want receive emails related to chromiumos, so do not send these changes to me.

You received the last patch (and therefore the cover letter) because you committed to boot/bootm.c recently, which is affected by that patch.

So stop sending me these emails. I'm not going to review any chromiumos changes.

Quoted 59 lines
Quoted 53 lines · On Sunday 30 July 2023 11:16:46 Simon Glass wrote:
Quoted 51 lines

The ChromiumOS bootmeth is fairly basic at present. It is able to boot only x86 kernels and contains quite a few hard-coded offsets.

This series tidies it up by bringing in some vboot structures and adding support for ARM.

It adds a few more features to bootstd, including display of x86 setup information.

So far this does not actually boot correctly on any ARM Chromebook:

jerry - hangs when booting kernel
bob - Bad Linux ARM64 Image magic! with lz4-compressed kernel

Further work can address these issues.

Simon Glass (16):
bootstd: cros: Correct reporting of I/O errors
bootstd: cros: Move partition reading into a function
bootstd: cros: Bring in some ChromiumOS structures
bootstd: cros: Support a kernel on either partition
bootstd: cros: Decode some kernel preamble fields
bootstd: cros: Simplify setup and cmdline expressions
bootstd: Move common zimage functions to bootm.h
bootstd: cros: Add docs for the kernel layout
bootstd: cros: Add private info for ChromiumOS
bootstd: Add private bootmeth data to the bootflow
bootstd: cros: Add a function to read info from partition
bootstd: cros: Add a function to read a kernel
bootstd: cros: Split up reading info and kernel
bootstd: Allow display of the x86 setup information
bootstd: Add a command to read all files for a bootflow
bootstd: cros: Add ARM support

 arch/x86/include/asm/zimage.h |  37 ----
 arch/x86/lib/zimage.c         |   8 +-
 boot/Kconfig                  |   4 +-
 boot/bootflow.c               |  15 ++
 boot/bootm.c                  |  37 ++++
 boot/bootmeth-uclass.c        |  10 +
 boot/bootmeth_cros.c          | 363 ++++++++++++++++++++++++++++------
 boot/bootmeth_cros.h          | 197 ++++++++++++++++++
 cmd/bootflow.c                |  47 ++++-
 doc/usage/cmd/bootflow.rst    | 139 ++++++++++++-
 include/bootflow.h            |  15 +-
 include/bootm.h               |  47 +++++
 include/bootmeth.h            |  23 +++
 13 files changed, 836 insertions(+), 106 deletions(-)
 create mode 100644 boot/bootmeth_cros.h
Quoted 3 lines
Quoted 3 lines

--
2.41.0.487.g6d72f3e995-goog

Regards,
Simon