-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* shell: fix assignment error * boot: create new loader file generation from boot dir in new CLI * wanix: make loader OS agnostic `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. * rename references to old initfs to bootfs 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. * boot: fetch `wanix-initfs.gz` and unpack into `/sys/*` on first 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. --------- Co-authored-by: Parzival-3141 <29632054+Parzival-3141@users.noreply.github.com>
- Loading branch information
1 parent
10c18bc
commit 19fab37
Showing
29 changed files
with
360 additions
and
350 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,56 @@ | ||
.PHONY: boot dev kernel shell dev bundle micro hugo local/bin/kernel | ||
.PHONY: boot dev kernel shell dev bundle micro hugo wanix boot/kernel.gz initfsDirs | ||
|
||
VERSION=0.2dev | ||
DEBUG?=false | ||
|
||
all: kernel shell build micro | ||
all: wanix kernel shell build micro | ||
|
||
dev: all | ||
go run ./dev | ||
|
||
bundle: local/bin/kernel | ||
cp local/bin/kernel local/wanix-kernel | ||
gzip -f -9 local/wanix-kernel | ||
go run -tags bundle ./dev | ||
|
||
kernel: local/bin/kernel | ||
local/bin/kernel: kernel/bin/shell kernel/bin/micro kernel/bin/build | ||
cd kernel && GOOS=js GOARCH=wasm go build -ldflags="-X 'main.Version=${VERSION}' -X 'tractor.dev/wanix/kernel/fs.DebugLog=${DEBUG}'" -o ../local/bin/kernel . | ||
|
||
shell: kernel/bin/shell | ||
kernel/bin/shell: shell/main.go | ||
cd shell && GOOS=js GOARCH=wasm go build -o ../kernel/bin/shell . | ||
|
||
micro: kernel/bin/micro | ||
kernel/bin/micro: external/micro/ | ||
./local/bin/wanix dev | ||
|
||
loader: all | ||
cd ./local && ./bin/wanix loader | ||
|
||
wanix: local/bin/wanix | ||
local/bin/wanix: kernel initfs | ||
go build -o ./local/bin/ ./cmd/wanix | ||
|
||
kernel: boot/kernel.gz | ||
boot/kernel.gz: | ||
cd kernel && GOOS=js GOARCH=wasm go build -ldflags="-X 'main.Version=${VERSION}' -X 'tractor.dev/wanix/kernel/fs.DebugLog=${DEBUG}'" -o ../boot/kernel . | ||
gzip -f -9 ./boot/kernel | ||
|
||
initfs: boot/initfs.gz | ||
boot/initfs.gz: boot/initfs | ||
tar -cf ./boot/initfs.tar -C ./boot/initfs . | ||
gzip -f -9 ./boot/initfs.tar | ||
mv ./boot/initfs.tar.gz ./boot/initfs.gz | ||
|
||
boot/initfs: initfsDirs shell micro build | ||
cp -r ./shell ./boot/initfs/cmd/ | ||
cp internal/export/exportapp.sh ./boot/initfs/cmd/ | ||
cp internal/export/main.go ./boot/initfs/export/ | ||
|
||
initfsDirs: | ||
mkdir -p ./boot/initfs | ||
mkdir -p ./boot/initfs/bin | ||
mkdir -p ./boot/initfs/cmd | ||
mkdir -p ./boot/initfs/export | ||
|
||
shell: boot/initfs/bin/shell.wasm | ||
boot/initfs/bin/shell.wasm: shell/main.go | ||
cd shell && GOOS=js GOARCH=wasm go build -o ../boot/initfs/bin/shell.wasm . | ||
|
||
micro: boot/initfs/cmd/micro.wasm | ||
boot/initfs/cmd/micro.wasm: external/micro/ | ||
make -C external/micro build | ||
|
||
hugo: external/hugo/ | ||
make -C external/hugo build | ||
|
||
build/pkg.zip: build/build-pkgs/imports/imports.go build/build-pkgs/main.go | ||
cd build && go run ./build-pkgs/main.go ./build-pkgs/imports ./pkg.zip | ||
|
||
build: kernel/bin/build | ||
kernel/bin/build: build/main.go build/pkg.zip | ||
cd build && GOOS=js GOARCH=wasm go build -o ../kernel/bin/build . | ||
build: boot/initfs/cmd/build.wasm | ||
boot/initfs/cmd/build.wasm: build/main.go build/pkg.zip | ||
cd build && GOOS=js GOARCH=wasm go build -o ../boot/initfs/cmd/build.wasm . | ||
|
||
hugo: external/hugo/ | ||
make -C external/hugo build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
globalThis.initdata = { | ||
{{range .}} | ||
{{.Loader}} | ||
globalThis.bootdata = { | ||
{{range .Files }} | ||
"{{.Name}}": {type: "{{.Type}}", mtimeMs: {{.Mtime}}, data: "{{.Data}}"}, | ||
{{end}} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
File renamed without changes.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package boot | ||
|
||
import "embed" | ||
|
||
//go:embed * | ||
var Dir embed.FS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
Oops, something went wrong.