Skip to content

Commit

Permalink
Bulk update recipes and make sure system builds
Browse files Browse the repository at this point in the history
  • Loading branch information
mintsuki committed Dec 12, 2023
1 parent 5887134 commit 3156a8b
Show file tree
Hide file tree
Showing 230 changed files with 3,882 additions and 936 deletions.
25 changes: 14 additions & 11 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
jinx
builds
host-builds
host-pkgs
pkgs
sources
sysroot
iso_root
vinix.iso
initramfs.tar

/jinx
/builds
/host-builds
/host-pkgs
/pkgs
/sources
/sysroot
/iso_root
/vinix.iso
/initramfs.tar
/.vscode
/.jinx-cache
/ovmf
*.hdd
*.elf
*.bin
*.a
Expand Down
40 changes: 26 additions & 14 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,24 @@
# Code is governed by the GPL-2.0 license.
# Copyright (C) 2021-2022 The Vinix authors.

QEMUFLAGS ?= -M q35,smm=off -m 8G -cdrom vinix.iso -serial stdio
QEMUFLAGS ?= -M q35,smm=off -m 8G -cdrom vinix.iso -serial stdio -smp 4

.PHONY: all
all: jinx
./jinx build base-files kernel init util-vinix
all:
rm -f vinix.iso
$(MAKE) vinix.iso

vinix.iso: jinx
rm -f builds/kernel.built builds/kernel.packaged
$(MAKE) distro-base
./build-support/makeiso.sh

.PHONY: debug
debug:
JINX_CONFIG_FILE=jinx-config-debug $(MAKE) all

jinx:
curl -o jinx https://raw.githubusercontent.com/mintsuki/jinx/trunk/jinx
curl -Lo jinx https://github.com/mintsuki/jinx/raw/b06cbf4cf142ff0f3aa0ab8438ede29951887b43/jinx
chmod +x jinx

.PHONY: distro-full
Expand All @@ -23,30 +28,35 @@ distro-full: jinx

.PHONY: distro-base
distro-base: jinx
./jinx build bash coreutils
./jinx build base-files kernel init bash coreutils nano less binutils gcc util-vinix

.PHONY: run-kvm
run-kvm: vinix.iso
qemu-system-x86_64 -enable-kvm -cpu host $(QEMUFLAGS) -smp 1
qemu-system-x86_64 -enable-kvm -cpu host $(QEMUFLAGS)

.PHONY: run-hvf
run-hvf: vinix.iso
qemu-system-x86_64 -accel hvf -cpu host $(QEMUFLAGS) -smp 4
qemu-system-x86_64 -accel hvf -cpu host $(QEMUFLAGS)

ovmf:
mkdir -p ovmf
cd ovmf && curl -o OVMF-X64.zip https://efi.akeo.ie/OVMF/OVMF-X64.zip && 7z x OVMF-X64.zip
cd ovmf && curl -o OVMF.fd https://retrage.github.io/edk2-nightly/bin/RELEASEX64_OVMF.fd

.PHONY: run-uefi
run-uefi: ovmf
qemu-system-x86_64 -enable-kvm -cpu host $(QEMUFLAGS) -smp 4 -bios ovmf/OVMF.fd
run-uefi: vinix.iso ovmf
qemu-system-x86_64 -enable-kvm -cpu host $(QEMUFLAGS) -bios ovmf/OVMF.fd

.PHONY: run-bochs
run-bochs: vinix.iso
bochs -f bochsrc
run-lingemu: vinix.iso

.PHONY: run-lingemu
run-lingemu: vinix.iso
lingemu runvirt -m 8192 --diskcontroller type=ahci,name=ahcibus1 --disk vinix.iso,disktype=cdrom,controller=ahcibus1

.PHONY: run
run: vinix.iso
qemu-system-x86_64 $(QEMUFLAGS) -no-shutdown -no-reboot -d int -smp 1
qemu-system-x86_64 $(QEMUFLAGS)

.PHONY: kernel-clean
kernel-clean:
Expand All @@ -72,7 +82,9 @@ clean: kernel-clean util-vinix-clean init-clean base-files-clean
rm -rf iso_root sysroot vinix.iso initramfs.tar

.PHONY: distclean
distclean: clean jinx
distclean: jinx
make -C kernel distclean
./jinx clean
rm jinx
rm -rf iso_root sysroot vinix.iso initramfs.tar jinx ovmf
chmod -R 777 .jinx-cache
rm -rf .jinx-cache
7 changes: 4 additions & 3 deletions build-support/checklibs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

set -e

rm -rf sysroot
./jinx sysroot
for i in $(find ./sysroot/ -name '*.so*'); do readelf -d $i 2>/dev/null | grep NEEDED | grep libc.so.6 && echo $i; done
TMPDIR="$(mktemp -d)"
./jinx install "$TMPDIR" '*'
for i in $(find "$TMPDIR"/ -name '*.so*'); do readelf -d $i 2>/dev/null | grep NEEDED | grep libc.so.6 && echo $i; done
rm -rf "$TMPDIR"
7 changes: 4 additions & 3 deletions build-support/checklibtool.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

set -e

rm -rf sysroot
./jinx sysroot
find ./sysroot/ -name '*.la'
TMPDIR="$(mktemp -d)"
./jinx install "$TMPDIR" '*'
find "$TMPDIR"/ -name '*.la'
rm -rf "$TMPDIR"
7 changes: 4 additions & 3 deletions build-support/checkstatic.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

set -e

rm -rf sysroot
./jinx sysroot
find ./sysroot/ -name '*.a'
TMPDIR="$(mktemp -d)"
./jinx install "$TMPDIR" '*'
find "$TMPDIR"/ -name '*.a'
rm -rf "$TMPDIR"
8 changes: 8 additions & 0 deletions build-support/checkstripped.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#! /bin/sh

set -e

TMPDIR="$(mktemp -d)"
./jinx install "$TMPDIR" '*'
for f in $(find "$TMPDIR"); do file "$f" | grep 'not stripped' || true; done
rm -rf "$TMPDIR"
2 changes: 1 addition & 1 deletion build-support/cross_file.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ c = 'x86_64-vinix-gcc'
cpp = 'x86_64-vinix-g++'
ar = 'x86_64-vinix-ar'
strip = 'x86_64-vinix-strip'
pkgconfig = 'x86_64-vinix-pkg-config'
pkg-config = 'x86_64-vinix-pkg-config'
# sed adds binaries here.

[host_machine]
Expand Down
25 changes: 14 additions & 11 deletions build-support/makeiso.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,31 @@
set -ex

# Build the sysroot with jinx and build limine.
rm -rf sysroot
./jinx sysroot
./jinx host-build limine

# Make an initramfs with the sysroot.
(cd sysroot && tar cf ../initramfs.tar *)
( cd sysroot && tar cf ../initramfs.tar * )

# Prepare the iso and boot directories.
rm -rf iso_root
mkdir -pv iso_root/boot
cp -r sysroot/boot/vinix.elf iso_root/boot/
cp -r initramfs.tar iso_root/boot/
cp -r build-support/limine.cfg build-support/background.bmp iso_root/boot/
cp sysroot/boot/vinix.elf iso_root/boot/
cp initramfs.tar iso_root/boot/
cp build-support/limine.cfg build-support/background.bmp iso_root/boot/

# Install the limine binaries.
cp -r host-pkgs/limine/usr/local/share/limine/limine.sys iso_root/boot/
cp -r host-pkgs/limine/usr/local/share/limine/limine-cd.bin iso_root/boot/
cp -r host-pkgs/limine/usr/local/share/limine/limine-cd-efi.bin iso_root/boot/
cp host-pkgs/limine/usr/local/share/limine/limine-bios.sys iso_root/boot/
cp host-pkgs/limine/usr/local/share/limine/limine-bios-cd.bin iso_root/boot/
cp host-pkgs/limine/usr/local/share/limine/limine-uefi-cd.bin iso_root/boot/
mkdir -pv iso_root/EFI/BOOT
cp host-pkgs/limine/usr/local/share/limine/BOOT*.EFI iso_root/EFI/BOOT/

# Create the disk image.
xorriso -as mkisofs -b boot/limine-cd.bin -no-emul-boot -boot-load-size 4 \
-boot-info-table --efi-boot boot/limine-cd-efi.bin -efi-boot-part \
--efi-boot-image --protective-msdos-label iso_root -o vinix.iso
xorriso -as mkisofs -b boot/limine-bios-cd.bin -no-emul-boot -boot-load-size 4 \
-boot-info-table --efi-boot boot/limine-uefi-cd.bin -efi-boot-part \
--efi-boot-image --protective-msdos-label iso_root -o vinix.iso

# Install limine.
host-pkgs/limine/usr/local/bin/limine-deploy vinix.iso
host-pkgs/limine/usr/local/bin/limine bios-install vinix.iso
1 change: 1 addition & 0 deletions host-recipes/autoconf
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ revision=1

build() {
"${source_dir}"/configure --prefix="${prefix}"

make -j${parallelism}
}

Expand Down
3 changes: 2 additions & 1 deletion host-recipes/autoconf-archive
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ revision=1

build() {
true

true
}

install() {
package() {
mkdir -p "${dest_dir}${prefix}"/share/aclocal
cp -r "${source_dir}"/m4/. "${dest_dir}${prefix}"/share/aclocal/
}
1 change: 1 addition & 0 deletions host-recipes/automake
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ hostrundeps="autoconf"

build() {
"${source_dir}"/configure --prefix="${prefix}"

make -j${parallelism}
}

Expand Down
5 changes: 3 additions & 2 deletions host-recipes/binutils
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ revision=1
imagedeps="gcc"
hostdeps="autoconf automake libtool pkg-config"

build(){
build() {
"${source_dir}"/configure \
--prefix="${prefix}" \
--target=x86_64-vinix \
--target=${OS_TRIPLET} \
--with-sysroot="${sysroot_dir}" \
--disable-nls \
--disable-werror \
--disable-dependency-tracking

make -j${parallelism} all
}

Expand Down
5 changes: 2 additions & 3 deletions host-recipes/cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@ revision=1
imagedeps="gcc"

build() {
"${source_dir}"/configure --prefix="${prefix}" --parallel="${parallelism}"}

"${source_dir}"/configure --prefix="${prefix}" --parallel="${parallelism}"

make -j${parallelism}
}

package() {
DESTDIR="${dest_dir}" make install
echo 'include(Platform/UnixPaths)' > "${dest_dir}${prefix}/share/cmake-3.24/Modules/Platform/Vinix.cmake"
echo 'include(Platform/UnixPaths)' > "${dest_dir}${prefix}/share/cmake-3.27/Modules/Platform/Vinix.cmake"
}
27 changes: 24 additions & 3 deletions host-recipes/gcc
Original file line number Diff line number Diff line change
@@ -1,12 +1,33 @@
name=gcc
from_source=gcc-host
revision=1
hostrundeps="gcc-compiler libgcc libstdc++ binutils"
imagedeps="gcc"
hostdeps="autoconf automake libtool pkg-config"
hostrundeps="binutils"
deps="mlibc-headers"

build() {
true
cp -rp "${source_dir}"/. ./

mkdir build && cd build

CXXFLAGS_FOR_TARGET="$CFLAGS" \
CFLAGS_FOR_TARGET="$CFLAGS" \
../configure \
--prefix="${prefix}" \
--target=${OS_TRIPLET} \
--with-sysroot="${sysroot_dir}" \
--disable-nls \
--enable-languages=c,c++,lto \
--disable-multilib \
--enable-initfini-array \
--enable-shared \
--enable-host-shared

make -j${parallelism} all-gcc
}

package() {
true
cd build
DESTDIR="${dest_dir}" make install-gcc
}
25 changes: 0 additions & 25 deletions host-recipes/gcc-compiler

This file was deleted.

1 change: 0 additions & 1 deletion host-recipes/gnulib
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@ build() {
package() {
true
}

19 changes: 0 additions & 19 deletions host-recipes/libgcc

This file was deleted.

14 changes: 14 additions & 0 deletions host-recipes/libgcc-binaries
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name=libgcc-binaries
from_source=libgcc-binaries
revision=1

build() {
true

true
}

package() {
mkdir -p ${dest_dir}${prefix}/libgcc-binaries
cp -rv ${source_dir}/. ${dest_dir}${prefix}/libgcc-binaries/
}
17 changes: 0 additions & 17 deletions host-recipes/libstdc++

This file was deleted.

Loading

0 comments on commit 3156a8b

Please sign in to comment.