Skip to content

build_sdk.py: add support for minimal build#131

Merged
Ivan-Velickovic merged 1 commit intoseL4:mainfrom
nspin:pr/minimal-build
Jun 24, 2024
Merged

build_sdk.py: add support for minimal build#131
Ivan-Velickovic merged 1 commit intoseL4:mainfrom
nspin:pr/minimal-build

Conversation

@nspin
Copy link
Member

@nspin nspin commented Jun 7, 2024

This PR adds four new options to the build_sdk.py CLI:

  • --only-board <board>: only artifacts for <board> will be built
  • --only-config <config>: only artifacts for <config> (either "debug" or "release") will be built
  • --skip-docs: docs will not be built
  • --skip-source-tarball: source tarball will not be built

These options are useful in cases where the SDK is being built by a build system that doesn't have any use for artifacts other than those necessary for building a particular system.

@nspin nspin force-pushed the pr/minimal-build branch from a9d77e7 to d0ec84e Compare June 7, 2024 09:40
@Ivan-Velickovic
Copy link
Collaborator

These options are useful in cases where the SDK is being built by a build system that doesn't have any use for artifacts other than those necessary for building a particular system.

Would this be solved once the SDK is released?

@nspin
Copy link
Member Author

nspin commented Jun 7, 2024

These options would still be useful for cases where projects build Microkit from source. One example that comes to mind is working off of HEAD rather than the latest release. Another example is hacking on Microkit itself.

@Ivan-Velickovic
Copy link
Collaborator

Yep I agree I just meant if your specific use-case would still need these options.

@Ivan-Velickovic
Copy link
Collaborator

I assume the use-case is for the Rust Microkit demos which I think should just be able to use a released version available for download but just want to check.

@nspin
Copy link
Member Author

nspin commented Jun 7, 2024

Yes, those demos will use the binary release.

@Ivan-Velickovic
Copy link
Collaborator

Can you change —only-board to something like —boards and make it take a comma separated list of boards that are built, same thing for the config?

This has been pretty useful for me in the past and is something I have in my fork.

@nspin nspin force-pushed the pr/minimal-build branch from d0ec84e to 5919348 Compare June 24, 2024 07:36
@nspin
Copy link
Member Author

nspin commented Jun 24, 2024

I changed it to take multiple --board and --config arguments. When absent, the default is all. How is that?

@nspin nspin force-pushed the pr/minimal-build branch from 5919348 to 874e77b Compare June 24, 2024 07:38
@Ivan-Velickovic
Copy link
Collaborator

I changed it to take multiple --board and --config arguments. When absent, the default is all. How is that?

It's fairly common for me to specify multiple boards when developing so would still prefer the comma separated list.

Something like:

    if args.boards:
        board_names = args.boards.split(",")
        supported_board_names = [board.name for board in SUPPORTED_BOARDS]
        # Check that we are filtering boards that actually are supported
        for board in board_names:
            if board not in supported_board_names:
                raise Exception(f"Trying to build a board: {board} that does not exist in supported list.")
        selected_boards = board_names
    else:
        selected_boards = SUPPORTED_BOARDS

@nspin
Copy link
Member Author

nspin commented Jun 24, 2024

The PR as is allows one to specify --board and --config multiple times to select multiple boards or configs. For example:

microkit --board imx8mm_evk --board qemu_virt_aarch64 --config release --config debug

Would you prefer --boards BOARD1,BOARD2 or --board BOARD1 --board BOARD2?

I'll add the existence check.

build_sdk.py Outdated
with tar_open(source_tar_file, "w:gz") as tar:
for filename in filenames:
tar.add(filename, arcname=source_prefix / filename, filter=tar_filter)
if not args.skip_source_tarball:
Copy link
Collaborator

Choose a reason for hiding this comment

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

This skips both the SDK tar and the source tar. Can you call this option just --skip-tar instead?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

@Ivan-Velickovic
Copy link
Collaborator

Would you prefer --boards BOARD1,BOARD2 or --board BOARD1 --board BOARD2?

Sorry that's what I was trying to say in my previous comment. Doing --boards BOARD1,BOARD2 saves me some typing when targeting more than one board, that's all.

@nspin nspin force-pushed the pr/minimal-build branch from 874e77b to c6d8b1f Compare June 24, 2024 08:15
@nspin
Copy link
Member Author

nspin commented Jun 24, 2024

I've made both of those changes.

build_sdk.py Outdated
parser.add_argument("--boards", metavar="BOARDS", help="Comma-separated list of boards to support. When absent, all boards are supported.")
parser.add_argument("--configs", metavar="CONFIGS", help="Comma-separated list of configurations to support. When absent, all configurations are supported.")
parser.add_argument("--skip-docs", action="store_true", help="Docs will not be built")
parser.add_argument("--skip-tar", action="store_true", help="Source tarball will not be built")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
parser.add_argument("--skip-tar", action="store_true", help="Source tarball will not be built")
parser.add_argument("--skip-tar", action="store_true", help="SDK and source tarballs will not be built")

Copy link
Collaborator

Choose a reason for hiding this comment

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

Sorry, one more minor thing and then it's good to merge.

@nspin nspin force-pushed the pr/minimal-build branch from c6d8b1f to 27f63a4 Compare June 24, 2024 08:18
Signed-off-by: Nick Spinale <nick@nickspinale.com>
@nspin nspin force-pushed the pr/minimal-build branch from 27f63a4 to af90104 Compare June 24, 2024 08:18
@Ivan-Velickovic
Copy link
Collaborator

Cool, thanks!

@Ivan-Velickovic Ivan-Velickovic merged commit d3ed300 into seL4:main Jun 24, 2024
@nspin nspin deleted the pr/minimal-build branch June 24, 2024 08:25
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.

2 participants