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

New CLI and bootdata system #143

Merged
merged 5 commits into from
Apr 17, 2024
Merged

New CLI and bootdata system #143

merged 5 commits into from
Apr 17, 2024

Conversation

progrium
Copy link
Contributor

@progrium progrium commented Apr 9, 2024

This PR introduces a wanix CLI that replaces the dev server and has a command equivalent to our bundle generation command. However, it works much differently. Instead of "bundle" where it assembled the bootloader.js and other files right there, the "loader" command will write files out from embedded data in the binary itself. "Bundling" is now just building the wanix CLI.

The new boot dir is embedded into the wanix CLI. It contains the bootdata files to bootstrap the wanix kernel, the loader.js, the HTML files needed for a deploy and is a staging directory for kernel.gz and initfs.gz. Both of those files are created by make.

This PR also breaks Wanix because it's incomplete. We still need to alter the kernel to start using the wanix-initfs.gz file if /sys/init does not exist, and place files from there. This is what's left of #138, which this PR implements a lot of.

One thing I didn't do is rename the existing initfs in the codebase to bootfs.

@progrium progrium requested a review from Parzival-3141 April 9, 2024 03:01
@progrium progrium mentioned this pull request Apr 9, 2024
Copy link
Collaborator

@Parzival-3141 Parzival-3141 left a comment

Choose a reason for hiding this comment

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

Good stuff

`filepath` package uses different path separators depending on the target OS.
On Windows this causes errors since embedFS expects Unix path separators.

We should really be using the `path` package everywhere unless specifically
interacting with the host OS.
initfs, now bootfs, only contains files necessary to boot the kernel.
What is now called initfs will contain userspace files to setup the dev environment.
Think of it like GNU CoreUtils, preinstalled on most Unix OSes but
unnecessary to actually boot.
This commit makes some changes to the structure of `boot/initfs/`
and how initfs files are copied. Instead of hardcoding which files go
where, `fs.go` just unpacks the contents of initfs into `/sys/*`.

It's basically running the equivalent of:
```sh
cd /sys/ && \
get wanix-initfs.gz && \
gzip -d wanix-initfs.gz && \
tar -xf wanix-initfs
```

This gives us direct and simple control of file placement.
And if in the future we want to put things outside of `/sys`,
we can just unpack to `/` and update the build paths. Though
it makes sense to me that initfs would only include system related files.
@Parzival-3141
Copy link
Collaborator

I've updated the PR to fulfill the rest of #138. I made some changes to how initfs is setup. Check out the commits for details.

@Parzival-3141 Parzival-3141 self-requested a review April 12, 2024 04:07
@progrium
Copy link
Contributor Author

🥇

@progrium progrium merged commit 19fab37 into main Apr 17, 2024
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