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

split existing Makefile #2096

Merged
merged 1 commit into from
Apr 11, 2024
Merged

split existing Makefile #2096

merged 1 commit into from
Apr 11, 2024

Conversation

anmaxvl
Copy link
Contributor

@anmaxvl anmaxvl commented Apr 2, 2024

The existing Makefile grew pretty large and now has a few additional dependencies like python and crypto for SNP targets.

The idea behind the split is that the new Makefile.bootfiles can be used to create Linux boot files and it depends only on delta*.tar.gz. This is useful in e.g. multi staged build process, where delta*.tar.gz artifacts can be produced separately from the final boot files. Since the delta can be applied to any base image, the build job that does it, wouldn't need go runtime or C compiler.

The existing Makefile grew pretty large and now has a few
additional dependencies like python and crypto for SNP targets.

The idea behind the split is that the new Makefile.bootfiles
can be used to create Linux boot files and it depends only
on `delta*.tar.gz`. This is useful in e.g. multi staged build
process, where `delta*.tar.gz` artifacts can be produced
separately from the final boot files. Since the delta can be
applied to any base image, the build job that does it, wouldn't
need go runtime or C compiler.

Signed-off-by: Maksim An <maksiman@microsoft.com>
@anmaxvl anmaxvl marked this pull request as ready for review April 3, 2024 18:08
@anmaxvl anmaxvl requested a review from a team as a code owner April 3, 2024 18:08
rm -rf rootfs-conv

out/initrd.img: $(BASE) $(DELTA_TARGET) $(SRCROOT)/hack/catcpio.sh
$(SRCROOT)/hack/catcpio.sh "$(BASE)" $(DELTA_TARGET) > out/initrd.img.uncompressed
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a note here, not necessarily something you need to look into. I'd really like to move away from this catcpio if we can. Do you have any concerns or thoughts on that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I haven't really given it much thought. What's the concern with current approach? Is it perf? or the hacky nature of it?

Copy link
Contributor

Choose a reason for hiding this comment

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

imo, its hacky and hard to read, plus, its weird that our build process is:

  1. create the boot rootfs by combining $(BASE) and $(DELTA) together in a mktemp directory
  2. cpio archive and then gzip the temp directory to initrd.img
    2.1. forget the temp directory with the rootfs exists
  3. delete the ungzip'ed cpio archive
  4. ungzip and extract the cpio archive, then tar it
  5. delete the ungzip'ed cpio archive

@katiewasnothere katiewasnothere self-assigned this Apr 3, 2024
@msscotb msscotb self-assigned this Apr 3, 2024
Makefile Show resolved Hide resolved
VMGS_TOOL:=
IGVM_TOOL:=
KERNEL_PATH:=
TAR2EXT4_TOOL:=bin/cmd/tar2ext4
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we add a make command to build this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wanted to make sure that Makefile.bootfiles doesn't depend on go runtime. It's useful in a multi job build process, where different container images could be used. e.g. for creating delta*.tar.gz files it could be a golang based container, for creating SNP boot files it'll be a python based one.

Copy link
Contributor

@katiewasnothere katiewasnothere left a comment

Choose a reason for hiding this comment

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

One question otherwise lgtm

@anmaxvl anmaxvl merged commit c09ae9d into microsoft:main Apr 11, 2024
19 checks passed
@anmaxvl anmaxvl deleted the makefile-split branch April 11, 2024 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants