Cut two 0.1.9 x86_64 images: montauk-0.1.9-x86_64.iso (29 MB) and montauk-0.1.9-sdk-x86_64.iso (194 MB). Both include the NetSurf port and exclude the WIP git port; only the SDK image carries 0:/sdk. GNUmakefile: add RELEASE_WITHOUT_SDK=1 to the release target, mirroring RELEASE_WITH_PORTS. Needed because devkit is .PHONY and repopulates programs/bin/sdk on every build, so the SDK cannot be held out by hand. sdk/tcc and sdk/lua stay (installed by their own targets), as does 0:/tmp, which the libc uses for tmpnam() and not just compiler intermediates. Also strip .release-tmp/boot/kernel. The ramdisk carries its own copy of the kernel -- the image the Installer lays down on the target disk -- and it is not named *.elf, so the existing find missed it. It was shipping unstripped at 6.2 MB against 0.7 MB. Licensing: NetSurf (GPLv2, MIT artwork), the ten NetSurf project libraries (MIT), utf8proc (MIT) and zlib now ship in both images and had no attribution anywhere. Add notices for each, and broaden the stb_image section to cover stb_truetype, which the GUI apps have always linked. The component lists in license.txt and license.html were stale to match; license.txt is the source for 0:/os/licenses/LICENSE.txt, so it ships. downloads.html: 0.1.9 card with separate download links for the plain and SDK images; 0.1.8 moves to the archive. Co-Authored-By: Claude Opus 5 <[email protected]>
371 lines
11 KiB
Makefile
371 lines
11 KiB
Makefile
# Nuke built-in rules and variables.
|
|
MAKEFLAGS += -rR
|
|
.SUFFIXES:
|
|
|
|
# Target architecture to build for. Default to x86_64.
|
|
ARCH := x86_64
|
|
|
|
# Default user QEMU flags. These are appended to the QEMU command calls.
|
|
QEMUFLAGS := -smp 4 -m 2G -d int -D qemu.log -no-reboot
|
|
|
|
override IMAGE_NAME := montauk-$(ARCH)
|
|
|
|
# Toolchain for building the 'limine' executable for the host.
|
|
HOST_CC := cc
|
|
HOST_CFLAGS := -g -O2 -pipe
|
|
HOST_CPPFLAGS :=
|
|
HOST_LDFLAGS :=
|
|
HOST_LIBS :=
|
|
|
|
.PHONY: all
|
|
all: $(IMAGE_NAME).iso
|
|
|
|
.PHONY: all-hdd
|
|
all-hdd: $(IMAGE_NAME).hdd
|
|
|
|
.PHONY: run
|
|
run: run-$(ARCH)
|
|
|
|
.PHONY: run-hdd
|
|
run-hdd: run-hdd-$(ARCH)
|
|
|
|
.PHONY: run-x86_64
|
|
run-x86_64: $(IMAGE_NAME).iso
|
|
qemu-system-$(ARCH) \
|
|
-enable-kvm \
|
|
-M q35 \
|
|
-bios /usr/share/ovmf/OVMF.fd \
|
|
-cdrom $(IMAGE_NAME).iso \
|
|
-device e1000,netdev=net0,mac=52:54:00:68:00:99 \
|
|
-netdev user,id=net0 \
|
|
$(QEMUFLAGS)
|
|
|
|
.PHONY: run-hdd-x86_64
|
|
run-hdd-x86_64: $(IMAGE_NAME).hdd
|
|
qemu-system-$(ARCH) \
|
|
-M q35 \
|
|
-bios /usr/share/ovmf/OVMF.fd \
|
|
-hda $(IMAGE_NAME).hdd \
|
|
-device e1000,netdev=net0,mac=52:54:00:68:00:99 \
|
|
-netdev user,id=net0 \
|
|
$(QEMUFLAGS)
|
|
|
|
.PHONY: run-aarch64
|
|
run-aarch64: $(IMAGE_NAME).iso
|
|
qemu-system-$(ARCH) \
|
|
-M virt \
|
|
-cpu cortex-a72 \
|
|
-device ramfb \
|
|
-device qemu-xhci,id=xhci \
|
|
-device usb-kbd,bus=xhci.0 \
|
|
-device usb-mouse,bus=xhci.0 \
|
|
-bios /usr/share/ovmf/OVMF.fd \
|
|
-cdrom $(IMAGE_NAME).iso \
|
|
$(QEMUFLAGS)
|
|
|
|
.PHONY: run-hdd-aarch64
|
|
run-hdd-aarch64: $(IMAGE_NAME).hdd
|
|
qemu-system-$(ARCH) \
|
|
-M virt \
|
|
-cpu cortex-a72 \
|
|
-device ramfb \
|
|
-device qemu-xhci,id=xhci \
|
|
-device usb-kbd,bus=xhci.0 \
|
|
-device usb-mouse,bus=xhci.0 \
|
|
-bios /usr/share/ovmf/OVMF.fd \
|
|
-hda $(IMAGE_NAME).hdd \
|
|
$(QEMUFLAGS)
|
|
|
|
.PHONY: run-riscv64
|
|
run-riscv64: $(IMAGE_NAME).iso
|
|
qemu-system-$(ARCH) \
|
|
-M virt \
|
|
-cpu rv64 \
|
|
-device ramfb \
|
|
-device qemu-xhci,id=xhci \
|
|
-device usb-kbd,bus=xhci.0 \
|
|
-device usb-mouse,bus=xhci.0 \
|
|
-bios /usr/share/ovmf/OVMF.fd \
|
|
-cdrom $(IMAGE_NAME).iso \
|
|
$(QEMUFLAGS)
|
|
|
|
.PHONY: run-hdd-riscv64
|
|
run-hdd-riscv64: $(IMAGE_NAME).hdd
|
|
qemu-system-$(ARCH) \
|
|
-M virt \
|
|
-cpu rv64 \
|
|
-device ramfb \
|
|
-device qemu-xhci,id=xhci \
|
|
-device usb-kbd,bus=xhci.0 \
|
|
-device usb-mouse,bus=xhci.0 \
|
|
-bios /usr/share/ovmf/OVMF.fd \
|
|
-hda $(IMAGE_NAME).hdd \
|
|
$(QEMUFLAGS)
|
|
|
|
.PHONY: run-loongarch64
|
|
run-loongarch64: $(IMAGE_NAME).iso
|
|
qemu-system-$(ARCH) \
|
|
-M virt \
|
|
-cpu la464 \
|
|
-device ramfb \
|
|
-device qemu-xhci,id=xhci \
|
|
-device usb-kbd,bus=xhci.0 \
|
|
-device usb-mouse,bus=xhci.0 \
|
|
-bios /usr/share/ovmf/OVMF.fd \
|
|
-cdrom $(IMAGE_NAME).iso \
|
|
$(QEMUFLAGS)
|
|
|
|
.PHONY: run-hdd-loongarch64
|
|
run-hdd-loongarch64: $(IMAGE_NAME).hdd
|
|
qemu-system-$(ARCH) \
|
|
-M virt \
|
|
-cpu la464 \
|
|
-device ramfb \
|
|
-device qemu-xhci,id=xhci \
|
|
-device usb-kbd,bus=xhci.0 \
|
|
-device usb-mouse,bus=xhci.0 \
|
|
-bios /usr/share/ovmf/OVMF.fd \
|
|
-hda $(IMAGE_NAME).hdd \
|
|
$(QEMUFLAGS)
|
|
|
|
|
|
.PHONY: run-bios
|
|
run-bios: $(IMAGE_NAME).iso
|
|
qemu-system-$(ARCH) \
|
|
-M q35 \
|
|
-cdrom $(IMAGE_NAME).iso \
|
|
-boot d \
|
|
-device e1000,netdev=net0,mac=52:54:00:68:00:99 \
|
|
-netdev user,id=net0 \
|
|
$(QEMUFLAGS)
|
|
|
|
.PHONY: run-hdd-bios
|
|
run-hdd-bios: $(IMAGE_NAME).hdd
|
|
qemu-system-$(ARCH) \
|
|
-M q35 \
|
|
-hda $(IMAGE_NAME).hdd \
|
|
-device e1000,netdev=net0,mac=52:54:00:68:00:99 \
|
|
-netdev user,id=net0 \
|
|
$(QEMUFLAGS)
|
|
|
|
.PHONY: toolchain
|
|
toolchain:
|
|
./toolchain/build-toolchain.sh
|
|
|
|
# Build the Montauk SDK: native binutils + GCC that run on MontaukOS,
|
|
# shipped into the image at 0:/sdk by the programs/ devkit target.
|
|
# One-time (long) build; idempotent afterwards.
|
|
.PHONY: sdk
|
|
sdk:
|
|
./toolchain/build-native-sdk.sh
|
|
|
|
limine/limine:
|
|
rm -rf limine
|
|
git clone https://github.com/limine-bootloader/limine.git --branch=v9.x-binary --depth=1
|
|
$(MAKE) -C limine \
|
|
CC="$(HOST_CC)" \
|
|
CFLAGS="$(HOST_CFLAGS)" \
|
|
CPPFLAGS="$(HOST_CPPFLAGS)" \
|
|
LDFLAGS="$(HOST_LDFLAGS)" \
|
|
LIBS="$(HOST_LIBS)"
|
|
|
|
kernel-deps:
|
|
./kernel/get-deps
|
|
touch kernel-deps
|
|
|
|
.PHONY: kernel
|
|
kernel: kernel-deps
|
|
$(MAKE) -C kernel
|
|
|
|
.PHONY: programs
|
|
programs:
|
|
$(MAKE) -C programs
|
|
|
|
# Build out-of-tree ports (~/dev/mtkports) and stage their app bundles into
|
|
# programs/bin/apps/. Opt-in: the base ISO ships only what lives in
|
|
# programs/src/, so this is never a dependency of the default build. Run it
|
|
# before 'make ramdisk' to include ports in the image.
|
|
MTKPORTS ?= $(HOME)/dev/mtkports
|
|
|
|
.PHONY: ports
|
|
ports: programs
|
|
@if [ -d "$(MTKPORTS)" ]; then \
|
|
$(MAKE) -C "$(MTKPORTS)" install MONTAUKOS="$(CURDIR)"; \
|
|
else \
|
|
echo "ports: $(MTKPORTS) not found - skipping (set MTKPORTS=/path/to/mtkports)"; \
|
|
fi
|
|
|
|
.PHONY: ramdisk
|
|
ramdisk: limine/limine kernel programs
|
|
mkdir -p programs/bin/boot/limine
|
|
cp -v limine/BOOTX64.EFI programs/bin/boot/limine/
|
|
cp -v limine.conf programs/bin/boot/limine/
|
|
cp -v kernel/bin-$(ARCH)/kernel programs/bin/boot/
|
|
rm -f programs/bin/boot/ramdisk.tar
|
|
./scripts/mkramdisk.sh programs/bin ramdisk.tar
|
|
|
|
$(IMAGE_NAME).iso: limine/limine kernel ramdisk
|
|
rm -rf iso_root
|
|
mkdir -p iso_root/boot
|
|
cp -v kernel/bin-$(ARCH)/kernel iso_root/boot/
|
|
cp -v ramdisk.tar iso_root/boot/
|
|
mkdir -p iso_root/boot/limine
|
|
cp -v limine.conf iso_root/boot/limine/
|
|
mkdir -p iso_root/EFI/BOOT
|
|
ifeq ($(ARCH),x86_64)
|
|
cp -v limine/limine-bios.sys limine/limine-bios-cd.bin limine/limine-uefi-cd.bin iso_root/boot/limine/
|
|
cp -v limine/BOOTX64.EFI iso_root/EFI/BOOT/
|
|
cp -v limine/BOOTIA32.EFI iso_root/EFI/BOOT/
|
|
xorriso -as mkisofs -R -r -J -b boot/limine/limine-bios-cd.bin \
|
|
-no-emul-boot -boot-load-size 4 -boot-info-table -hfsplus \
|
|
-apm-block-size 2048 --efi-boot boot/limine/limine-uefi-cd.bin \
|
|
-efi-boot-part --efi-boot-image --protective-msdos-label \
|
|
iso_root -o $(IMAGE_NAME).iso
|
|
./limine/limine bios-install $(IMAGE_NAME).iso
|
|
endif
|
|
ifeq ($(ARCH),aarch64)
|
|
cp -v limine/limine-uefi-cd.bin iso_root/boot/limine/
|
|
cp -v limine/BOOTAA64.EFI iso_root/EFI/BOOT/
|
|
xorriso -as mkisofs -R -r -J \
|
|
-hfsplus -apm-block-size 2048 \
|
|
--efi-boot boot/limine/limine-uefi-cd.bin \
|
|
-efi-boot-part --efi-boot-image --protective-msdos-label \
|
|
iso_root -o $(IMAGE_NAME).iso
|
|
endif
|
|
ifeq ($(ARCH),riscv64)
|
|
cp -v limine/limine-uefi-cd.bin iso_root/boot/limine/
|
|
cp -v limine/BOOTRISCV64.EFI iso_root/EFI/BOOT/
|
|
xorriso -as mkisofs -R -r -J \
|
|
-hfsplus -apm-block-size 2048 \
|
|
--efi-boot boot/limine/limine-uefi-cd.bin \
|
|
-efi-boot-part --efi-boot-image --protective-msdos-label \
|
|
iso_root -o $(IMAGE_NAME).iso
|
|
endif
|
|
ifeq ($(ARCH),loongarch64)
|
|
cp -v limine/limine-uefi-cd.bin iso_root/boot/limine/
|
|
cp -v limine/BOOTLOONGARCH64.EFI iso_root/EFI/BOOT/
|
|
xorriso -as mkisofs -R -r -J \
|
|
-hfsplus -apm-block-size 2048 \
|
|
--efi-boot boot/limine/limine-uefi-cd.bin \
|
|
-efi-boot-part --efi-boot-image --protective-msdos-label \
|
|
iso_root -o $(IMAGE_NAME).iso
|
|
endif
|
|
rm -rf iso_root
|
|
|
|
.PHONY: release
|
|
release: limine/limine kernel ramdisk
|
|
rm -rf iso_root .release-tmp
|
|
mkdir -p iso_root/boot
|
|
cp kernel/bin-$(ARCH)/kernel iso_root/boot/
|
|
strip iso_root/boot/kernel
|
|
cp -r programs/bin .release-tmp
|
|
# A release ISO ships only in-tree apps, so drop any out-of-tree port bundles
|
|
# that happen to be staged in programs/bin/apps (each carries a .port marker).
|
|
# Pass RELEASE_WITH_PORTS=1 to deliberately cut a ports-included image.
|
|
ifneq ($(RELEASE_WITH_PORTS),1)
|
|
@for m in $$(find .release-tmp/apps -name .port 2>/dev/null); do \
|
|
d=$$(dirname $$m); \
|
|
echo "release: excluding port bundle $$(basename $$d)"; \
|
|
rm -rf "$$d"; \
|
|
done
|
|
else
|
|
@echo "release: RELEASE_WITH_PORTS=1 - including out-of-tree port bundles"
|
|
endif
|
|
# The Montauk SDK (native GCC + binutils and their target sysroot under
|
|
# 0:/sdk) dominates the image size. Pass RELEASE_WITHOUT_SDK=1 to cut a slim
|
|
# ISO without it. Only the devkit-owned subtrees go: sdk/tcc and sdk/lua are
|
|
# installed by their own targets and stay, as does 0:/tmp, which the libc
|
|
# uses for tmpnam() and not just for compiler intermediates.
|
|
ifeq ($(RELEASE_WITHOUT_SDK),1)
|
|
@echo "release: RELEASE_WITHOUT_SDK=1 - excluding the Montauk SDK (0:/sdk dev tools)"
|
|
rm -rf .release-tmp/sdk/bin .release-tmp/sdk/lib .release-tmp/sdk/include \
|
|
.release-tmp/sdk/libexec .release-tmp/sdk/x86_64-montauk
|
|
endif
|
|
find .release-tmp -name '*.elf' -exec strip {} +
|
|
# The ramdisk carries its own copy of the kernel at 0:/boot/kernel -- that is
|
|
# the image the Installer lays down on the target disk -- and it is not named
|
|
# *.elf, so the find above misses it. Unstripped it is ~6 MB against ~0.7 MB.
|
|
strip .release-tmp/boot/kernel
|
|
./scripts/mkramdisk.sh .release-tmp iso_root/boot/ramdisk.tar
|
|
rm -rf .release-tmp
|
|
mkdir -p iso_root/boot/limine
|
|
cp limine.conf iso_root/boot/limine/
|
|
mkdir -p iso_root/EFI/BOOT
|
|
ifeq ($(ARCH),x86_64)
|
|
cp limine/limine-bios.sys limine/limine-bios-cd.bin limine/limine-uefi-cd.bin iso_root/boot/limine/
|
|
cp limine/BOOTX64.EFI iso_root/EFI/BOOT/
|
|
cp limine/BOOTIA32.EFI iso_root/EFI/BOOT/
|
|
xorriso -as mkisofs -R -r -J -b boot/limine/limine-bios-cd.bin \
|
|
-no-emul-boot -boot-load-size 4 -boot-info-table -hfsplus \
|
|
-apm-block-size 2048 --efi-boot boot/limine/limine-uefi-cd.bin \
|
|
-efi-boot-part --efi-boot-image --protective-msdos-label \
|
|
iso_root -o $(IMAGE_NAME).iso
|
|
./limine/limine bios-install $(IMAGE_NAME).iso
|
|
endif
|
|
ifeq ($(ARCH),aarch64)
|
|
cp limine/limine-uefi-cd.bin iso_root/boot/limine/
|
|
cp limine/BOOTAA64.EFI iso_root/EFI/BOOT/
|
|
xorriso -as mkisofs -R -r -J \
|
|
-hfsplus -apm-block-size 2048 \
|
|
--efi-boot boot/limine/limine-uefi-cd.bin \
|
|
-efi-boot-part --efi-boot-image --protective-msdos-label \
|
|
iso_root -o $(IMAGE_NAME).iso
|
|
endif
|
|
ifeq ($(ARCH),riscv64)
|
|
cp limine/limine-uefi-cd.bin iso_root/boot/limine/
|
|
cp limine/BOOTRISCV64.EFI iso_root/EFI/BOOT/
|
|
xorriso -as mkisofs -R -r -J \
|
|
-hfsplus -apm-block-size 2048 \
|
|
--efi-boot boot/limine/limine-uefi-cd.bin \
|
|
-efi-boot-part --efi-boot-image --protective-msdos-label \
|
|
iso_root -o $(IMAGE_NAME).iso
|
|
endif
|
|
ifeq ($(ARCH),loongarch64)
|
|
cp limine/limine-uefi-cd.bin iso_root/boot/limine/
|
|
cp limine/BOOTLOONGARCH64.EFI iso_root/EFI/BOOT/
|
|
xorriso -as mkisofs -R -r -J \
|
|
-hfsplus -apm-block-size 2048 \
|
|
--efi-boot boot/limine/limine-uefi-cd.bin \
|
|
-efi-boot-part --efi-boot-image --protective-msdos-label \
|
|
iso_root -o $(IMAGE_NAME).iso
|
|
endif
|
|
rm -rf iso_root
|
|
|
|
$(IMAGE_NAME).hdd: limine/limine kernel ramdisk
|
|
rm -f $(IMAGE_NAME).hdd
|
|
dd if=/dev/zero bs=1M count=0 seek=64 of=$(IMAGE_NAME).hdd
|
|
PATH=$$PATH:/usr/sbin:/sbin sgdisk $(IMAGE_NAME).hdd -n 1:2048 -t 1:ef00
|
|
ifeq ($(ARCH),x86_64)
|
|
./limine/limine bios-install $(IMAGE_NAME).hdd
|
|
endif
|
|
mformat -i $(IMAGE_NAME).hdd@@1M
|
|
mmd -i $(IMAGE_NAME).hdd@@1M ::/EFI ::/EFI/BOOT ::/boot ::/boot/limine
|
|
mcopy -i $(IMAGE_NAME).hdd@@1M kernel/bin-$(ARCH)/kernel ::/boot
|
|
mcopy -i $(IMAGE_NAME).hdd@@1M ramdisk.tar ::/boot
|
|
mcopy -i $(IMAGE_NAME).hdd@@1M limine.conf ::/boot/limine
|
|
ifeq ($(ARCH),x86_64)
|
|
mcopy -i $(IMAGE_NAME).hdd@@1M limine/limine-bios.sys ::/boot/limine
|
|
mcopy -i $(IMAGE_NAME).hdd@@1M limine/BOOTX64.EFI ::/EFI/BOOT
|
|
mcopy -i $(IMAGE_NAME).hdd@@1M limine/BOOTIA32.EFI ::/EFI/BOOT
|
|
endif
|
|
ifeq ($(ARCH),aarch64)
|
|
mcopy -i $(IMAGE_NAME).hdd@@1M limine/BOOTAA64.EFI ::/EFI/BOOT
|
|
endif
|
|
ifeq ($(ARCH),riscv64)
|
|
mcopy -i $(IMAGE_NAME).hdd@@1M limine/BOOTRISCV64.EFI ::/EFI/BOOT
|
|
endif
|
|
ifeq ($(ARCH),loongarch64)
|
|
mcopy -i $(IMAGE_NAME).hdd@@1M limine/BOOTLOONGARCH64.EFI ::/EFI/BOOT
|
|
endif
|
|
|
|
.PHONY: clean
|
|
clean:
|
|
$(MAKE) -C kernel clean
|
|
# $(MAKE) -C programs clean
|
|
rm -rf iso_root .release-tmp $(IMAGE_NAME).iso $(IMAGE_NAME).hdd ramdisk.tar
|
|
|
|
.PHONY: distclean
|
|
distclean:
|
|
$(MAKE) -C kernel distclean
|
|
rm -rf iso_root *.iso *.hdd kernel-deps limine ovmf
|