WIP changes for rust bootloader
This commit is contained in:
parent
7e0938d674
commit
35cd0b2ab0
10 changed files with 40 additions and 31 deletions
|
@ -1,2 +1,2 @@
|
|||
bochs: build/livedisk.bin
|
||||
bochs: build/harddrive.bin
|
||||
bochs -f bochs.$(ARCH)
|
||||
|
|
23
mk/bootloader.mk
Normal file
23
mk/bootloader.mk
Normal file
|
@ -0,0 +1,23 @@
|
|||
bootloader/build/$(BOOTLOADER_TARGET)/bootloader.bin: FORCE
|
||||
env --unset=RUST_TARGET_PATH --unset=RUSTUP_TOOLCHAIN --unset=XARGO_RUST_SRC \
|
||||
$(MAKE) -C bootloader build/$(BOOTLOADER_TARGET)/bootloader.bin TARGET=$(BOOTLOADER_TARGET)
|
||||
|
||||
build/bootloader.bin: bootloader/build/$(BOOTLOADER_TARGET)/bootloader.bin
|
||||
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 $< $@
|
||||
|
||||
bootloader-efi/build/$(EFI_TARGET)/boot.efi: FORCE
|
||||
env --unset=RUST_TARGET_PATH --unset=RUSTUP_TOOLCHAIN --unset=XARGO_RUST_SRC \
|
||||
$(MAKE) -C bootloader-efi build/$(EFI_TARGET)/boot.efi TARGET=$(EFI_TARGET)
|
||||
|
||||
build/bootloader.efi: bootloader-efi/build/$(EFI_TARGET)/boot.efi
|
||||
mkdir -p build
|
||||
cp -v $< $@
|
|
@ -55,6 +55,11 @@ INSTALLER=\
|
|||
installer/target/release/redox_installer $(INSTALLER_FLAGS)
|
||||
|
||||
## Bootloader variables
|
||||
ifeq ($(ARCH),x86_64)
|
||||
BOOTLOADER_TARGET=x86-unknown-none
|
||||
else
|
||||
BOOTLOADER_TARGET=$(ARCH)-unknown-none
|
||||
endif
|
||||
EFI_TARGET=$(ARCH)-unknown-uefi
|
||||
PARTED=/sbin/parted
|
||||
|
||||
|
|
27
mk/disk.mk
27
mk/disk.mk
|
@ -1,14 +1,9 @@
|
|||
build/bootloader: bootloader/$(ARCH)/**
|
||||
mkdir -p build
|
||||
nasm -f bin -o $@ -D ARCH_$(ARCH) -ibootloader/$(ARCH)/ bootloader/$(ARCH)/disk.asm
|
||||
|
||||
build/harddrive.bin: build/filesystem.bin bootloader/$(ARCH)/**
|
||||
nasm -f bin -o build/bootsector.bin -D ARCH_$(ARCH) -ibootloader/$(ARCH)/ bootloader/$(ARCH)/disk.asm
|
||||
build/harddrive.bin: build/filesystem.bin build/bootloader.bin
|
||||
dd if=/dev/zero of=$@.partial bs=1M count=$$(expr $$(du -m $< | cut -f1) + 2)
|
||||
$(PARTED) -s -a minimal $@.partial mklabel msdos
|
||||
$(PARTED) -s -a minimal $@.partial mkpart primary 2048s $$(expr $$(du -m $< | cut -f1) \* 2048 + 2048)s
|
||||
dd if=build/bootsector.bin of=$@.partial bs=1 count=446 conv=notrunc
|
||||
dd if=build/bootsector.bin of=$@.partial bs=512 skip=1 seek=1 conv=notrunc
|
||||
dd if=build/bootloader.bin of=$@.partial bs=1 count=446 conv=notrunc
|
||||
dd if=build/bootloader.bin of=$@.partial bs=512 skip=1 seek=1 conv=notrunc
|
||||
dd if=$< of=$@.partial bs=1M seek=1 conv=notrunc
|
||||
mv $@.partial $@
|
||||
|
||||
|
@ -25,22 +20,6 @@ build/livedisk.iso: build/livedisk.bin.gz
|
|||
build/iso/
|
||||
isohybrid $@
|
||||
|
||||
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 $< $@
|
||||
|
||||
bootloader-efi/build/$(EFI_TARGET)/boot.efi: FORCE
|
||||
env --unset=RUST_TARGET_PATH --unset=RUSTUP_TOOLCHAIN --unset=XARGO_RUST_SRC \
|
||||
$(MAKE) -C bootloader-efi build/$(EFI_TARGET)/boot.efi TARGET=$(EFI_TARGET)
|
||||
|
||||
build/bootloader.efi: bootloader-efi/build/$(EFI_TARGET)/boot.efi
|
||||
mkdir -p build
|
||||
cp -v $< $@
|
||||
|
||||
build/harddrive-efi.bin: build/bootloader.efi build/filesystem.bin
|
||||
# TODO: Validate the correctness of this \
|
||||
# Populate an EFI system partition \
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
build/filesystem.bin: filesystem.toml build/bootloader build/kernel prefix
|
||||
build/filesystem.bin: filesystem.toml build/kernel prefix
|
||||
cargo build --manifest-path cookbook/Cargo.toml --release
|
||||
cargo build --manifest-path installer/Cargo.toml --release
|
||||
cargo build --manifest-path redoxfs/Cargo.toml --release
|
||||
|
@ -11,7 +11,6 @@ build/filesystem.bin: filesystem.toml build/bootloader build/kernel prefix
|
|||
sleep 2
|
||||
pgrep redoxfs
|
||||
cp $< build/filesystem/filesystem.toml
|
||||
cp build/bootloader build/filesystem/bootloader
|
||||
cp build/kernel build/filesystem/kernel
|
||||
cp -r $(ROOT)/$(PREFIX_INSTALL)/$(TARGET)/include build/filesystem/include
|
||||
cp -r $(ROOT)/$(PREFIX_INSTALL)/$(TARGET)/lib build/filesystem/lib
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue