[PATCH v2 3/4] image-commands: support Chromium OS image-type creation

Brian Norris computersforpeace at gmail.com
Sun Jan 17 12:20:36 EST 2021


Hi Paul,

On Sun, Jan 17, 2021 at 2:43 AM Paul Spooren <mail at aparcar.org> wrote:
> On Sat Jan 16, 2021 at 5:07 PM HST, Brian Norris wrote:
> > See the previous patches, which implemented the cros-vbutil
> > verified-boot payload-packing tool, and extended ptgen for the CrOS
> > kernel partition type. With these, it's now possible to package kernel +
> > rootfs to make disk images that can boot a Chrome OS-based system (e.g.,
> > Chromebooks, or even a few AP models).
> >
> > gen_image_vboot.sh borrows a bit of structure from gen_image_generic.sh,
> > but I didn't feel it fit well to try and add new flags to the latter,
> > given the difference in its FAT kernel packaging and our raw kernel
> > partition packing.
> >
> > Signed-off-by: Brian Norris <computersforpeace at gmail.com>
> > ---
> > include/image-commands.mk | 18 ++++++++++
> > .../base-files/files/lib/upgrade/common.sh | 4 ++-
> > scripts/gen_image_vboot.sh | 36 +++++++++++++++++++
> > 3 files changed, 57 insertions(+), 1 deletion(-)
> > create mode 100755 scripts/gen_image_vboot.sh
> >
> > diff --git a/include/image-commands.mk b/include/image-commands.mk
> > index 979eafb15734..f02d8e79fce6 100644
> > --- a/include/image-commands.mk
> > +++ b/include/image-commands.mk
> > @@ -172,6 +172,24 @@ define Build/fit
> > @mv $@.new $@
> > endef
> >
> > +define Build/cros-image
> > + $(SCRIPT_DIR)/gen_image_vboot.sh \
> > + $@ \
> > + $(CONFIG_TARGET_KERNEL_PARTSIZE) \
>
> You're passing the kernel size twice here which the script expects
> <size> <image>. Am I missing something?

>From the error/help text:

    echo "SYNTAX: $0 <file> <bootpart size> <kernel size> <kernel
image> <rootfs size> <rootfs image>"

It's a bit awkward, but for the first partition, it's only asking for
a <size>. I haven't fully fleshed it out yet, but this first partition
is a spare FAT partition, for use in sysupgrade. I believe other
systems reuse the kernel partition (which tends to be either FAT or
ext4), but because Chrome OS systems use a signed blob (and not a
proper filesystem) for their kernel partitions, I needed to create an
extra partition, with no special data in it.

Also, I don't really have a separate Kconfig option for defining the
FAT partition size -- I just reused the kernel partition size.

I'm open to suggestions on this, but the current code is written as
intended. I'm not very familiar with OpenWRT image-construction best
practices (e.g., adding more Kconfig parameters?).

Thanks,
Brian



More information about the openwrt-devel mailing list