mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-27 12:48:22 +00:00
Makefile: rework
This commit is contained in:
@@ -1,33 +1,42 @@
|
|||||||
ISODIR=$(shell pwd)/iso
|
ISODIR=$(shell pwd)/iso
|
||||||
ISO=astral.iso
|
ISO=astral.iso
|
||||||
|
DISKNAME=hdd.img
|
||||||
LIMINEDIR=$(shell pwd)/host-pkgs/limine/usr/local/share/limine/
|
LIMINEDIR=$(shell pwd)/host-pkgs/limine/usr/local/share/limine/
|
||||||
KERNEL=$(shell pwd)/pkgs/astral/boot/astral
|
KERNEL=$(shell pwd)/builds/astral/astral
|
||||||
QEMUFLAGS=-M q35 -cdrom $(ISO) -m 2G -smp cpus=1 -no-shutdown -no-reboot -monitor stdio -debugcon file:/dev/stdout -serial file:/dev/stdout # hacky but works :')
|
QEMUFLAGS=-M q35 -cdrom $(ISO) -m 4g -smp cpus=1 -no-shutdown -no-reboot -monitor stdio -debugcon file:/dev/stdout -serial file:/dev/stdout -netdev user,id=net0 -device virtio-net,netdev=net0 -object filter-dump,id=f1,netdev=net0,file=netdump.dat
|
||||||
INITRD=$(shell pwd)/iso/initrd
|
QEMUDISKFLAGS=-drive file=$(DISKNAME),if=none,id=nvme -device nvme,serial=deadc0ff,drive=nvme -boot order=dc
|
||||||
|
INITRD=$(shell pwd)/initrds/initrd
|
||||||
DISTROTYPE=full
|
DISTROTYPE=full
|
||||||
|
|
||||||
MINIMALPACKAGES=mlibc bash coreutils init distro-files vim nano mount netd
|
MINIMALPACKAGES=mlibc bash coreutils init distro-files vim nano mount netd shadow sudo neofetch
|
||||||
|
|
||||||
.PHONY: all kernel clean clean-kernel iso initrd full minimal
|
.PHONY: all kernel clean clean-kernel iso initrd full minimal disk
|
||||||
|
|
||||||
all: jinx
|
all: jinx
|
||||||
git submodule update --init --recursive
|
git submodule update --init --recursive
|
||||||
|
mkdir -p $(ISODIR)
|
||||||
make kernel
|
make kernel
|
||||||
make build-$(DISTROTYPE)
|
make build-$(DISTROTYPE)
|
||||||
make $(ISO)
|
make $(ISO)
|
||||||
|
@echo
|
||||||
|
@echo "|------------------------------------------------------------------------------------------|"
|
||||||
|
@echo "|To regenerate the initrd, run 'make initrd iso'. To generate a disk image, run 'make disk'|"
|
||||||
|
@echo "|------------------------------------------------------------------------------------------|"
|
||||||
|
@echo
|
||||||
|
|
||||||
jinx:
|
jinx:
|
||||||
curl https://raw.githubusercontent.com/mintsuki/jinx/99d8151ca5f849e48c38cbe1a232c6a7a1dbc681/jinx > jinx
|
curl https://raw.githubusercontent.com/mintsuki/jinx/99d8151ca5f849e48c38cbe1a232c6a7a1dbc681/jinx > jinx
|
||||||
chmod +x jinx
|
chmod +x jinx
|
||||||
|
|
||||||
$(ISO): limine.cfg liminebg.bmp $(KERNEL) initrd
|
iso: $(ISO)
|
||||||
|
|
||||||
|
$(ISO): limine.cfg liminebg.bmp $(KERNEL) $(INITRD)-$(DISTROTYPE)
|
||||||
mkdir -p $(ISODIR)
|
mkdir -p $(ISODIR)
|
||||||
|
ln -f $(INITRD)-$(DISTROTYPE) $(ISODIR)/initrd
|
||||||
cp $(KERNEL) liminebg.bmp limine.cfg $(LIMINEDIR)/limine-bios.sys $(LIMINEDIR)/limine-bios-cd.bin $(LIMINEDIR)/limine-uefi-cd.bin $(ISODIR)
|
cp $(KERNEL) liminebg.bmp limine.cfg $(LIMINEDIR)/limine-bios.sys $(LIMINEDIR)/limine-bios-cd.bin $(LIMINEDIR)/limine-uefi-cd.bin $(ISODIR)
|
||||||
xorriso -as mkisofs -b limine-bios-cd.bin -no-emul-boot -boot-load-size 4 -boot-info-table --efi-boot limine-uefi-cd.bin -efi-boot-part --efi-boot-image --protective-msdos-label $(ISODIR) -o $(ISO)
|
xorriso -as mkisofs -b limine-bios-cd.bin -no-emul-boot -boot-load-size 4 -boot-info-table --efi-boot limine-uefi-cd.bin -efi-boot-part --efi-boot-image --protective-msdos-label $(ISODIR) -o $(ISO)
|
||||||
|
|
||||||
initrd:
|
# ------ build targets ------
|
||||||
mkdir -p $(ISODIR)
|
|
||||||
make $(DISTROTYPE)
|
|
||||||
|
|
||||||
build-full:
|
build-full:
|
||||||
./jinx build-all
|
./jinx build-all
|
||||||
@@ -35,19 +44,41 @@ build-full:
|
|||||||
build-minimal:
|
build-minimal:
|
||||||
./jinx build $(MINIMALPACKAGES)
|
./jinx build $(MINIMALPACKAGES)
|
||||||
|
|
||||||
full:
|
|
||||||
./jinx sysroot
|
|
||||||
cd sysroot; tar --format=ustar -cf $(INITRD) *
|
|
||||||
|
|
||||||
minimal:
|
|
||||||
./jinx install minimalsysroot $(MINIMALPACKAGES)
|
|
||||||
cd minimalsysroot; tar --format=ustar -cf $(INITRD) *
|
|
||||||
|
|
||||||
kernel:
|
kernel:
|
||||||
rm -f builds/astral.packaged
|
rm -f builds/astral.packaged
|
||||||
rm -f builds/astral.built
|
rm -f builds/astral.built
|
||||||
./jinx build astral
|
./jinx build astral
|
||||||
|
|
||||||
|
# ------ initrd targets ------
|
||||||
|
|
||||||
|
$(INITRD)-full:
|
||||||
|
./jinx sysroot
|
||||||
|
mkdir -p initrds
|
||||||
|
./geninitrd.sh sysroot $(INITRD)-full
|
||||||
|
|
||||||
|
$(INITRD)-minimal:
|
||||||
|
./jinx install minimalsysroot $(MINIMALPACKAGES)
|
||||||
|
mkdir -p initrds
|
||||||
|
./geninitrd.sh minimalsysroot $(INITRD)-minimal
|
||||||
|
|
||||||
|
initrd:
|
||||||
|
rm $(INITRD)-$(DISTROTYPE)
|
||||||
|
make $(INITRD)-$(DISTROTYPE)
|
||||||
|
|
||||||
|
# ------ disk targets ------
|
||||||
|
|
||||||
|
disk: disk-$(DISTROTYPE)
|
||||||
|
|
||||||
|
disk-full:
|
||||||
|
./jinx sysroot
|
||||||
|
./gendisk.sh 4g sysroot $(DISKNAME)
|
||||||
|
|
||||||
|
disk-minimal:
|
||||||
|
./jinx install minimalsysroot $(MINIMALPACKAGES)
|
||||||
|
./gendisk.sh 1g minimalsysroot $(DISKNAME)
|
||||||
|
|
||||||
|
# ------ clean targets ------
|
||||||
|
|
||||||
clean-kernel:
|
clean-kernel:
|
||||||
find builds/astral/ -name *.o -delete
|
find builds/astral/ -name *.o -delete
|
||||||
find builds/astral/ -name *.asmo -delete
|
find builds/astral/ -name *.asmo -delete
|
||||||
@@ -56,6 +87,12 @@ clean:
|
|||||||
make clean-kernel
|
make clean-kernel
|
||||||
./jinx clean
|
./jinx clean
|
||||||
rm jinx
|
rm jinx
|
||||||
|
rm -rf $(ISODIR)
|
||||||
|
rm -f $(ISO)
|
||||||
|
rm -f $(DISKNAME)
|
||||||
|
rm -rf initrds
|
||||||
|
|
||||||
|
# ------ run targets ------
|
||||||
|
|
||||||
run:
|
run:
|
||||||
qemu-system-x86_64 $(QEMUFLAGS)
|
qemu-system-x86_64 $(QEMUFLAGS)
|
||||||
@@ -65,3 +102,12 @@ run-gdb:
|
|||||||
|
|
||||||
run-kvm:
|
run-kvm:
|
||||||
qemu-system-x86_64 $(QEMUFLAGS) -enable-kvm -cpu host
|
qemu-system-x86_64 $(QEMUFLAGS) -enable-kvm -cpu host
|
||||||
|
|
||||||
|
run-disk:
|
||||||
|
qemu-system-x86_64 $(QEMUFLAGS) $(QEMUDISKFLAGS)
|
||||||
|
|
||||||
|
run-disk-gdb:
|
||||||
|
qemu-system-x86_64 $(QEMUFLAGS) $(QEMUDISKFLAGS) -S -s
|
||||||
|
|
||||||
|
run-disk-kvm:
|
||||||
|
qemu-system-x86_64 $(QEMUFLAGS) $(QEMUDISKFLAGS) -enable-kvm -cpu host
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ Astral is a 64 bit operating system with its own kernel written in C for the x86
|
|||||||
- Filesystems: tmpfs, devfs, ext2
|
- Filesystems: tmpfs, devfs, ext2
|
||||||
- Block devices: NVMe, virtio-block
|
- Block devices: NVMe, virtio-block
|
||||||
- Network devices: virtio-net
|
- Network devices: virtio-net
|
||||||
|
- ACPI: thanks to [uACPI](https://github.com/UltraOS/uACPI), there is ACPI support with proper poweroff, etc.
|
||||||
|
|
||||||
## Current Goals
|
## Current Goals
|
||||||
|
|
||||||
@@ -25,10 +26,12 @@ Astral is a 64 bit operating system with its own kernel written in C for the x86
|
|||||||
|
|
||||||
## Building
|
## Building
|
||||||
|
|
||||||
The build process only needs xorriso, curl, zstd and bsdtar on the host. All other needed packages will be installed/built on the container.
|
The build process only needs xorriso, curl, zstd, fakeroot and bsdtar on the host. All other needed packages will be installed/built on the container.
|
||||||
|
|
||||||
To build the project, run ``make``. This will create a file named ``astral.iso``
|
To build the project, run ``make``. This will create a file named ``astral.iso``
|
||||||
|
|
||||||
|
After this, if you wish to create an ext2 disk image, run ``make disk``
|
||||||
|
|
||||||
## Running
|
## Running
|
||||||
You can download the latest release from github and run it in the virtual machine of your liking.
|
You can download the latest release from github and run it in the virtual machine of your liking.
|
||||||
For QEMU the following command is recommended:
|
For QEMU the following command is recommended:
|
||||||
@@ -40,10 +43,6 @@ There are a few targets in the makefile to run Astral with qemu when built from
|
|||||||
|
|
||||||
``make run-kvm``
|
``make run-kvm``
|
||||||
|
|
||||||
VirtualBox-specific instructions:
|
``make run-disk`` (if you built the disk image)
|
||||||
|
|
||||||
Set 1 CPU for the VM\
|
``make run-disk-kvm`` (if you built the disk image)
|
||||||
After you've created a new VM from the iso file:\
|
|
||||||
`vboxmanage list vms`\
|
|
||||||
`vboxmanage modifyvm <name of Astral VM> --hpet on`\
|
|
||||||
Then select "Astral (initrd)" from the boot menu
|
|
||||||
|
|||||||
+15
-16
@@ -4,28 +4,27 @@ TERM_WALLPAPER=boot:///liminebg.bmp
|
|||||||
TERM_WALLPAPER_STYLE=stretched
|
TERM_WALLPAPER_STYLE=stretched
|
||||||
TIMEOUT=5
|
TIMEOUT=5
|
||||||
|
|
||||||
:Astral (initrd)
|
:Astral (X.org, nvme0n1, ext2)
|
||||||
PROTOCOL=limine
|
PROTOCOL=limine
|
||||||
KERNEL_PATH=boot:///astral
|
KERNEL_PATH=boot:///astral
|
||||||
MODULE_PATH=boot:///initrd
|
KERNEL_CMDLINE=rootfs=ext2 root=nvme0n1 initarg=withx nosmp
|
||||||
KERNEL_CMDLINE=initrd rootfs=tmpfs initarg=withx nosmp
|
|
||||||
COMMENT="The Astral operating system"
|
COMMENT="The Astral operating system"
|
||||||
|
|
||||||
:Astral (console, initrd)
|
:Astral (login prompt, nvme0n1, ext2)
|
||||||
|
PROTOCOL=limine
|
||||||
|
KERNEL_PATH=boot:///astral
|
||||||
|
KERNEL_CMDLINE=rootfs=ext2 root=nvme0n1 initarg=withlogin nosmp
|
||||||
|
COMMENT="The Astral operating system"
|
||||||
|
|
||||||
|
:Astral (root shell, nvme0n1, ext2)
|
||||||
|
PROTOCOL=limine
|
||||||
|
KERNEL_PATH=boot:///astral
|
||||||
|
KERNEL_CMDLINE=rootfs=ext2 root=nvme0n1 nosmp
|
||||||
|
COMMENT="The Astral operating system"
|
||||||
|
|
||||||
|
:Astral (root shell, initrd)
|
||||||
PROTOCOL=limine
|
PROTOCOL=limine
|
||||||
KERNEL_PATH=boot:///astral
|
KERNEL_PATH=boot:///astral
|
||||||
MODULE_PATH=boot:///initrd
|
MODULE_PATH=boot:///initrd
|
||||||
KERNEL_CMDLINE=initrd rootfs=tmpfs nosmp
|
KERNEL_CMDLINE=initrd rootfs=tmpfs nosmp
|
||||||
COMMENT="The Astral operating system"
|
COMMENT="The Astral operating system"
|
||||||
|
|
||||||
:Astral (console, vioblk0, ext2)
|
|
||||||
PROTOCOL=limine
|
|
||||||
KERNEL_PATH=boot:///astral
|
|
||||||
KERNEL_CMDLINE=rootfs=ext2 root=vioblk0 initarg=withx nosmp
|
|
||||||
COMMENT="The Astral operating system"
|
|
||||||
|
|
||||||
:Astral (console, vioblk0, ext2, console)
|
|
||||||
PROTOCOL=limine
|
|
||||||
KERNEL_PATH=boot:///astral
|
|
||||||
KERNEL_CMDLINE=rootfs=ext2 root=vioblk0 nosmp
|
|
||||||
COMMENT="The Astral operating system"
|
|
||||||
|
|||||||
Reference in New Issue
Block a user