Skip to content

Comments

Update Linux build scripts#889

Merged
Timmmm merged 2 commits intoriscv:masterfrom
Arielfoever:os-boot
Jul 2, 2025
Merged

Update Linux build scripts#889
Timmmm merged 2 commits intoriscv:masterfrom
Arielfoever:os-boot

Conversation

@Arielfoever
Copy link
Contributor

@Arielfoever Arielfoever commented Apr 26, 2025

Remove old pre-built Linux images and add a Makefile to build one from scratch, including downloading all the tools.

This Makefile also includes a target for profiling using gperftools.

Fixes #580

@github-actions
Copy link

github-actions bot commented Apr 26, 2025

Test Results

400 tests  ±0   400 ✅ ±0   1m 29s ⏱️ ±0s
  1 suites ±0     0 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit 0c905d8. ± Comparison against base commit bd8e9ab.

♻️ This comment has been updated with latest results.

@Timmmm
Copy link
Collaborator

Timmmm commented Apr 26, 2025

I don't think we want to add another 23 MB ELF to the repo. Ideally we would add a script/Makefile that allows people to build it. We could also host a pre built version somewhere outside the repo and link to it.

Copy link
Collaborator

@jordancarlin jordancarlin left a comment

Choose a reason for hiding this comment

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

Will be great to get these images updated! Here are some initial comments. Likely more to follow.

os-boot/sail.dts Outdated
status = "okay";
compatible = "riscv";
riscv,isa = "rv64imac";
riscv,isa = "rv64imafd";
Copy link
Collaborator

Choose a reason for hiding this comment

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

If we're updating the device tree, we might as well use the full list of supported extensions in the default config. That will exercise the widest variety of instructions, and therefore be a better test for the model.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd still like to see this fixed. Not sure why this was marked as resolved. Maybe something like this instead:

riscv,isa-base = "rv64i";
riscv,isa-extensions = "i", "m", "a", "f", "d", "c", "v", "sstc", "svinval", "zba", "zbb", "zbc", "zbs", "zca", "zcb", "zcd", "zfa", "zfh", "zkn", "zkt", "zicbom", "zicboz", "zicntr", "zicond", "zicsr", "zifencei", "zihpm";
riscv,cboz-block-size = <64>;
riscv,cbom-block-size = <64>;

Copy link
Collaborator

Choose a reason for hiding this comment

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

Please keep riscv,isa though, FreeBSD does not currently recognise the newer form

Copy link
Collaborator

Choose a reason for hiding this comment

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

@Arielfoever This needs to be switched to use the longer list of extensions in the older riscv,isa format.

@Arielfoever
Copy link
Contributor Author

I don't think we want to add another 23 MB ELF to the repo. Ideally we would add a script/Makefile that allows people to build it. We could also host a pre built version somewhere outside the repo and link to it.

I will make a makefile and a CI to build it. How's this idea?

@Timmmm
Copy link
Collaborator

Timmmm commented Apr 26, 2025

Sounds good to me. I think we probably don't need to add it to PR CIs but I might be nice to have a manually triggered workflow.

@Arielfoever
Copy link
Contributor Author

Makefile will be in https://github.com/Arielfoever/sail-riscv master branch because I need to check CI.

I will rebase my work if everything's fine.

@Arielfoever
Copy link
Contributor Author

Sounds good to me. I think we probably don't need to add it to PR CIs but I might be nice to have a manually triggered workflow.

Finished it with a Makefile and a manually triggered CI.

Copy link
Collaborator

@Timmmm Timmmm left a comment

Choose a reason for hiding this comment

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

This is great. Makefile needs a bit of work (blame me!). How did you resolve the ET_DYN thing? Or does it just not happen for some reason...

os-boot/Makefile Outdated
sail: sail.dtb
../build/c_emulator/riscv_sim_rv64d --no-trace -p -l $(LIMIT_INSTRUCTIONS) --device-tree-blob sail.dtb -t /tmp/console.log build/opensbi-$(OPENSBI_VERSION)/build/platform/generic/firmware/fw_payload.elf

# QEMU attempt. Not sure I ever got this working.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Delete this attempt! (Or this comment if it actually works.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this qemu is work.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As you wish.

Copy link
Collaborator

Choose a reason for hiding this comment

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

this qemu is work

Do you mean that command does work? If so that's great - let's leave it in! (And remove the comment about it not working.)

os-boot/Makefile Outdated
# Number of instructions to run.
LIMIT_INSTRUCTIONS ?= 250000

linux:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would be nice if we made the dependency tree work. E.g. this should depend build/linux-$(LINUX_VERSION)/Makefile and the download_linux rule should be

build/linux-$(LINUX_VERSION)/Makefile:
    mkdir -p build
...

I can do it if you like when the other comments are resolved.

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 will do it after no one objects in other comments after I finish my roommate's birthday lunch.

Copy link
Collaborator

@jordancarlin jordancarlin left a comment

Choose a reason for hiding this comment

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

Seems like it is not (easily) possible to download the generated artifact from the command line (actions/upload-artifact#89), so we probably need to figure out a different place for the final upload.

Also, should we rename all of this to just linux instead of os-boot since this is removing all of the other OSs? At least the workflow file.

@Arielfoever
Copy link
Contributor Author

Seems like it is not (easily) possible to download the generated artifact from the command line (actions/upload-artifact#89), so we probably need to figure out a different place for the final upload.

Also, should we rename all of this to just linux instead of os-boot since this is removing all of the other OSs? At least the workflow file.

renamed CI as you wish.

@Arielfoever Arielfoever force-pushed the os-boot branch 2 times, most recently from 72eb8ee to d66a750 Compare April 29, 2025 15:13
@Arielfoever
Copy link
Contributor Author

Everything's up-to-date. See https://github.com/Arielfoever/sail-riscv/actions/runs/14734807045

os-boot/sail.dts Outdated
status = "okay";
compatible = "riscv";
riscv,isa = "rv64imac";
riscv,isa = "rv64imafd";
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd still like to see this fixed. Not sure why this was marked as resolved. Maybe something like this instead:

riscv,isa-base = "rv64i";
riscv,isa-extensions = "i", "m", "a", "f", "d", "c", "v", "sstc", "svinval", "zba", "zbb", "zbc", "zbs", "zca", "zcb", "zcd", "zfa", "zfh", "zkn", "zkt", "zicbom", "zicboz", "zicntr", "zicond", "zicsr", "zifencei", "zihpm";
riscv,cboz-block-size = <64>;
riscv,cbom-block-size = <64>;

Copy link
Collaborator

@jordancarlin jordancarlin left a comment

Choose a reason for hiding this comment

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

Might be worth actually booting Linux on Sail in this CI job to make sure everything worked correctly before uploading it.

@Arielfoever Arielfoever force-pushed the os-boot branch 2 times, most recently from b74016d to 21747c2 Compare April 29, 2025 16:37
@Arielfoever
Copy link
Contributor Author

Might be worth actually booting Linux on Sail in this CI job to make sure everything worked correctly before uploading it.

Test at last step of CI.

@arichardson
Copy link
Collaborator

Looks like we need to install dtc in the CI? /bin/sh: 1: dtc: not found

@jordancarlin
Copy link
Collaborator

Ok from my point of view everything except the CI flow is ready (and I haven't actually read through it in detail yet). Since we weren't testing this in CI before, I think we should remove it from this PR, merge this, and then make another PR to actually run this in CI. What do people think?

Agreed that it makes sense to merge the Linux boot without adding it to CI as a first step. I do wonder if it’s worth converting to CMake though to be consistent with the rest of our build system.

@Arielfoever
Copy link
Contributor Author

#966 is ready to be merged and be a test ci. @Timmmm

I need a few more days to check the config config for linux kernel.

@Timmmm
Copy link
Collaborator

Timmmm commented Jun 27, 2025

I removed the CI flow from this PR. I think lets just merge this first and then we can rebase your other PR (should be easy).

@Timmmm Timmmm changed the title Move to new os-boot. Update Linux build scripts Jun 27, 2025
@Timmmm
Copy link
Collaborator

Timmmm commented Jun 27, 2025

I do wonder if it’s worth converting to CMake though to be consistent with the rest of our build system.

Yeah you're probably right... I think we should just get this in though and do that later if anyone can be bothered.

@arichardson
Copy link
Collaborator

A few minor comments, but I agree it would be great to land this makefile infrastructure to make it easier to test.

@Timmmm
Copy link
Collaborator

Timmmm commented Jun 27, 2025

Updated & rebased. I squashed the commits too since they were getting a bit numerous...

@pmundkur
Copy link
Collaborator

Is it getting to Linux now? Last I checked, it booted OpenSBI and then appeared to get stuck.

@Timmmm
Copy link
Collaborator

Timmmm commented Jun 28, 2025

Ah yeah it was booting but the console output wasn't showing because the DTS was missing the chosen { } section. I added that back and it works now. Slowly.

@Arielfoever
Copy link
Contributor Author

I think everything's work.

  Add missing "chosen" section to device tree

Signed-off-by: Ariel Xiong <ArielHeleneto@outlook.com>
Co-authored-by: Tim Hutt <tdhutt@gmail.com>
Copy link
Collaborator

@jordancarlin jordancarlin left a comment

Choose a reason for hiding this comment

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

One minor comment, but otherwise LGTM and will be great to finally get this in.

Co-authored-by: Jordan Carlin <jordanmcarlin@gmail.com>
Signed-off-by: Tim Hutt <tdhutt@gmail.com>
@Timmmm Timmmm added the will be merged Scheduled to be merged soon if nobody objects label Jul 1, 2025
@Timmmm Timmmm added this pull request to the merge queue Jul 2, 2025
Merged via the queue into riscv:master with commit 3fc7621 Jul 2, 2025
7 checks passed
@Arielfoever Arielfoever deleted the os-boot branch July 15, 2025 03:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

will be merged Scheduled to be merged soon if nobody objects

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update Linux images

6 participants