diff --git a/.gitmodules b/.gitmodules index 03821ac..679984e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,7 +1,3 @@ -[submodule "bootloader"] - path = bootloader - url = https://gitlab.redox-os.org/redox-os/bootloader.git - branch = master [submodule "cookbook"] path = cookbook url = https://gitlab.redox-os.org/redox-os/cookbook.git @@ -26,7 +22,3 @@ path = relibc url = https://gitlab.redox-os.org/redox-os/relibc.git branch = master -[submodule "bootloader-coreboot"] - path = bootloader-coreboot - url = https://gitlab.redox-os.org/redox-os/bootloader-coreboot.git - branch = master diff --git a/bootloader b/bootloader deleted file mode 160000 index 91703d9..0000000 --- a/bootloader +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 91703d9efd0af54fa53627f63161c4b0f5a9554c diff --git a/bootloader-coreboot b/bootloader-coreboot deleted file mode 160000 index 6c31909..0000000 --- a/bootloader-coreboot +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 6c31909f75f3d707efa606e546113ee508be0748 diff --git a/installer b/installer index f1a806b..e8e4687 160000 --- a/installer +++ b/installer @@ -1 +1 @@ -Subproject commit f1a806b28824d4dacaa93201470782b06a312cea +Subproject commit e8e4687c050f1fa783af783eac172e77ad3e752b diff --git a/mk/config.mk b/mk/config.mk index 19769ba..8a59e8c 100644 --- a/mk/config.mk +++ b/mk/config.mk @@ -56,30 +56,6 @@ INSTALLER=\ export PATH="$(PREFIX_PATH):$$PATH" && \ installer/target/release/redox_installer $(INSTALLER_FLAGS) -## Bootloader variables -ifeq ($(ARCH),x86_64) - BOOTLOADER_BIOS=build/bootloader.bin - BOOTLOADER_BIOS_LIVE=build/bootloader-live.bin - BOOTLOADER_EFI=build/bootloader.efi - BOOTLOADER_EFI_LIVE=build/bootloader-live.efi - BOOTLOADER_EFI_PATH=efi/boot/bootx64.efi - BOOTLOADER_TARGET=x86-unknown-none -else ifeq ($(ARCH),i686) - BOOTLOADER_BIOS=build/bootloader.bin - BOOTLOADER_BIOS_LIVE=build/bootloader-live.bin - BOOTLOADER_EFI_PATH=efi/boot/bootia32.efi - BOOTLOADER_TARGET=x86-unknown-none -else ifeq ($(ARCH),aarch64) - BOOTLOADER_EFI=build/bootloader.efi - BOOTLOADER_EFI_LIVE=build/bootloader-live.efi - BOOTLOADER_EFI_PATH=efi/boot/bootaa64.efi - BOOTLOADER_TARGET=aarch64-unknown-none -else -$(error Unsupported ARCH for bootloader "$(ARCH)") -endif -EFI_TARGET=$(ARCH)-unknown-uefi -PARTED=/sbin/parted - ## Cross compiler variables AR=$(TARGET)-gcc-ar AS=$(TARGET)-as diff --git a/mk/disk.mk b/mk/disk.mk index fd04325..e138319 100644 --- a/mk/disk.mk +++ b/mk/disk.mk @@ -1,22 +1,18 @@ -build/harddrive.bin: build/filesystem.bin $(BOOTLOADER_EFI) $(BOOTLOADER_BIOS) - rm -f $@ $@.partial - env \ - PARTED=$(PARTED) \ - BOOTLOADER_EFI=$(BOOTLOADER_EFI) \ - BOOTLOADER_EFI_PATH=$(BOOTLOADER_EFI_PATH) \ - BOOTLOADER_BIOS=$(BOOTLOADER_BIOS) \ - ./mk/disk.sh $@.partial $< - mv "$@.partial" "$@" +build/harddrive.bin: $(FILESYSTEM_CONFIG) + $(HOST_CARGO) build --manifest-path installer/Cargo.toml --release + mkdir -p build + rm -rf $@ $@.partial + fallocate --posix --length "$(FILESYSTEM_SIZE)MiB" $@.partial + $(INSTALLER) -c $(FILESYSTEM_CONFIG) $@.partial + mv $@.partial $@ -build/livedisk.bin: build/filesystem.bin $(BOOTLOADER_EFI_LIVE) $(BOOTLOADER_BIOS_LIVE) - rm -f $@ $@.partial - env \ - PARTED=$(PARTED) \ - BOOTLOADER_EFI=$(BOOTLOADER_EFI_LIVE) \ - BOOTLOADER_EFI_PATH=$(BOOTLOADER_EFI_PATH) \ - BOOTLOADER_BIOS=$(BOOTLOADER_BIOS_LIVE) \ - ./mk/disk.sh $@.partial $< - mv "$@.partial" "$@" +build/livedisk.bin: $(FILESYSTEM_CONFIG) + $(HOST_CARGO) build --manifest-path installer/Cargo.toml --release + mkdir -p build + rm -rf $@ $@.partial + fallocate --posix --length "$(FILESYSTEM_SIZE)MiB" $@.partial + $(INSTALLER) -c $(FILESYSTEM_CONFIG) --live $@.partial + mv $@.partial $@ build/livedisk.iso: build/livedisk.bin.gz rm -rf build/iso/ @@ -27,3 +23,22 @@ build/livedisk.iso: build/livedisk.bin.gz -no-emul-boot -boot-load-size 4 -boot-info-table \ build/iso/ isohybrid $@ + +mount: FORCE + mkdir -p build/filesystem/ + $(HOST_CARGO) build --manifest-path redoxfs/Cargo.toml --release --bin redoxfs + redoxfs/target/release/redoxfs build/harddrive.bin build/filesystem/ + sleep 2 + pgrep redoxfs + +mount_extra: FORCE + mkdir -p build/filesystem/ + $(HOST_CARGO) build --manifest-path redoxfs/Cargo.toml --release --bin redoxfs + redoxfs/target/release/redoxfs build/extra.bin build/filesystem/ + sleep 2 + pgrep redoxfs + +unmount: FORCE + sync + -$(FUMOUNT) build/filesystem/ || true + rm -rf build/filesystem/ diff --git a/mk/disk.sh b/mk/disk.sh deleted file mode 100755 index 89c2e3a..0000000 --- a/mk/disk.sh +++ /dev/null @@ -1,81 +0,0 @@ -#!/usr/bin/env bash - -#TODO: move to installer - -function usage { - echo "$0 [disk] [filesystem]" >&2 - exit 1 -} - -if [ -z "$1" ] -then - echo "invalid disk '$1'" >&2 - usage -fi -DISK="$1" - -if [ ! -f "$2" ] -then - echo "invalid filesystem '$2'" >&2 - usage -fi -FILESYSTEM="$2" - -MiB=1048576 - -set -ex - -# Calculate filesystem partition size -fs_disk_size="$(du -m "${FILESYSTEM}" | cut -f1)" -fs_disk_blkcount="$(expr "${fs_disk_size}" \* "$(expr "${MiB}" / 512)")" -fs_start="2048" -fs_end="$(expr "${fs_start}" + "${fs_disk_blkcount}")" -fs_last="$(expr "${fs_end}" - 1)" - -if [ -n "${BOOTLOADER_EFI}" ] -then - # Calculate EFI partition size - efi_disk_size="$(expr "$(du -m "${BOOTLOADER_EFI}" | cut -f1)" + 1)" - efi_disk_blkcount="$(expr "$efi_disk_size" \* "$(expr "${MiB}" / 512)")" - efi_start="${fs_end}" - efi_end="$(expr "${efi_start}" + "${efi_disk_blkcount}")" - efi_last="$(expr "${efi_end}" - 1)" - - # Populate an EFI system partition - dd if=/dev/zero of="${DISK}.esp" bs="${MiB}" count="${efi_disk_size}" - mkfs.vfat "${DISK}.esp" - mmd -i "${DISK}.esp" efi - mmd -i "${DISK}.esp" efi/boot - mcopy -i "${DISK}.esp" "${BOOTLOADER_EFI}" "::${BOOTLOADER_EFI_PATH}" - - disk_size="$(expr "${fs_disk_size}" + "${efi_disk_size}" + 2)" -else - disk_size="$(expr "${fs_disk_size}" + 2)" -fi - -# Create the disk -dd if=/dev/zero of="${DISK}" bs="${MiB}" count="${disk_size}" - -# Create partition table -"${PARTED}" -s -a minimal "${DISK}" mklabel gpt -"${PARTED}" -s -a minimal "${DISK}" mkpart redox ext4 "${fs_start}s" "${fs_last}"s -if [ -n "${BOOTLOADER_EFI}" ] -then - "${PARTED}" -s -a minimal "${DISK}" mkpart EFI fat32 "${efi_start}"s "${efi_last}s" - "${PARTED}" -s -a minimal "${DISK}" set 2 boot on - "${PARTED}" -s -a minimal "${DISK}" set 2 esp on -fi - -# Write the partitions -dd if="${FILESYSTEM}" of="${DISK}" bs=512 seek="${fs_start}" count="${fs_disk_blkcount}" conv=notrunc -if [ -n "${BOOTLOADER_EFI}" ] -then - dd if="${DISK}.esp" of="${DISK}" bs=512 seek="${efi_start}" count="${efi_disk_blkcount}" conv=notrunc -fi - -# Write BIOS bootloader if applicable -if [ -n "${BOOTLOADER_BIOS}" ] -then - dd if="${BOOTLOADER_BIOS}" of="${DISK}" bs=1 count=446 conv=notrunc - dd if="${BOOTLOADER_BIOS}" of="${DISK}" bs=512 skip=34 seek=34 conv=notrunc -fi diff --git a/mk/filesystem.mk b/mk/filesystem.mk deleted file mode 100644 index aad6907..0000000 --- a/mk/filesystem.mk +++ /dev/null @@ -1,43 +0,0 @@ -build/filesystem.bin: prefix $(FILESYSTEM_CONFIG) - mkdir -p build - $(HOST_CARGO) build --manifest-path cookbook/Cargo.toml --release - $(HOST_CARGO) build --manifest-path installer/Cargo.toml --release - $(HOST_CARGO) build --manifest-path redoxfs/Cargo.toml --release - -$(FUMOUNT) build/filesystem/ || true - rm -rf $@ $@.partial build/filesystem/ - fallocate --posix --length "$(FILESYSTEM_SIZE)MiB" $@.partial - $(HOST_CARGO) run --release \ - --manifest-path redoxfs/Cargo.toml \ - --bin redoxfs-mkfs \ - -- $(REDOXFS_MKFS_FLAGS) $@.partial - mkdir -p build/filesystem/ - redoxfs/target/release/redoxfs $@.partial build/filesystem/ - sleep 2 - pgrep redoxfs - $(INSTALLER) -c $(FILESYSTEM_CONFIG) build/filesystem/ - cp -v $(FILESYSTEM_CONFIG) build/filesystem/filesystem.toml - mkdir -pv build/filesystem/pkg - cp -v cookbook/build/id_ed25519.pub.toml build/filesystem/pkg/id_ed25519.pub.toml - sync - -$(FUMOUNT) build/filesystem/ || true - rm -rf build/filesystem/ - mv $@.partial $@ - -mount: FORCE - mkdir -p build/filesystem/ - $(HOST_CARGO) build --manifest-path redoxfs/Cargo.toml --release --bin redoxfs - redoxfs/target/release/redoxfs build/harddrive.bin build/filesystem/ - sleep 2 - pgrep redoxfs - -mount_extra: FORCE - mkdir -p build/filesystem/ - $(HOST_CARGO) build --manifest-path redoxfs/Cargo.toml --release --bin redoxfs - redoxfs/target/release/redoxfs build/extra.bin build/filesystem/ - sleep 2 - pgrep redoxfs - -unmount: FORCE - sync - -$(FUMOUNT) build/filesystem/ || true - rm -rf build/filesystem/