Move kernel to cookbook recipe

This commit is contained in:
Jeremy Soller 2022-07-24 09:02:48 -06:00
parent c475f1a17d
commit 5b0822f893
No known key found for this signature in database
GPG key ID: E988B49EE78A7FB1
17 changed files with 21 additions and 56 deletions

View file

@ -30,10 +30,11 @@ build/bootloader-live.efi: bootloader/build/$(EFI_TARGET)/bootloader-live.efi
mkdir -p build
cp -v $< $@
bootloader-coreboot/build/bootloader: build/kernel_coreboot
env --unset=RUST_TARGET_PATH --unset=RUSTUP_TOOLCHAIN --unset=XARGO_RUST_SRC \
$(MAKE) -C bootloader-coreboot clean build/bootloader KERNEL="$(ROOT)/$<"
build/coreboot.elf: bootloader-coreboot/build/bootloader
mkdir -p build
cp -v $< $@
#TODO: update coreboot bootloader/kernel
# bootloader-coreboot/build/bootloader: build/kernel_coreboot
# env --unset=RUST_TARGET_PATH --unset=RUSTUP_TOOLCHAIN --unset=XARGO_RUST_SRC \
# $(MAKE) -C bootloader-coreboot clean build/bootloader KERNEL="$(ROOT)/$<"
#
# build/coreboot.elf: bootloader-coreboot/build/bootloader
# mkdir -p build
# cp -v $< $@

View file

@ -42,13 +42,8 @@ endif
# Automatic variables
ROOT=$(CURDIR)
export RUST_COMPILER_RT_ROOT=$(ROOT)/rust/src/llvm-project/compiler-rt
export RUST_TARGET_PATH=$(ROOT)/kernel/targets
export XARGO_RUST_SRC=$(ROOT)/rust/src
## Kernel variables
KTARGET=$(ARCH)-unknown-kernel
KBUILD=build/kernel
## Userspace variables
export TARGET=$(ARCH)-unknown-redox
BUILD=build/userspace

View file

@ -1,4 +1,4 @@
build/filesystem.bin: prefix filesystem.toml build/bootloader.bin build/kernel build/initfs.img
build/filesystem.bin: prefix filesystem.toml build/bootloader.bin build/initfs.img
cargo build --manifest-path cookbook/Cargo.toml --release
cargo build --manifest-path installer/Cargo.toml --release
cargo build --manifest-path redoxfs/Cargo.toml --release
@ -15,7 +15,6 @@ build/filesystem.bin: prefix filesystem.toml build/bootloader.bin build/kernel b
pgrep redoxfs
cp -v filesystem.toml build/filesystem/filesystem.toml
cp -v build/bootloader.bin build/filesystem/bootloader
cp -v build/kernel build/filesystem/kernel
mkdir -v build/filesystem/pkg
cp -v cookbook/build/id_ed25519.pub.toml build/filesystem/pkg/id_ed25519.pub.toml
#TODO cp -r $(ROOT)/$(PREFIX_INSTALL)/$(TARGET)/include build/filesystem/include

View file

@ -1,10 +0,0 @@
build/libkernel.a: kernel/Cargo.lock kernel/Cargo.toml kernel/src/* kernel/src/*/* kernel/src/*/*/* kernel/src/*/*/*/*
export PATH="$(PREFIX_PATH):$$PATH" && \
cd kernel && \
cargo rustc --lib --target=$(ROOT)/kernel/targets/$(KTARGET).json --release -- -C soft-float -C debuginfo=2 -C lto --emit link=../$@
build/kernel: kernel/linkers/$(ARCH).ld mk/kernel_ld.sh build/libkernel.a
export PATH="$(PREFIX_PATH):$$PATH" && \
$(ROOT)/mk/kernel_ld.sh $(LD) --gc-sections -z max-page-size=0x1000 -T $< -o $@.all build/libkernel.a && \
$(OBJCOPY) --only-keep-debug $@.all $@.sym && \
$(OBJCOPY) --strip-debug $@.all $@

View file

@ -1,17 +0,0 @@
#!/usr/bin/env bash
set -ex
LD="$1"
shift
if "${LD}" -z use-gs-for-tls 2>&1 |
grep "warning: -z use-gs-for-tls ignored" &> /dev/null
then
echo "Please update your prefix:" >&2
echo " rm -rf prefix" >&2
echo " make prefix" >&2
exit 1
fi
exec "${LD}" -z use-gs-for-tls "$@"