Page MenuHomeFreeBSD

Add additional partition types to mkimg utility to allow creaation of riscv images
ClosedPublic

Authored by bscott_bunyatech.com.au on Mon, May 4, 9:28 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, May 17, 8:47 AM
Unknown Object (File)
Sat, May 16, 7:46 AM
Unknown Object (File)
Thu, May 14, 3:35 AM
Unknown Object (File)
Wed, May 13, 7:32 PM
Unknown Object (File)
Tue, May 12, 2:32 PM
Unknown Object (File)
Tue, May 12, 2:32 PM
Unknown Object (File)
Mon, May 11, 8:11 PM
Unknown Object (File)
Mon, May 11, 4:23 PM
Subscribers

Details

Summary

The visionfive2 riscv SBC has odd requirements for startup partitions.
The design of mkimg only allows it to create predetermined types of partitions that don't include some of those needed for the visionfive2 system.
This change adds the two types needed (hifive-fsbl and xbootldr) as well as hifive-bbl (used in the downloadable riscv64 images but not used by visionfive2).

Test Plan

Verify existing test suite for mkimg runs.
I haven't written any specific tests for the new partition types.
An image created with the new partition types and mounted with mdconfig should show the correct partition types. Note that 'gpart show' only understands the hifive-fsbl and hifive-bbl types. The xbootldr partition type will show as !bc13c2ff-59e6-4262-a352-b275fd6f7172.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

mhorne requested changes to this revision.Wed, May 6, 5:46 PM
mhorne added reviewers: emaste, markj, mhorne.
mhorne added a subscriber: mhorne.

Looks good, with one required change.

Seems like the "xbootldr" partition type is a systemd-boot thing. It is a useful alias.

It should be straightforward to add this to the gpart utility as well. Would you like to handle this too? (Start by looking at g_part_alias_list[] in sys/geom/part/g_part.c.)

usr.bin/mkimg/gpt.c
56–57

This definition should be added to sys/sys/disk/gpt.h instead.

This revision now requires changes to proceed.Wed, May 6, 5:46 PM

Definition of XBOOTLDR partition type moved to gpt.h
Changes to gpart utility suggested still being tested so not shown

Change now includes update allowing creation of xbootldr partition type with gpart (without specifying uuid).
System with change boots normally (the actual table is in the kernel, not the gpart utility).
Gpart utility now creates and reports on xbootldr partition type as well as existing types (about 20 tested on a memory disk).

This revision is now accepted and ready to land.Mon, May 11, 4:52 PM
markj added inline comments.
usr.bin/mkimg/scheme.c
63

Doesn't have to be fixed here, but I'm surprised these aren't listed in the mkimg(1) man page or in the usage message...

Can you confirm the git author info should be Brian Scott <bscott@bunyatech.com.au>