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

Rewrite build system? #33

Closed
phil-opp opened this issue Nov 24, 2018 · 2 comments
Closed

Rewrite build system? #33

phil-opp opened this issue Nov 24, 2018 · 2 comments
Assignees

Comments

@phil-opp
Copy link
Member

Currently the build process is a bit strange:

  • First, we build the kernel
  • Then we convert the ELF file to a binary
  • Then we append a 512 byte sized structure that contains the kernel length
  • Finally we append the kernel

We could change it in the following way:

  • We could create a build script that reads an BOOTLOADER_KERNEL_PATH environment variable, converts it to a binary blob and then back to an object file (e.g. cargo objcopy -- -I binary -O elf64-x86-64 target/x86_64-blog_os/debug/blog_os blog_os_bin.o --binary-architecture=i386:x86-64)
  • Rename the default .data section to .kernel
  • The build script then passes the object file to the linker
  • This means that we can directly access the kernel blob in the linker script and directly access start/end/size of the kernel

The new build process would be:

  • Build the kernel
  • Build the bootloader (with an environment variable set to the kernel path)
  • Convert the bootloader ELF file to a binary

The big disadvantage of this is that we need to rebuild the bootloader for each kernel change, so maybe it is better to keep the current build system.

@meteor-lsw
Copy link

I think rebuild the bootloader for each kernel change is not a good idea

@phil-opp
Copy link
Member Author

It wouldn't really recompile the bootloader, but it would rerun the build script and the linker. I think this shouldn't add much overhead, but I'm not 100% sure.

@phil-opp phil-opp self-assigned this Mar 12, 2019
@phil-opp phil-opp mentioned this issue Mar 23, 2019
2 tasks
bors bot added a commit that referenced this issue Apr 1, 2019
51: Rewrite build system r=phil-opp a=phil-opp

- [x] Blocked on rust-lang/rust#59351
- [x] Blocked on rust-lang/cargo#6778

Fixes #33 
Fixes #48

Co-authored-by: Philipp Oppermann <dev@phil-opp.com>
@bors bors bot closed this as completed in #51 Apr 1, 2019
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

No branches or pull requests

2 participants