Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

buildextend-live: add karg embed area offsets to header #1637

Merged
merged 4 commits into from
Dec 23, 2020

Conversation

jlebon
Copy link
Member

@jlebon jlebon commented Aug 4, 2020

Collect ISO files which include karg embed areas, then inject their
offsets into the System Area right behind the initramfs header. This
information will be used by coreos-installer iso embed-kargs.

@jlebon
Copy link
Member Author

jlebon commented Aug 4, 2020

Requires: coreos/fedora-coreos-config#545

@jlebon
Copy link
Member Author

jlebon commented Aug 4, 2020

Split out prep patches in #1639.

Copy link
Member

@cgwalters cgwalters left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this looks good. I tried to review this one first but was baffled by what "karg files" are until I read coreos/fedora-coreos-config#545

Maybe "bootloader files"?

One of these projects (probably this one) needs a nice big block comment describing this setup with cross links after they merge.

It'd also be good to hoist some of these magic numbers up as constants like ISO_SYSTEM_AREA_SIZE = 32768, MAX_BOOTLOADER_FILES = 6 etc.

@jlebon
Copy link
Member Author

jlebon commented Aug 6, 2020

Rebased!

Maybe "bootloader files"?

I went the super explicit way and changed it to files_with_karg_embed_areas. :)

One of these projects (probably this one) needs a nice big block comment describing this setup with cross links after they merge.

Yeah, will do that in coreos-installer.

It'd also be good to hoist some of these magic numbers up as constants like ISO_SYSTEM_AREA_SIZE = 32768, MAX_BOOTLOADER_FILES = 6 etc.

I did this (and sprinkled a few more asserts), but didn't hoist it completely up because I think it lives better near the massive comment block where it's all explained.

Copy link
Contributor

@darkmuggle darkmuggle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cgwalters, darkmuggle, jlebon

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [cgwalters,darkmuggle,jlebon]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@darkmuggle
Copy link
Contributor

I rather enjoy the clever trick of using the iso9660 system area. The only downside is that we need document it in case someone re-masters the ISO.

@darkmuggle
Copy link
Contributor

@jlebon needs a rebase

@openshift-ci-robot
Copy link

New changes are detected. LGTM label has been removed.

@nikita-dubrovskii
Copy link
Contributor

This was updated together with coreos/coreos-installer#341

@cgwalters
Copy link
Member

Try rebasing 🏄 to fix CI

@nikita-dubrovskii nikita-dubrovskii force-pushed the pr/iso-kargs branch 2 times, most recently from 3a9aa13 to 912f10f Compare October 27, 2020 13:37
@@ -341,6 +342,13 @@ def generate_iso():
buf = newbuf
karg_area_end = re.search(r'(#+) COREOS_KARG_EMBED_AREA\n', buf)
if karg_area_end is not None:
if len(default_kargs) == 0:
default_kargs = buf[karg_area_start.start():karg_area_end.end()]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be

default_kargs = buf[karg_area_start.start():karg_area_end.start()]

?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case length will be less than for other karg files. I though, that it's better to have similar files (ending with COREOS_KARG_EMBED_AREA), than handing different lengths in coreos-installer.
Or, we can modify header format and store there TLV - like structure for each karg file, where Type can be ro or rw

src/cmd-buildextend-live Outdated Show resolved Hide resolved
src/cmd-buildextend-live Outdated Show resolved Hide resolved
@nikita-dubrovskii nikita-dubrovskii force-pushed the pr/iso-kargs branch 3 times, most recently from 2b99e8c to a6239dd Compare October 29, 2020 10:11
src/cmd-buildextend-live Outdated Show resolved Hide resolved
src/cmd-buildextend-live Outdated Show resolved Hide resolved
Copy link
Member Author

@jlebon jlebon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, this LGTM now! Had one comment, but not worth the respin.


for i, fn in enumerate(files_with_karg_embed_areas):
offset_in_file = files_with_karg_embed_areas[fn]
offsets[i] = file_offset_in_iso(isoinfo, fn) + offset_in_file
offsets[i + 1] = file_offset_in_iso(isoinfo, fn) + offset_in_file
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor/optional: instead of doing + 1 here, I think it'd be cleaner if in the struct.pack() call below we explicitly split out an arg for the offset to .cmdline.

jlebon and others added 4 commits December 23, 2020 12:59
Collect ISO files which include karg embed areas, then inject their
offsets into the System Area right behind the initramfs header. This
information will be used by `coreos-installer iso embed-kargs`.
Add constants for some of our magic numbers, and make it clear that
the formatting of these files cannot be changed without first changing
coreos-installer.
…karg

This allows installer to modify all kargs backed into iso image

Signed-off-by: Nikita Dubrovskii <nikita@linux.ibm.com>
…arg reset'

Signed-off-by: Nikita Dubrovskii <nikita@linux.ibm.com>
@jlebon
Copy link
Member Author

jlebon commented Dec 23, 2020

Rebased this now! Since it already had two approvals, just going to add the lgtm label.

@jlebon jlebon added the lgtm label Dec 23, 2020
@jlebon jlebon closed this Dec 23, 2020
@jlebon jlebon reopened this Dec 23, 2020
@openshift-merge-robot openshift-merge-robot merged commit 77bf671 into coreos:master Dec 23, 2020
@jlebon jlebon deleted the pr/iso-kargs branch April 22, 2023 23:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants