commit df8470479731fc333e97ee3916db14abe9b14b24 Author: Matheus Date: Sat Apr 8 01:11:30 2023 -0300 initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..485078e3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +.jinx-cache +builds +host-builds +host-pkgs +host-recipes +iso +jinx +pkgs +sources diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..8363b94e --- /dev/null +++ b/Makefile @@ -0,0 +1,31 @@ +ISODIR=$(shell pwd)/iso +ISO=astral.iso +LIMINEDIR=$(shell pwd)/host-pkgs/limine/usr/local/share/limine/ +KERNEL=pkgs/astral/boot/astral + +.PHONY: all kernel clean clean-kernel iso + +all: jinx + make kernel + ./jinx build-all + make $(ISO) + +jinx: + curl https://raw.githubusercontent.com/mintsuki/jinx/trunk/jinx > jinx + chmod +x jinx + +$(ISO): limine.cfg liminebg.bmp $(KERNEL) + mkdir -p $(ISODIR) + cp $(KERNEL) liminebg.bmp limine.cfg $(LIMINEDIR)/limine.sys $(LIMINEDIR)/limine-cd.bin $(LIMINEDIR)/limine-cd-efi.bin $(ISODIR) + xorriso -as mkisofs -b limine-cd.bin -no-emul-boot -boot-load-size 4 -boot-info-table --efi-boot limine-cd-efi.bin -efi-boot-part --efi-boot-image --protective-msdos-label $(ISODIR) -o $(ISO) + +kernel: + ./jinx build astral + +clean-kernel: + find kernel-src -name *.o -delete + +clean: + make clean-kernel + ./jinx clean + rm jinx diff --git a/astral.iso b/astral.iso new file mode 100644 index 00000000..470742fb Binary files /dev/null and b/astral.iso differ diff --git a/jinx-config b/jinx-config new file mode 100644 index 00000000..fa827f14 --- /dev/null +++ b/jinx-config @@ -0,0 +1,2 @@ +export CFLAGS="-O2 -march=x86-64 -pipe -mtune=generic" +export CXXFLAGS="${CFLAGS}" diff --git a/kernel-src/Makefile b/kernel-src/Makefile new file mode 100644 index 00000000..ac1f4791 --- /dev/null +++ b/kernel-src/Makefile @@ -0,0 +1,18 @@ +CSOURCES= $(shell find -name *.c) +ASMSOURCES= $(shell find -name *.asm) +OBJS=$(CSOURCES:.c=.o) $(ASMSOURCES:.asm=.asmo) +TARGET=x86-64 +INCDIR=$(shell pwd)/include +ARCHDIR=$(shell pwd)/arch/$(TARGET)/ +LDFLAGS=-ffreestanding -nostdlib -lgcc -Wl,-T,"$(ARCHDIR)/kernel.ld" -debug +CFLAGS=-ffreestanding -mcmodel=kernel -O2 -mno-red-zone -mno-mmx -mno-sse -mno-sse2 -nostdlib -nostdinc -I "${INCDIR}" +ASFLAGS=-felf64 + +astral: $(OBJS) + $(LD) $(LDFLAGS) -o $@ $^ + +%.o: %.c + $(CC) $(CFLAGS) -c -o $@ $< + +%.asmo: %.asm + nasm $(ASFLAGS) -o $@ $< diff --git a/kernel-src/arch/x86-64/kernel.ld b/kernel-src/arch/x86-64/kernel.ld new file mode 100644 index 00000000..b2a2d575 --- /dev/null +++ b/kernel-src/arch/x86-64/kernel.ld @@ -0,0 +1,45 @@ +OUTPUT_FORMAT(elf64-x86-64) +OUTPUT_ARCH(i386:x86-64) + +ENTRY(kernel_entry) + +PHDRS +{ + text PT_LOAD FLAGS((1 << 0) | (1 <<2)) ; + rodata PT_LOAD FLAGS((1 << 2)) ; + data PT_LOAD FLAGS((1 << 1) | (1 << 2)); +} + +SECTIONS +{ + . = 0xffffffff80000000; + _text_start = .; + + .text : { + *(.text .text.*); + } :text + + . = ALIGN(4K); + _text_end = .; + _rodata_start = .; + .rodata : { + *(.rodata .rodata.*); + } :rodata + + . = ALIGN(4K); + _rodata_end = .; + _data_start = .; + + data : { + *(.data .data.*); + } :data + + .bss : { + *(COMMON) + *(.bss .bss.*) + } :data + + . = ALIGN(4K); + + _data_end = .; +} diff --git a/kernel-src/arch/x86-64/main.c b/kernel-src/arch/x86-64/main.c new file mode 100644 index 00000000..a08edd24 --- /dev/null +++ b/kernel-src/arch/x86-64/main.c @@ -0,0 +1,4 @@ +void kernel_entry() { + asm("cli"); + asm("hlt"); +} diff --git a/limine.cfg b/limine.cfg new file mode 100644 index 00000000..2cc7faab --- /dev/null +++ b/limine.cfg @@ -0,0 +1,11 @@ +TERM_MARGIN=40 +TERM_MARGIN_GRADIENT=40 +TERM_WALLPAPER=boot:///liminebg.bmp +TERM_WALLPAPER_STYLE=stretched +TIMEOUT=5 +:Astral +PROTOCOL=limine +KERNEL_PATH=boot:///astral +#MODULE_PATH=boot:///initrd +#KERNEL_CMDLINE= +COMMENT="The Astral operating system" diff --git a/liminebg.bmp b/liminebg.bmp new file mode 100644 index 00000000..8e09b95e Binary files /dev/null and b/liminebg.bmp differ diff --git a/patches/automake/jinx-working-patch.patch b/patches/automake/jinx-working-patch.patch new file mode 100644 index 00000000..d9a67637 --- /dev/null +++ b/patches/automake/jinx-working-patch.patch @@ -0,0 +1,27 @@ +diff --git automake-clean/lib/config.guess automake-workdir/lib/config.guess +index 2193702..7b9c18c 100755 +--- automake-clean/lib/config.guess ++++ automake-workdir/lib/config.guess +@@ -827,6 +827,9 @@ EOF + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit ;; ++ *:Astral:*:*) ++ GUESS=$UNAME_MACHINE-pc-astral ++ ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit ;; +diff --git automake-clean/lib/config.sub automake-workdir/lib/config.sub +index 40ea5df..55fd4b7 100755 +--- automake-clean/lib/config.sub ++++ automake-workdir/lib/config.sub +@@ -1391,7 +1391,7 @@ case $os in + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. +- -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ ++ -gnu* | -astral* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ + | -sym* | -kopensolaris* | -plan9* \ diff --git a/patches/binutils/jinx-working-patch.patch b/patches/binutils/jinx-working-patch.patch new file mode 100644 index 00000000..0e1d94f8 --- /dev/null +++ b/patches/binutils/jinx-working-patch.patch @@ -0,0 +1,162 @@ +diff -ruN binutils-2.39/bfd/config.bfd binutils-2.39-patched/bfd/config.bfd +--- binutils-2.39/bfd/config.bfd 2022-07-08 06:46:47.000000000 -0300 ++++ binutils-2.39-patched/bfd/config.bfd 2022-08-07 18:29:37.305269269 -0300 +@@ -695,6 +695,11 @@ + targ_selvecs="i386_elf32_vec" + want64=true + ;; ++ x86_64-*-astral*) ++ targ_defvec=x86_64_elf64_vec ++ targ_selvecs=i386_elf32_vec ++ want64=true ++ ;; + x86_64-*-netbsd* | x86_64-*-openbsd*) + targ_defvec=x86_64_elf64_vec + targ_selvecs="i386_elf32_vec iamcu_elf32_vec i386_coff_vec i386_pei_vec x86_64_pe_vec x86_64_pei_vec" +diff -ruN binutils-2.39/config.sub binutils-2.39-patched/config.sub +--- binutils-2.39/config.sub 2022-07-08 06:46:47.000000000 -0300 ++++ binutils-2.39-patched/config.sub 2022-08-07 18:26:48.218610095 -0300 +@@ -1754,7 +1754,7 @@ + | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \ + | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \ + | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr* \ +- | fiwix* ) ++ | fiwix* | astral* ) + ;; + # This one is extra strict with allowed versions + sco3.2v2 | sco3.2v[4-9]* | sco5v6*) +diff -ruN binutils-2.39/gas/configure.tgt binutils-2.39-patched/gas/configure.tgt +--- binutils-2.39/gas/configure.tgt 2022-07-08 06:46:47.000000000 -0300 ++++ binutils-2.39-patched/gas/configure.tgt 2022-08-07 18:31:46.391930215 -0300 +@@ -221,6 +221,7 @@ + h8300-*-elf) fmt=elf ;; + h8300-*-linux*) fmt=elf em=linux ;; + ++ i386-*-astral*) fmt=elf ;; + i386-*-beospe*) fmt=coff em=pe ;; + i386-*-beos*) fmt=elf ;; + i386-*-elfiamcu) fmt=elf arch=iamcu ;; +diff -ruN binutils-2.39/ld/configure.tgt binutils-2.39-patched/ld/configure.tgt +--- binutils-2.39/ld/configure.tgt 2022-07-29 04:37:48.000000000 -0300 ++++ binutils-2.39-patched/ld/configure.tgt 2022-08-07 18:34:19.615256758 -0300 +@@ -986,6 +986,10 @@ + ;; + visium-*-elf) targ_emul=elf32visium + ;; ++x86_64-*-astral*) ++ targ_emul=elf_x86_64_astral ++ targ_extra_emuls="elf_i386_astral elf_x86_64 elf_i386" ++ ;; + x86_64-*-rdos*) targ_emul=elf64rdos + ;; + x86_64-*-cloudabi*) targ_emul=elf_x86_64_cloudabi +diff -ruN binutils-2.39/ld/emulparams/elf_i386_astral.sh binutils-2.39-patched/ld/emulparams/elf_i386_astral.sh +--- binutils-2.39/ld/emulparams/elf_i386_astral.sh 1969-12-31 21:00:00.000000000 -0300 ++++ binutils-2.39-patched/ld/emulparams/elf_i386_astral.sh 2022-08-07 19:16:14.135145355 -0300 +@@ -0,0 +1,4 @@ ++source_sh ${srcdir}/emulparams/elf_i386.sh ++TEXT_START_ADDR=0x10000000 ++GENERATE_SHLIB_SCRIPT=yes ++GENERATE_PIE_SCRIPT=yes +diff -ruN binutils-2.39/ld/emulparams/elf_x86_64_astral.sh binutils-2.39-patched/ld/emulparams/elf_x86_64_astral.sh +--- binutils-2.39/ld/emulparams/elf_x86_64_astral.sh 1969-12-31 21:00:00.000000000 -0300 ++++ binutils-2.39-patched/ld/emulparams/elf_x86_64_astral.sh 2022-08-07 18:36:20.838584720 -0300 +@@ -0,0 +1,4 @@ ++source_sh ${srcdir}/emulparams/elf_x86_64.sh ++TEXT_START_ADDR=0x10000000 ++GENERATE_SHLIB_SCRIPT=yes ++GENERATE_PIE_SCRIPT=yes +diff -ruN binutils-2.39/ld/Makefile.am binutils-2.39-patched/ld/Makefile.am +--- binutils-2.39/ld/Makefile.am 2022-07-08 06:46:48.000000000 -0300 ++++ binutils-2.39-patched/ld/Makefile.am 2022-08-07 19:17:46.965141264 -0300 +@@ -275,6 +275,7 @@ + eelf32xtensa.c \ + eelf32z80.c \ + eelf_i386.c \ ++ eelf_i386_astral.c \ + eelf_i386_be.c \ + eelf_i386_fbsd.c \ + eelf_i386_haiku.c \ +@@ -453,6 +454,7 @@ + eelf64tilegx_be.c \ + eelf_mipsel_haiku.c \ + eelf_x86_64.c \ ++ eelf_x86_64_astral.c \ + eelf_x86_64_cloudabi.c \ + eelf_x86_64_fbsd.c \ + eelf_x86_64_haiku.c \ +@@ -766,6 +768,7 @@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32xtensa.Pc@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32z80.Pc@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_i386.Pc@am__quote@ ++@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_i386_astral.Pc@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_i386_be.Pc@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_i386_fbsd.Pc@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_i386_haiku.Pc@am__quote@ +@@ -941,6 +944,7 @@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64tilegx_be.Pc@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_mipsel_haiku.Pc@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64.Pc@am__quote@ ++@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_astral.Pc@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_cloudabi.Pc@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_fbsd.Pc@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_haiku.Pc@am__quote@ +diff -ruN binutils-2.39/ld/Makefile.in binutils-2.39-patched/ld/Makefile.in +--- binutils-2.39/ld/Makefile.in 2022-08-05 06:56:53.000000000 -0300 ++++ binutils-2.39-patched/ld/Makefile.in 2022-08-07 19:17:51.741807718 -0300 +@@ -529,6 +529,7 @@ + prefix = @prefix@ + program_transform_name = @program_transform_name@ + psdir = @psdir@ ++runstatedir = @runstatedir@ + sbindir = @sbindir@ + sharedstatedir = @sharedstatedir@ + srcdir = @srcdir@ +@@ -772,6 +773,7 @@ + eelf32xtensa.c \ + eelf32z80.c \ + eelf_i386.c \ ++ eelf_i386_astral.c \ + eelf_i386_be.c \ + eelf_i386_fbsd.c \ + eelf_i386_haiku.c \ +@@ -949,6 +951,7 @@ + eelf64tilegx_be.c \ + eelf_mipsel_haiku.c \ + eelf_x86_64.c \ ++ eelf_x86_64_astral.c \ + eelf_x86_64_cloudabi.c \ + eelf_x86_64_fbsd.c \ + eelf_x86_64_haiku.c \ +@@ -1441,6 +1444,7 @@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64tilegx.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64tilegx_be.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_i386.Po@am__quote@ ++@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_i386_astral.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_i386_be.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_i386_fbsd.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_i386_haiku.Po@am__quote@ +@@ -1451,6 +1455,7 @@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_mipsel_haiku.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_s390.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64.Po@am__quote@ ++@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_astral.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_cloudabi.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_fbsd.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_haiku.Po@am__quote@ +@@ -2432,6 +2437,7 @@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32xtensa.Pc@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32z80.Pc@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_i386.Pc@am__quote@ ++@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_i386_astral.Pc@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_i386_be.Pc@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_i386_fbsd.Pc@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_i386_haiku.Pc@am__quote@ +@@ -2607,6 +2613,7 @@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64tilegx_be.Pc@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_mipsel_haiku.Pc@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64.Pc@am__quote@ ++@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_astral.Pc@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_cloudabi.Pc@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_fbsd.Pc@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_haiku.Pc@am__quote@ diff --git a/patches/gcc/jinx-working-patch.patch b/patches/gcc/jinx-working-patch.patch new file mode 100644 index 00000000..c480ee6b --- /dev/null +++ b/patches/gcc/jinx-working-patch.patch @@ -0,0 +1,122 @@ +diff -ruN gcc-12.1.0/config.sub gcc-12.1.0-patched/config.sub +--- gcc-12.1.0/config.sub 2022-05-06 04:30:56.000000000 -0300 ++++ gcc-12.1.0-patched/config.sub 2022-09-14 19:57:47.513031678 -0300 +@@ -1749,7 +1749,7 @@ + | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \ + | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \ + | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr* \ +- | fiwix* ) ++ | fiwix* | astral* ) + ;; + # This one is extra strict with allowed versions + sco3.2v2 | sco3.2v[4-9]* | sco5v6*) +diff -ruN gcc-12.1.0/fixincludes/mkfixinc.sh gcc-12.1.0-patched/fixincludes/mkfixinc.sh +--- gcc-12.1.0/fixincludes/mkfixinc.sh 2022-05-06 04:30:56.000000000 -0300 ++++ gcc-12.1.0-patched/fixincludes/mkfixinc.sh 2022-09-14 19:59:55.153030645 -0300 +@@ -11,6 +11,8 @@ + + # Check for special fix rules for particular targets + case $machine in ++ *-astral* | \ ++ *-*-astral* | \ + i?86-*-cygwin* | \ + i?86-*-mingw32* | \ + x86_64-*-mingw32* | \ +diff -ruN gcc-12.1.0/gcc/config/astral.h gcc-12.1.0-patched/gcc/config/astral.h +--- gcc-12.1.0/gcc/config/astral.h 1969-12-31 21:00:00.000000000 -0300 ++++ gcc-12.1.0-patched/gcc/config/astral.h 2022-09-14 19:58:16.803031441 -0300 +@@ -0,0 +1,24 @@ ++#undef TARGET_ASTRAL ++#define TARGET_ASTRAL 1 ++ ++#undef LIB_SPEC ++#define LIB_SPEC "-lc" ++ ++#undef LINK_SPEC ++#define LINK_SPEC "%{shared:-shared} %{static:-static} %{!shared: %{!static: %{rdynamic:-export-dynamic}}} %{!dynamic-linker:-dynamic-linker /usr/lib/ld.so}" ++ ++#undef STARTFILE_SPEC ++#define STARTFILE_SPEC "%{!shared:crt0.o%s} crti.o%s %{shared:crtbeginS.o%s;:crtbegin.o%s}" ++ ++#undef ENDFILE_SPEC ++#define ENDFILE_SPEC "%{shared:crtendS.o%s;:crtend.o%s} crtn.o%s" ++ ++#undef TARGET_OS_CPP_BUILTINS ++#define TARGET_OS_CPP_BUILTINS() \ ++ do { \ ++ builtin_define ("__astral__"); \ ++ builtin_define ("__unix__"); \ ++ builtin_assert ("system=astral"); \ ++ builtin_assert ("system=unix"); \ ++ builtin_assert ("system=posix"); \ ++ } while(0); +diff -ruN gcc-12.1.0/gcc/config.gcc gcc-12.1.0-patched/gcc/config.gcc +--- gcc-12.1.0/gcc/config.gcc 2022-05-06 04:30:56.000000000 -0300 ++++ gcc-12.1.0-patched/gcc/config.gcc 2022-09-14 19:57:58.466364923 -0300 +@@ -773,6 +773,14 @@ + tmake_file="${tmake_file} t-dragonfly" + target_has_targetdm=yes + ;; ++*-*-astral*) ++ extra_options="$extra_options gnu-user.opt" ++ gas=yes ++ gnu_ld=yes ++ default_use_cxa_atexit=yes ++ use_gcc_stdint=provide ++ thread_file='posix' ++ ;; + *-*-freebsd*) + # This is the generic ELF configuration of FreeBSD. Later + # machine-specific sections may refine and add to this +@@ -1087,6 +1093,9 @@ + esac + + case ${target} in ++x86_64-*-astral*) ++ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h glibc-stdint.h i386/i386elf.h i386/x86-64.h astral.h" ++ ;; + aarch64*-*-elf | aarch64*-*-fuchsia* | aarch64*-*-rtems*) + tm_file="${tm_file} dbxelf.h elfos.h newlib-stdint.h" + tm_file="${tm_file} aarch64/aarch64-elf.h aarch64/aarch64-errata.h aarch64/aarch64-elf-raw.h" +diff -ruN gcc-12.1.0/libgcc/config.host gcc-12.1.0-patched/libgcc/config.host +--- gcc-12.1.0/libgcc/config.host 2022-05-06 04:30:59.000000000 -0300 ++++ gcc-12.1.0-patched/libgcc/config.host 2022-09-14 19:59:26.003030881 -0300 +@@ -751,6 +751,10 @@ + ;; + x86_64-*-openbsd*) + ;; ++x86_64-*-astral*) ++ extra_parts="$extra_parts crti.o crtbegin.o crtend.o crtn.o crtbeginS.o crtendS.o crtprec32.o crtprec64.o crtprec80.o crtfastmath.o" ++ tmake_file="$tmake_file t-crtstuff-pic t-libgcc-pic i386/t-crtpc t-crtfm i386/t-crtstuff t-dfprules" ++ ;; + i[34567]86-*-linux*) + extra_parts="$extra_parts crtprec32.o crtprec64.o crtprec80.o crtfastmath.o" + tmake_file="${tmake_file} i386/t-crtpc t-crtfm i386/t-crtstuff t-dfprules" +diff -ruN gcc-12.1.0/libstdc++-v3/crossconfig.m4 gcc-12.1.0-patched/libstdc++-v3/crossconfig.m4 +--- gcc-12.1.0/libstdc++-v3/crossconfig.m4 2022-05-06 04:31:00.000000000 -0300 ++++ gcc-12.1.0-patched/libstdc++-v3/crossconfig.m4 2022-09-14 19:58:39.359697928 -0300 +@@ -8,7 +8,12 @@ + arm*-*-symbianelf*) + # This is a freestanding configuration; there is nothing to do here. + ;; +- ++ *-astral*) ++ GLIBCXX_CHECK_COMPILER_FEATURES ++ GLIBCXX_CHECK_LINKER_FEATURES ++ GLIBCXX_CHECK_MATH_SUPPORT ++ GLIBCXX_CHECK_STDLIB_SUPPORT ++ ;; + avr*-*-*) + AC_DEFINE(HAVE_ACOSF) + AC_DEFINE(HAVE_ASINF) +--- gcc-12.1.0/libgcc/libgcov.h 2022-05-06 04:30:59.000000000 -0300 ++++ gcc-12.1.0-patched/libgcc/libgcov.h 2022-09-15 17:13:09.406451175 -0300 +@@ -25,6 +25,8 @@ + #ifndef GCC_LIBGCOV_H + #define GCC_LIBGCOV_H + ++#include ++ + /* work around the poisoned malloc/calloc in system.h. */ + #ifndef xmalloc + #define xmalloc malloc diff --git a/patches/libtool/jinx-working-patch.patch b/patches/libtool/jinx-working-patch.patch new file mode 100644 index 00000000..d6750734 --- /dev/null +++ b/patches/libtool/jinx-working-patch.patch @@ -0,0 +1,138 @@ +diff --git libtool-clean/build-aux/ltmain.in libtool-workdir/build-aux/ltmain.in +index a5f21a1..085711c 100644 +--- libtool-clean/build-aux/ltmain.in ++++ libtool-workdir/build-aux/ltmain.in +@@ -6497,7 +6497,7 @@ func_mode_link () + fi + else + # We cannot seem to hardcode it, guess we'll fake it. +- add_dir=-L$libdir ++ add_dir=-L$lt_sysroot$$libdir + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case $libdir in +diff --git libtool-clean/libtoolize.in libtool-workdir/libtoolize.in +index 0c40fed..763619b 100644 +--- libtool-clean/libtoolize.in ++++ libtool-workdir/libtoolize.in +@@ -1891,7 +1891,7 @@ func_require_seen_libtool () + # Do not remove config.guess, config.sub or install-sh, we don't + # install them without --install, and the project may not be using + # Automake. Similarly, do not remove Gnulib files. +- all_pkgaux_files="compile depcomp missing ltmain.sh" ++ all_pkgaux_files="" + all_pkgmacro_files="libtool.m4 ltargz.m4 ltdl.m4 ltoptions.m4 ltsugar.m4 ltversion.in ltversion.m4 lt~obsolete.m4" + all_pkgltdl_files="COPYING.LIB Makefile Makefile.in Makefile.inc Makefile.am README acinclude.m4 aclocal.m4 argz_.h argz.c config.h.in config-h.in configure configure.ac configure.in libltdl/lt__alloc.h libltdl/lt__argz.h libltdl/lt__dirent.h libltdl/lt__glibc.h libltdl/lt__private.h libltdl/lt__strl.h libltdl/lt_dlloader.h libltdl/lt_error.h libltdl/lt_system.h libltdl/slist.h loaders/dld_link.c loaders/dlopen.c loaders/dyld.c loaders/load_add_on.c loaders/loadlibrary.c loaders/preopen.c loaders/shl_load.c lt__alloc.c lt__argz.c lt__dirent.c lt__strl.c lt_dlloader.c lt_error.c ltdl.c ltdl.h ltdl.mk slist.c" + +diff --git libtool-clean/m4/libtool.m4 libtool-workdir/m4/libtool.m4 +index 79a2451..1682c56 100644 +--- libtool-clean/m4/libtool.m4 ++++ libtool-workdir/m4/libtool.m4 +@@ -1696,7 +1696,7 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + +- gnu*) ++ astral* | gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever +@@ -2521,6 +2521,18 @@ amigaos*) + esac + ;; + ++astral*) ++ version_type=linux ++ need_lib_prefix=no ++ need_version=no ++ library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ++ soname_spec='$libname$release$shared_ext$major' ++ dynamic_linker='mlibc ld.so' ++ shlibpath_var=LD_LIBRARY_PATH ++ shlibpath_overrides_runpath=no ++ hardcode_into_libs=yes ++ ;; ++ + beos*) + library_names_spec='$libname$shared_ext' + dynamic_linker="$host_os ld.so" +@@ -3468,6 +3480,10 @@ aix[[4-9]]*) + lt_cv_deplibs_check_method=pass_all + ;; + ++astral*) ++ lt_cv_deplibs_check_method=pass_all ++ ;; ++ + beos*) + lt_cv_deplibs_check_method=pass_all + ;; +@@ -4310,6 +4326,8 @@ m4_if([$1], [CXX], [ + _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; ++ astral*) ++ ;; + chorus*) + case $cc_basename in + cxch68*) +@@ -4561,6 +4579,12 @@ m4_if([$1], [CXX], [ + ;; + esac + ;; ++ ++ astral*) ++ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' ++ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ++ _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ++ ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. +@@ -5106,6 +5130,11 @@ _LT_EOF + ;; + esac + ;; ++ ++ astral*) ++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' ++ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ++ ;; + + beos*) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then +@@ -5570,7 +5599,8 @@ _LT_EOF + ;; + esac + ;; +- ++ astral*) ++ ;; + bsdi[[45]]*) + _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic + ;; +@@ -6630,6 +6660,10 @@ if test yes != "$_lt_caught_CXX_error"; then + fi + fi + ;; ++ ++ astral*) ++ _LT_TAGVAR(ld_shlibs, $1)=yes ++ ;; + + beos*) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then +diff --git libtool-clean/m4/ltdl.m4 libtool-workdir/m4/ltdl.m4 +index 772c150..13807b5 100644 +--- libtool-clean/m4/ltdl.m4 ++++ libtool-workdir/m4/ltdl.m4 +@@ -466,6 +466,9 @@ AC_CACHE_CHECK([whether deplibs are loaded by dlopen], + ;; + esac + ;; ++ astral*) ++ lt_cv_sys_dlopen_deplibs=yes ++ ;; + bitrig*) + lt_cv_sys_dlopen_deplibs=yes + ;; diff --git a/patches/mlibc/jinx-working-patch.patch b/patches/mlibc/jinx-working-patch.patch new file mode 100644 index 00000000..ae0ba1a7 --- /dev/null +++ b/patches/mlibc/jinx-working-patch.patch @@ -0,0 +1,904 @@ +diff --git mlibc-clean/abis/linux/in.h mlibc-workdir/abis/linux/in.h +index 3618abf..b1c02c7 100644 +--- mlibc-clean/abis/linux/in.h ++++ mlibc-workdir/abis/linux/in.h +@@ -67,6 +67,9 @@ struct ipv6_mreq { + + #define IPPORT_RESERVED 1024 + ++#define IP_MULTICAST_TTL 33 ++#define IPV6_MULTICAST_HOPS 18 ++ + #define IPPROTO_IP 0 + #define IPPROTO_HOPOPTS 0 + #define IPPROTO_ICMP 1 +diff --git mlibc-clean/meson.build mlibc-workdir/meson.build +index 1605b31..b436ca5 100644 +--- mlibc-clean/meson.build ++++ mlibc-workdir/meson.build +@@ -135,6 +135,10 @@ elif host_machine.system() == 'dripos' + rtdl_include_dirs += include_directories('sysdeps/dripos/include') + libc_include_dirs += include_directories('sysdeps/dripos/include') + subdir('sysdeps/dripos') ++elif host_machine.system() == 'astral' ++ rtdl_include_dirs += include_directories('sysdeps/astral/include') ++ libc_include_dirs += include_directories('sysdeps/astral/include') ++ subdir('sysdeps/astral') + else + error('No sysdeps defined for OS: ' + host_machine.system()) + endif +diff --git mlibc-clean/options/ansi/generic/string-stubs.cpp mlibc-workdir/options/ansi/generic/string-stubs.cpp +index 80f1afd..0f1b4ba 100644 +--- mlibc-clean/options/ansi/generic/string-stubs.cpp ++++ mlibc-workdir/options/ansi/generic/string-stubs.cpp +@@ -400,7 +400,6 @@ char *strerror(int e) { + case ENOPROTOOPT: s = "Protocol not available (ENOPROTOOPT)"; break; + case ENOTEMPTY: s = "Directory not empty (ENOTEMPTY)"; break; + case ENOTRECOVERABLE: s = "Sate not recoverable (ENOTRECOVERABLE)"; break; +- case ENOTSUP: s = "Operation not supported (ENOTSUP)"; break; + case ENOTTY: s = "Inappropriate ioctl for device (ENOTTY)"; break; + case EOVERFLOW: s = "Value too large for defined datatype (EOVERFLOW)"; break; + #ifndef __linux__ +diff --git mlibc-clean/options/glibc/generic/execinfo.cpp mlibc-workdir/options/glibc/generic/execinfo.cpp +index 3474615..e034881 100644 +--- mlibc-clean/options/glibc/generic/execinfo.cpp ++++ mlibc-workdir/options/glibc/generic/execinfo.cpp +@@ -1,9 +1,10 @@ + #include + #include ++#include + + int backtrace(void **, int) { +- __ensure(!"Not implemented"); +- __builtin_unreachable(); ++ mlibc::infoLogger() << "libc: backtrace() is not implemented!\n" << frg::endlog; ++ return 0; + } + + char **backtrace_symbols(void *const *, int) { +diff --git mlibc-workdir/sysdeps/astral/crt-x86_64/crt0.S mlibc-workdir/sysdeps/astral/crt-x86_64/crt0.S +new file mode 100644 +index 0000000..0a0a4a0 +--- /dev/null ++++ mlibc-workdir/sysdeps/astral/crt-x86_64/crt0.S +@@ -0,0 +1,7 @@ ++ ++.section .text ++.global _start ++_start: ++ mov $main, %rdi ++ call __mlibc_entry ++ +diff --git mlibc-workdir/sysdeps/astral/generic/astral.cpp mlibc-workdir/sysdeps/astral/generic/astral.cpp +new file mode 100644 +index 0000000..2410961 +--- /dev/null ++++ mlibc-workdir/sysdeps/astral/generic/astral.cpp +@@ -0,0 +1,6 @@ ++#include ++ ++int arch_ctl(int func, void* arg){ ++ long ret; ++ return syscall(SYSCALL_ARCH_CTL, &ret, func, (uint64_t)arg); ++} +diff --git mlibc-workdir/sysdeps/astral/generic/entry.cpp mlibc-workdir/sysdeps/astral/generic/entry.cpp +new file mode 100644 +index 0000000..ee7a794 +--- /dev/null ++++ mlibc-workdir/sysdeps/astral/generic/entry.cpp +@@ -0,0 +1,34 @@ ++ ++#include ++#include ++#include ++#include ++ ++// defined by the POSIX library ++void __mlibc_initLocale(); ++ ++extern "C" uintptr_t *__dlapi_entrystack(); ++ ++extern char **environ; ++static mlibc::exec_stack_data __mlibc_stack_data; ++ ++struct LibraryGuard { ++ LibraryGuard(); ++}; ++ ++static LibraryGuard guard; ++ ++LibraryGuard::LibraryGuard() { ++ __mlibc_initLocale(); ++ ++ // Parse the exec() stack. ++ mlibc::parse_exec_stack(__dlapi_entrystack(), &__mlibc_stack_data); ++ mlibc::set_startup_data(__mlibc_stack_data.argc, __mlibc_stack_data.argv, ++ __mlibc_stack_data.envp); ++} ++ ++extern "C" void __mlibc_entry(int (*main_fn)(int argc, char *argv[], char *env[])) { ++ auto result = main_fn(__mlibc_stack_data.argc, __mlibc_stack_data.argv, environ); ++ exit(result); ++} ++ +diff --git mlibc-workdir/sysdeps/astral/generic/generic.cpp mlibc-workdir/sysdeps/astral/generic/generic.cpp +new file mode 100644 +index 0000000..e6c404a +--- /dev/null ++++ mlibc-workdir/sysdeps/astral/generic/generic.cpp +@@ -0,0 +1,530 @@ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define STUB_ONLY { __ensure(!"STUB_ONLY function was called"); __builtin_unreachable(); } ++ ++namespace mlibc { ++ ++ // stub ++ ++ int sys_setuid(uid_t id){ ++ return 0; ++ } ++ ++ // stub ++ ++ int sys_setgid(gid_t id){ ++ return 0; ++ } ++ ++ // stub ++ ++ uid_t sys_getuid(){ ++ return 0; ++ } ++ ++ // stub ++ ++ gid_t sys_getgid(){ ++ return 0; ++ } ++ ++ // stub ++ ++ uid_t sys_geteuid(){ ++ return 0; ++ } ++ ++ // stub ++ ++ gid_t sys_getegid(){ ++ return 0; ++ } ++ ++ // stub ++ ++ pid_t sys_getppid(){ ++ return 1; ++ } ++ ++ // stub ++ ++ int sys_getpgid(pid_t pid, pid_t* pgid){ ++ *pgid = 1; ++ return 0; ++ } ++ ++ // stub ++ ++ int sys_setpgid(pid_t pid, pid_t pgid){ ++ return ENOSYS; ++ } ++ ++ // stub ++ ++ int sys_sigaction(int, const struct sigaction *__restrict, ++ struct sigaction *__restrict){ ++ return ENOSYS; ++ } ++ ++ // stub ++ ++ int sys_sigprocmask(int how, const sigset_t *__restrict set, sigset_t *__restrict retrieve){ ++ return ENOSYS; ++ } ++ ++ // stub ++ ++ int sys_ttyname(int fd, char *buf, size_t size) { ++ return ENOSYS; ++ } ++ ++ // stub ++ ++ #define ASTRALHOSTNAME "astral" ++ ++ int sys_gethostname(char *buffer, size_t bufsize){ ++ ++ memcpy(buffer, ASTRALHOSTNAME, strlen(ASTRALHOSTNAME)); ++ ++ return 0; ++ ++ } ++ ++ // stub ++ ++ int sys_uname(struct utsname *buf){ ++ ++ memcpy(buf->sysname, "Astral", 7); ++ memcpy(buf->nodename, ASTRALHOSTNAME, strlen(ASTRALHOSTNAME)+1); ++ memcpy(buf->version, "0.0.2", 6); ++ memcpy(buf->release, "Astral 0.0.2", 13); ++ memcpy(buf->machine, "x86_64", 7); ++ memcpy(buf->domainname, ASTRALHOSTNAME, strlen(ASTRALHOSTNAME)+1); ++ ++ return 0; ++ ++ } ++ ++ // astral doesn't check for permissions yet ++ ++ int sys_faccessat(int dirfd, const char *pathname, int mode, int flags){ ++ ++ struct stat buff; ++ ++ return sys_stat(fsfd_target::fd_path, dirfd, pathname, 0, &buff); ++ ++ } ++ ++ ++ // stub ++ ++ int sys_access(const char *path, int mode){ ++ return sys_faccessat(AT_FDCWD, path, mode, 0); ++ } ++ ++ // for now no caching is implemented so just return 0 ++ ++ [[gnu::weak]] int sys_fsync(int fd){ ++ return 0; ++ } ++ ++ [[noreturn]] void sys_thread_exit(){ ++ syscall(SYSCALL_THREADEXIT, nullptr); ++ } ++ extern "C" void __mlibc_thread_entry(); ++ ++ ++ #ifndef MLIBC_BUILDING_RTDL ++ ++ int sys_clone(void *tcb, pid_t *pid_out, void *stack){ ++ long ret; ++ long err = syscall(SYSCALL_NEWTHREAD, &ret, (uintptr_t)__mlibc_thread_entry, (uintptr_t)stack); ++ *pid_out = ret; ++ return err; ++ } ++ ++ #endif ++ ++ int sys_msg_recv(int fd, struct msghdr *hdr, int flags, ssize_t *length){ ++ long ret; ++ long err = syscall(SYSCALL_RECVMSG, &ret, fd, (uintptr_t)hdr, flags); ++ *length = ret; ++ return err; ++ } ++ ++ int sys_linkat(int olddirfd, const char *old_path, int newdirfd, const char *new_path, int flags){ ++ long ret; ++ return syscall(SYSCALL_LINKAT, &ret, olddirfd, (uintptr_t)old_path, newdirfd, (uintptr_t) new_path, flags); ++ } ++ ++ [[gnu::weak]] int sys_link(const char *old_path, const char *new_path){ ++ return sys_linkat(AT_FDCWD, old_path, AT_FDCWD, new_path, 0); ++ } ++ ++ int sys_sleep(time_t *secs, long *nanos){ ++ struct timespec ts; ++ ts.tv_sec = *secs; ++ ts.tv_nsec = *nanos; ++ long ret; ++ long err = syscall(SYSCALL_NANOSLEEP, &ret, (uintptr_t)&ts, (uintptr_t)&ts); ++ *secs = ts.tv_sec; ++ *nanos = ts.tv_nsec; ++ return err; ++ } ++ ++ int sys_accept(int fd, int *newfd, struct sockaddr *addr_ptr, socklen_t *addr_length){ ++ long ret; ++ long err = syscall(SYSCALL_ACCEPT, &ret, fd, (uint64_t)addr_ptr, (uint64_t)addr_length); ++ *newfd = ret; ++ return err; ++ } ++ ++ int sys_connect(int fd, const struct sockaddr *addr_ptr, socklen_t addr_length){ ++ long ret; ++ return syscall(SYSCALL_CONNECT, &ret, fd, (uintptr_t)addr_ptr, addr_length); ++ } ++ ++ int sys_listen(int fd, int backlog){ ++ long ret; ++ return syscall(SYSCALL_LISTEN, &ret, fd, backlog); ++ } ++ ++ ++ int sys_bind(int fd, const struct sockaddr *addr_ptr, socklen_t addr_length){ ++ long ret; ++ return syscall(SYSCALL_BIND, &ret, fd, (uintptr_t)addr_ptr, addr_length); ++ } ++ ++ int sys_socket(int family, int type, int protocol, int *fd){ ++ long ret; ++ long err = syscall(SYSCALL_SOCKET, &ret, family, type, protocol); ++ *fd = ret; ++ return err; ++ } ++ ++ int sys_clock_get(int clock, time_t *secs, long *nanos){ ++ struct timespec ret; ++ long retv; ++ long err = syscall(SYSCALL_CLOCK_GETTIME, &retv, clock, (uint64_t)&ret); ++ *secs = ret.tv_sec; ++ *nanos = ret.tv_nsec; ++ return err; ++ } ++ ++ int sys_chroot(const char* path){ ++ long ret; ++ return syscall(SYSCALL_CHROOT, &ret, (uintptr_t)path); ++ } ++ ++ int sys_openat(int dirfd, const char *path, int flags, mode_t mode, int *fd){ ++ long ret; ++ long err = syscall(SYSCALL_OPENAT, &ret, dirfd, (uintptr_t)path, flags, mode); ++ *fd = ret; ++ return err; ++ } ++ ++ int sys_fchmod(int fd, mode_t mode){ ++ long ret; ++ return syscall(SYSCALL_FCHMOD, &ret, fd, mode); ++ } ++ ++ int sys_fchmodat(int fd, const char *pathname, mode_t mode, int flags){ ++ long ret; ++ return syscall(SYSCALL_FCHMODAT, &ret, fd, (uintptr_t)pathname, mode, flags); ++ } ++ ++ int sys_chmod(const char *pathname, mode_t mode){ ++ return sys_fchmodat(AT_FDCWD, pathname, mode, 0); ++ } ++ ++ ++ int sys_poll(struct pollfd *fds, nfds_t count, int timeout, int *num_events){ ++ long ret; ++ int err = syscall(SYSCALL_POLL, &ret, (uint64_t)fds, count, timeout); ++ *num_events = ret; ++ return err; ++ } ++ ++ // pselect is emulated by poll for now (will turn that into ppoll later) ++ ++#ifndef MLIBC_BUILDING_RTDL ++ ++ int sys_pselect(int num_fds, fd_set *read_set, fd_set *write_set, ++ fd_set *except_set, const struct timespec *timeout, const sigset_t *sigmask, int *num_events){ ++ ++ pollfd* fds = (pollfd*)malloc(num_fds*sizeof(pollfd)); ++ ++ if(!fds) ++ return ENOMEM; ++ ++ for(int fd = 0; fd < num_fds; ++fd){ ++ short events; ++ if(read_set && FD_ISSET(fd, read_set)){ ++ events |= POLLIN; ++ } ++ if(write_set && FD_ISSET(fd, write_set)){ ++ events |= POLLOUT; ++ } ++ if(except_set && FD_ISSET(fd, except_set)){ ++ events |= POLLPRI; ++ } ++ ++ ++ if(events){ ++ fds[fd].fd = fd; ++ fds[fd].events = events; ++ fds[fd].revents = 0; ++ } ++ else{ ++ fds[fd].fd = -1; ++ } ++ } ++ ++ ++ int time = timeout->tv_sec * 1000 + timeout->tv_nsec / 1000000; ++ ++ int err = sys_poll(fds, num_fds, time, num_events); ++ ++ if(err){ ++ free(fds); ++ return err; ++ } ++ ++ for(int fd = 0; fd < num_fds; ++fd){ ++ if(read_set && (fds[fd].revents & POLLIN) == 0) ++ FD_CLR(fd, read_set); ++ ++ if(write_set && (fds[fd].revents & POLLOUT) == 0) ++ FD_CLR(fd, write_set); ++ ++ if(except_set && (fds[fd].revents & POLLPRI) == 0) ++ FD_CLR(fd, except_set); ++ } ++ ++ return 0; ++ } ++ ++#endif ++ ++ int sys_umask(mode_t mask, mode_t* old){ ++ long ret; ++ long err = syscall(SYSCALL_UMASK, &ret, mask); ++ *old = ret; ++ return err; ++ } ++ ++ int sys_mkdirat(int dirfd, const char* path, mode_t mode){ ++ long res; ++ return syscall(SYSCALL_MKDIRAT, &res, dirfd, (uint64_t)path, mode); ++ } ++ ++ int sys_mkdir(const char* path, mode_t mode){ ++ long res; ++ return syscall(SYSCALL_MKDIR, &res, (uint64_t)path, mode); ++ } ++ ++ int sys_pipe(int *fds, int flags){ ++ long res; ++ int err = syscall(SYSCALL_PIPE2, &res, flags); ++ fds[0] = res & 0xFFFFFFFF; ++ fds[1] = (res >> 32) & 0xFFFFFFFF; ++ return err; ++ } ++ ++ int sys_tcgetattr(int fd, struct termios *attr){ ++ int res; ++ return sys_ioctl(fd, TCGETS, (void*)attr, &res); ++ } ++ ++ int sys_tcsetattr(int fd, int act, const struct termios *attr){ ++ int res; ++ return sys_ioctl(fd, TCSETS, (void*)attr, &res); ++ } ++ ++ int sys_ioctl(int fd, unsigned long request, void *arg, int *result){ ++ long res; ++ int ret = syscall(SYSCALL_IOCTL, &res, fd, request, (uint64_t)arg); ++ *result = res; ++ return ret; ++ } ++ ++ ++ int sys_read_entries(int handle, void *buffer, size_t max_size, size_t *bytes_read){ ++ ++ return syscall(SYSCALL_GETDIRENT, (long*)bytes_read, handle, (uint64_t)buffer, max_size); ++ ++ } ++ ++ ++ int sys_open_dir(const char *path, int *handle){ ++ return sys_open(path, O_RDONLY | O_DIRECTORY, 0, handle); ++ } ++ ++ pid_t sys_getpid(){ ++ long ret; ++ syscall(SYSCALL_GETPID, &ret); ++ return ret; ++ } ++ ++ int sys_chdir(const char* path){ ++ long ret; ++ return syscall(SYSCALL_CHDIR, &ret, (uint64_t)path); ++ } ++ ++ int sys_fcntl(int fd, int request, va_list args, int *result){ ++ long ret; ++ // all currently supported requests only have one arg ++ ++ long arg = va_arg(args, uint64_t); ++ ++ long err = syscall(SYSCALL_FCNTL, &ret, fd, request, arg); ++ *result = ret; ++ return err; ++ } ++ ++ int sys_dup(int fd, int flags, int* newfd){ ++ long ret; ++ long err = syscall(SYSCALL_DUP, &ret, fd); ++ *newfd = ret; ++ return err; ++ } ++ ++ int sys_dup2(int fd, int flags, int newfd){ ++ long ret; ++ return syscall(SYSCALL_DUP2, &ret, fd, newfd); ++ } ++ ++ int sys_waitpid(pid_t pid, int *status, int flags, struct rusage *ru, pid_t *ret_pid){ ++ long ret; ++ long err = syscall(SYSCALL_WAITPID, &ret, pid, (uint64_t)status, flags); ++ *ret_pid = ret; ++ return err; ++ } ++ ++ ++ int sys_execve(const char* name, char* const argv[], char* const envp[]){ ++ long ret; ++ return syscall(SYSCALL_EXECVE, &ret, (uint64_t)name, (uint64_t)argv, (uint64_t)envp); ++ } ++ ++ int sys_fork(pid_t* child){ ++ long ret; ++ long err = syscall(SYSCALL_FORK, &ret); ++ *child = (int)ret; ++ return err; ++ } ++ ++ void sys_libc_log(const char *message){ ++ size_t len = strlen(message); ++ char str[len+1]; ++ memcpy(str, message, len); ++ str[len] = '\n'; ++ long ret; ++ sys_write(2, str, len+1, &ret); ++ } ++ ++ [[noreturn]] void sys_libc_panic(){ ++ sys_libc_log("libc: panic"); ++ sys_exit(1); ++ } ++ ++ ++ [[noreturn]] void sys_exit(int status){ ++ syscall(SYSCALL_EXIT, NULL, status); ++ __builtin_unreachable(); ++ } ++ ++ int sys_tcb_set(void* pointer){ ++ return arch_ctl(ARCH_CTL_FSBASE, pointer); ++ } ++ [[gnu::weak]] int sys_futex_tid(){ ++ long ret; ++ syscall(SYSCALL_GETTID, &ret); ++ return ret; ++ } ++ ++ #define FUTEX_WAIT 0 ++ #define FUTEX_WAKE 1 ++ ++ ++ int sys_futex_wait(int *pointer, int expected, const struct timespec *time){ ++ long ret; ++ return syscall(SYSCALL_FUTEX, &ret, (uintptr_t)pointer, FUTEX_WAIT, expected, (uintptr_t)time); ++ } ++ int sys_futex_wake(int *pointer){ ++ long ret; ++ return syscall(SYSCALL_FUTEX, &ret, (uintptr_t)pointer, FUTEX_WAKE, 0xFFFFFFFF, NULL); ++ } ++ ++ ++ int sys_anon_allocate(size_t size, void **pointer){ ++ return sys_vm_map(NULL, size, PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE, 0, 0, pointer); ++ } ++ int sys_anon_free(void* pointer, size_t size){ ++ return sys_vm_unmap(pointer, size); ++ } ++ ++ int sys_open(const char* pathname, int flags, mode_t mode, int* fd){ ++ long ret; ++ long err = syscall(SYSCALL_OPEN, &ret, (uint64_t)pathname, flags, mode); ++ *fd = (int)ret; ++ return err; ++ }; ++ int sys_read(int fd, void* buff, size_t count, ssize_t *bytes_read){ ++ return syscall(SYSCALL_READ, bytes_read, fd, (uint64_t)buff, count); ++ } ++ int sys_write(int fd, const void* buff, size_t count, ssize_t *bytes_written){ ++ return syscall(SYSCALL_WRITE, bytes_written, fd, (uint64_t)buff, count); ++ } ++ int sys_seek(int fd, off_t offset, int whence, off_t *new_offset){ ++ return syscall(SYSCALL_LSEEK, new_offset, fd, offset, whence); ++ } ++ ++ int sys_close(int fd){ ++ long ret; ++ return syscall(SYSCALL_CLOSE, &ret, fd); ++ } ++ ++ ++ [[gnu::weak]] int sys_stat(fsfd_target fsfdt, int fd, const char* path, int flags, struct stat *statbuf){ ++ long ret; ++ switch(fsfdt){ ++ case fsfd_target::path: ++ return syscall(SYSCALL_STAT, &ret, (uint64_t)path, (uint64_t)statbuf); ++ case fsfd_target::fd: ++ return syscall(SYSCALL_FSTAT, &ret, fd, (uint64_t)statbuf); ++ case fsfd_target::fd_path: ++ return syscall(SYSCALL_FSTATAT, &ret, fd, (uint64_t)path, (uint64_t)statbuf, flags); ++ default: ++ mlibc::infoLogger() << "libc: stat: Unknown fsfd_target: " << (int)fsfdt << frg::endlog; ++ return ENOSYS; ++ } ++ } ++ ++ int sys_vm_map(void *hint, size_t size, int prot, int flags, int fd, off_t offset, void** window){ ++ long ret = syscall(SYSCALL_MMAP, (int64_t*)window, (uint64_t)hint, size, prot, flags, fd, offset); ++ return ret; ++ } ++ ++ int sys_vm_unmap(void* pointer, size_t size){ ++ long ret; ++ return syscall(SYSCALL_MUNMAP, &ret, (uint64_t)pointer, size); ++ } ++ ++ int sys_isatty(int fd){ ++ long ret; ++ return syscall(SYSCALL_ISATTY, &ret, fd); ++ } ++ ++} // namespace mlibc ++ +diff --git mlibc-workdir/sysdeps/astral/include/astral/archctl.h mlibc-workdir/sysdeps/astral/include/astral/archctl.h +new file mode 100644 +index 0000000..f181400 +--- /dev/null ++++ mlibc-workdir/sysdeps/astral/include/astral/archctl.h +@@ -0,0 +1,11 @@ ++#ifndef _ASTRAL_SYSCALL_ARCHCTL_INCLUDE ++#define _ASTRAL_SYSCALL_ARCHCTL_INCLUDE ++ ++#include ++ ++#define ARCH_CTL_GSBASE 0 ++#define ARCH_CTL_FSBASE 1 ++ ++int arch_ctl(int func, void* arg); ++ ++#endif +diff --git mlibc-workdir/sysdeps/astral/include/astral/syscall.h mlibc-workdir/sysdeps/astral/include/astral/syscall.h +new file mode 100644 +index 0000000..12d7d44 +--- /dev/null ++++ mlibc-workdir/sysdeps/astral/include/astral/syscall.h +@@ -0,0 +1,71 @@ ++#ifndef _SYSCALL_H_INCLUDE ++#define _SYSCALL_H_INCLUDE ++ ++#define SYSCALL_LIBC_LOG 0 ++#define SYSCALL_MMAP 1 ++#define SYSCALL_ARCH_CTL 2 ++#define SYSCALL_GETTID 3 ++#define SYSCALL_OPEN 4 ++#define SYSCALL_READ 5 ++#define SYSCALL_LSEEK 6 ++#define SYSCALL_CLOSE 7 ++#define SYSCALL_ISATTY 8 ++#define SYSCALL_WRITE 9 ++#define SYSCALL_STAT 10 ++#define SYSCALL_FSTAT 11 ++#define SYSCALL_FORK 12 ++#define SYSCALL_EXECVE 13 ++#define SYSCALL_WAITPID 14 ++#define SYSCALL_EXIT 15 ++#define SYSCALL_DUP 16 ++#define SYSCALL_DUP2 17 ++#define SYSCALL_FCNTL 18 ++#define SYSCALL_GETPID 19 ++#define SYSCALL_GETDIRENT 20 ++#define SYSCALL_IOCTL 21 ++#define SYSCALL_CHDIR 22 ++#define SYSCALL_FSTATAT 23 ++#define SYSCALL_PIPE2 24 ++#define SYSCALL_MKDIR 25 ++#define SYSCALL_MUNMAP 26 ++#define SYSCALL_UMASK 27 ++#define SYSCALL_POLL 28 ++#define SYSCALL_FCHMODAT 29 ++#define SYSCALL_OPENAT 30 ++#define SYSCALL_CHROOT 31 ++#define SYSCALL_MKDIRAT 32 ++#define SYSCALL_CLOCK_GETTIME 33 ++#define SYSCALL_SOCKET 34 ++#define SYSCALL_BIND 35 ++#define SYSCALL_LISTEN 36 ++#define SYSCALL_CONNECT 37 ++#define SYSCALL_ACCEPT 38 ++#define SYSCALL_NANOSLEEP 39 ++#define SYSCALL_FCHMOD 40 ++#define SYSCALL_LINKAT 41 ++#define SYSCALL_RECVMSG 42 ++#define SYSCALL_FUTEX 43 ++#define SYSCALL_NEWTHREAD 44 ++#define SYSCALL_THREADEXIT 45 ++ ++#include ++#include ++ ++static long syscall(long func, long* ret, uint64_t p1 = 0, uint64_t p2 = 0, uint64_t p3 = 0, uint64_t p4 = 0, uint64_t p5 = 0, uint64_t p6 = 0){ ++ ++ volatile long err; ++ ++ register uint64_t r4 asm("r10") = p4; ++ register uint64_t r5 asm("r8") = p5; ++ register uint64_t r6 asm("r9") = p6; ++ ++ asm volatile("syscall" ++ : "=a"(*ret), "=d"(err) ++ : "a"(func), "D"(p1), "S"(p2), "d"(p3), "r"(r4), ++ "r"(r5), "r"(r6) ++ : "memory", "rcx", "r11"); ++ return err; ++ ++} ++ ++#endif +diff --git mlibc-workdir/sysdeps/astral/meson.build mlibc-workdir/sysdeps/astral/meson.build +new file mode 100644 +index 0000000..f45b716 +--- /dev/null ++++ mlibc-workdir/sysdeps/astral/meson.build +@@ -0,0 +1,67 @@ ++ ++rtdl_sources += files( ++ 'generic/generic.cpp', ++ 'generic/astral.cpp', ++) ++ ++libc_sources += files( ++ 'generic/entry.cpp', ++ 'generic/astral.cpp', ++ 'generic/generic.cpp', ++ 'threading/x86_64-thread.cpp', ++ 'threading/x86_64-thread-entry.S', ++) ++ ++if not no_headers ++ install_headers( ++ 'include/abi-bits/auxv.h', ++ 'include/abi-bits/suseconds_t.h', ++ 'include/abi-bits/fsblkcnt_t.h', ++ 'include/abi-bits/fsfilcnt_t.h', ++ 'include/abi-bits/clockid_t.h', ++ 'include/abi-bits/socklen_t.h', ++ 'include/abi-bits/socket.h', ++ 'include/abi-bits/statfs.h', ++ 'include/abi-bits/inotify.h', ++ 'include/abi-bits/poll.h', ++ 'include/abi-bits/seek-whence.h', ++ 'include/abi-bits/vm-flags.h', ++ 'include/abi-bits/errno.h', ++ 'include/abi-bits/fcntl.h', ++ 'include/abi-bits/in.h', ++ 'include/abi-bits/resource.h', ++ 'include/abi-bits/stat.h', ++ 'include/abi-bits/signal.h', ++ 'include/abi-bits/socket.h', ++ 'include/abi-bits/termios.h', ++ 'include/abi-bits/time.h', ++ 'include/abi-bits/blkcnt_t.h', ++ 'include/abi-bits/blksize_t.h', ++ 'include/abi-bits/dev_t.h', ++ 'include/abi-bits/gid_t.h', ++ 'include/abi-bits/ino_t.h', ++ 'include/abi-bits/mode_t.h', ++ 'include/abi-bits/nlink_t.h', ++ 'include/abi-bits/pid_t.h', ++ 'include/abi-bits/uid_t.h', ++ 'include/abi-bits/access.h', ++ 'include/abi-bits/wait.h', ++ 'include/abi-bits/utsname.h', ++ 'include/abi-bits/limits.h', ++ 'include/abi-bits/shm.h', ++ 'include/abi-bits/epoll.h', ++ 'include/abi-bits/ioctls.h', ++ subdir: 'abi-bits' ++ ) ++endif ++ ++if not headers_only ++ crt = custom_target('crt0', ++ build_by_default: true, ++ command: c_compiler.cmd_array() + ['-c', '-o', '@OUTPUT@', '@INPUT@'], ++ input: 'crt-x86_64/crt0.S', ++ output: 'crt0.o', ++ install: true, ++ install_dir: get_option('libdir') ++ ) ++endif ++ +diff --git mlibc-workdir/sysdeps/astral/threading/x86_64-thread-entry.S mlibc-workdir/sysdeps/astral/threading/x86_64-thread-entry.S +new file mode 100644 +index 0000000..4cb3ae0 +--- /dev/null ++++ mlibc-workdir/sysdeps/astral/threading/x86_64-thread-entry.S +@@ -0,0 +1,7 @@ ++ .section .text ++.global __mlibc_thread_entry ++__mlibc_thread_entry: ++ pop %rdi ++ pop %rsi ++ pop %rdx ++ call __mlibc_thread_trampoline +diff --git mlibc-workdir/sysdeps/astral/threading/x86_64-thread.cpp mlibc-workdir/sysdeps/astral/threading/x86_64-thread.cpp +new file mode 100644 +index 0000000..c234e77 +--- /dev/null ++++ mlibc-workdir/sysdeps/astral/threading/x86_64-thread.cpp +@@ -0,0 +1,58 @@ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++ ++extern "C" void __mlibc_thread_trampoline(void* (*fn)(void*), Tcb* tcb, void* arg){ ++ ++ ++ if (mlibc::sys_tcb_set(tcb)) ++ __ensure(!"failed to set tcb for new thread"); ++ ++ while (__atomic_load_n(&tcb->tid, __ATOMIC_RELAXED) == 0) ++ mlibc::sys_futex_wait(&tcb->tid, 0, nullptr); ++ ++ tcb->returnValue = fn(arg); ++ ++ __atomic_store_n(&tcb->didExit, 1, __ATOMIC_RELEASE); ++ mlibc::sys_futex_wake(&tcb->didExit); ++ ++ mlibc::sys_thread_exit(); ++} ++ ++#define DEFAULT_STACK 0x400000 ++ ++namespace mlibc{ ++ ++ int sys_prepare_stack(void **stack, void *entry, void *arg, void *tcb, size_t *stack_size, size_t *guard_size){ ++ ++ // TODO guard ++ ++ mlibc::infoLogger() << "mlibc: sys_prepare_stack() does not setup a guard!" << frg::endlog; ++ ++ *guard_size = 0; ++ ++ *stack_size = *stack_size ? *stack_size : DEFAULT_STACK; ++ ++ if(!*stack){ ++ *stack = mmap(NULL, *stack_size, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0) + *stack_size; ++ if(*stack == MAP_FAILED) ++ return errno; ++ } ++ ++ void** stack_it = (void**)*stack; ++ ++ *--stack_it = arg; ++ *--stack_it = tcb; ++ *--stack_it = entry; ++ ++ *stack = (void*)stack_it; ++ ++ return 0; ++ ++ } ++ ++} diff --git a/recipes/astral b/recipes/astral new file mode 100644 index 00000000..0b6dd94b --- /dev/null +++ b/recipes/astral @@ -0,0 +1,18 @@ +name=astral +revision=1 +from_source=astral +imagedeps="base-devel nasm" +hostdeps="xgcc xbinutils limine" + +configure() { + cp -pr "${source_dir}"/* . +} + +build() { + CC="x86_64-astral-gcc" LD="x86_64-astral-gcc" AS="nasm" make -j${parallelism} +} + +install() { + mkdir -p "${dest_dir}/boot" + cp astral "${dest_dir}/boot" +} diff --git a/recipes/linux-headers b/recipes/linux-headers new file mode 100644 index 00000000..3313d040 --- /dev/null +++ b/recipes/linux-headers @@ -0,0 +1,16 @@ +name=linux-headers +from_source=linux +revision=1 +imagedeps="base-devel rsync" + +configure() { + cp -r ${source_dir}/* . +} + +build() { + true +} + +install() { + make headers_install ARCH=x86_64 INSTALL_HDR_PATH=${dest_dir}/${prefix}/ +} diff --git a/recipes/mlibc-headers b/recipes/mlibc-headers new file mode 100644 index 00000000..50fd0154 --- /dev/null +++ b/recipes/mlibc-headers @@ -0,0 +1,19 @@ +name=mlibc-headers +from_source=mlibc +revision=1 +deps="linux-headers" +imagedeps="ninja meson base-devel" + +configure() { + meson --cross-file "${base_dir}/util/crossfile" --prefix="${prefix}" -Dlinux_kernel_headers="${sysroot}/${prefix}" -Dheaders_only=true "${source_dir}" +} + +build() { + + ninja + +} + +install() { + DESTDIR=${dest_dir} ninja install +} diff --git a/source-recipes/astral b/source-recipes/astral new file mode 100644 index 00000000..a06ab615 --- /dev/null +++ b/source-recipes/astral @@ -0,0 +1,7 @@ +name=astral +version=0 +source_dir="kernel-src" + +regenerate() { + true +} diff --git a/source-recipes/autoconf b/source-recipes/autoconf new file mode 100644 index 00000000..5dc12eeb --- /dev/null +++ b/source-recipes/autoconf @@ -0,0 +1,9 @@ +name=autoconf +version=2.69 +source_method=tarball +tarball_url="https://ftp.gnu.org/gnu/autoconf/autoconf-${version}.tar.xz" +tarball_sha512="995d3e5a8eb1eb37e2b7fae53c6ec7a9b4df997286b7d643344818f94636756b1bf5ff5ea9155e755cb9461149a853dfbf2886fc6bd7132e5afa9c168e306e9b" + +regenerate() { + true +} diff --git a/source-recipes/autoconf-archive b/source-recipes/autoconf-archive new file mode 100644 index 00000000..9fe7e729 --- /dev/null +++ b/source-recipes/autoconf-archive @@ -0,0 +1,9 @@ +name=autoconf-archive +version=2022.09.03 +source_method=tarball +tarball_url="https://ftp.gnu.org/gnu/autoconf-archive/autoconf-archive-${version}.tar.xz" +tarball_sha512="157b5b6a979d5ec5bfab6ddf34422da620fec1e95f4c901821abbb7361544af77747b4a449029b84750d75679d6130a591e98da8772de2c121ecdea163f0340b" + +regenerate() { + true +} diff --git a/source-recipes/automake b/source-recipes/automake new file mode 100644 index 00000000..5926072f --- /dev/null +++ b/source-recipes/automake @@ -0,0 +1,9 @@ +name=automake +version=1.15.1 +source_method=tarball +tarball_url="https://ftp.gnu.org/gnu/automake/automake-${version}.tar.gz" +tarball_sha512="f0d4717ebe2c76cec5d487de090f6e1c0f784b0d382fd964ffa846287e2a364a52531a26ab98b7033ac04ed302a247b3b114299def54819a03439bfc962ff61b" + +regenerate() { + true +} diff --git a/source-recipes/binutils b/source-recipes/binutils new file mode 100644 index 00000000..c7417f11 --- /dev/null +++ b/source-recipes/binutils @@ -0,0 +1,11 @@ +name=binutils +version=2.39 +source_method=tarball +tarball_url="https://ftpmirror.gnu.org/binutils/binutils-${version}.tar.xz" +tarball_sha512="68e038f339a8c21faa19a57bbc447a51c817f47c2e06d740847c6e9cc3396c025d35d5369fa8c3f8b70414757c89f0e577939ddc0d70f283182504920f53b0a3" +hostdeps="autoconf automake" + +regenerate() { + (cd ld && automake) +} + diff --git a/source-recipes/gcc b/source-recipes/gcc new file mode 100644 index 00000000..67f5b5a0 --- /dev/null +++ b/source-recipes/gcc @@ -0,0 +1,10 @@ +name=gcc +version=12.1.0 +source_method=tarball +tarball_url="https://ftp.gnu.org/gnu/gcc/gcc-${version}/gcc-${version}.tar.xz" +tarball_sha512="2121d295292814a6761edf1fba08c5f633ebe16f52b80e7b73a91050e71e1d2ed98bf17eebad263e191879561c02b48906c53faa4c4670c486a26fc75df23900" +hostdeps="automake autoconf" + +regenerate() { + (cd libstdc++-v3 && autoconf) +} diff --git a/source-recipes/libtool b/source-recipes/libtool new file mode 100644 index 00000000..433b5de0 --- /dev/null +++ b/source-recipes/libtool @@ -0,0 +1,14 @@ +name=libtool +version=2.4.7 +source_method=tarball +tarball_url="https://ftp.gnu.org/gnu/libtool/libtool-${version}.tar.gz" +tarball_sha512="27acef46d9eb67203d708b57d80b853f76fa4b9c2720ff36ec161e6cdf702249e7982214ddf60bae75511aa79bc7d92aa27e3eab7ef9c0f5c040e8e42e76a385" +hostdeps="autoconf automake" +imagedeps="base-devel help2man wget" +allow_network="yes" + +regenerate() { + wget https://git.savannah.gnu.org/cgit/gnulib.git/snapshot/gnulib-4b17a1ae49e69df1ac5dc35a4f60b20ab958baf2.tar.gz + tar -xf gnulib-4b17a1ae49e69df1ac5dc35a4f60b20ab958baf2.tar.gz + ./bootstrap --force --skip-git --skip-po --gnulib-srcdir=`pwd`/gnulib-4b17a1ae49e69df1ac5dc35a4f60b20ab958baf2 +} diff --git a/source-recipes/limine b/source-recipes/limine new file mode 100644 index 00000000..4f9e8143 --- /dev/null +++ b/source-recipes/limine @@ -0,0 +1,10 @@ +name=limine +version=4.20230408.0 +source_method=tarball +tarball_url="https://github.com/limine-bootloader/limine/releases/download/v${version}/limine-${version}.tar.xz" +tarball_sha512="0b3a7c907c79e8ddf0c54432ec65f4f42cce9f74a71dcf7d9c21a5a94b9957a72ed9d47216baf8cc9c03ef0e74ad883e2e2442571ff292952a60d61d379056f7" +hostdeps="autoconf automake libtool pkgconfig" + +regenerate() { + autoreconf -fvi +} diff --git a/source-recipes/linux b/source-recipes/linux new file mode 100644 index 00000000..e5e5ed04 --- /dev/null +++ b/source-recipes/linux @@ -0,0 +1,9 @@ +name=linux +version=6.1.22 +source_method=tarball +tarball_url="https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-${version}.tar.xz" +tarball_sha512="9db5360c85a2e8c7d1a3a37e0d79dafe3561566e098394a15e8cb48929a7afa74b203d3d67c286a8ddb4359a0ba8d45f33678219f9ccb8f728d1c4d4455fd27f" + +regenerate() { + true +} diff --git a/source-recipes/mlibc b/source-recipes/mlibc new file mode 100644 index 00000000..cfa7aef8 --- /dev/null +++ b/source-recipes/mlibc @@ -0,0 +1,10 @@ +name=mlibc +version=e94df5bc67e850b94a47e9b47978756e0b921f33 +source_method=tarball +tarball_url="https://github.com/managarm/mlibc/archive/${version}.tar.gz" +tarball_sha512="27aba51157490d47d01a92d675d91b1cf79c05a562787a63a032a0ef407d063b3dd2dff7ce2a1e76e460a2225b051103eba9c5590230e79459d15a43fbbfe8c2" + +regenerate() { + mkdir -p ${source_dir}/sysdeps/astral/include/ + ln -sv ../../../abis/linux/ ${source_dir}/sysdeps/astral/include/abi-bits +} diff --git a/source-recipes/pkgconfig b/source-recipes/pkgconfig new file mode 100644 index 00000000..1dee3802 --- /dev/null +++ b/source-recipes/pkgconfig @@ -0,0 +1,10 @@ +name=pkgconfig +version=1.8.0 +source_method=tarball +tarball_url="https://github.com/pkgconf/pkgconf/archive/refs/tags/pkgconf-${version}.tar.gz" +tarball_sha512="6b0ce203e85dc671503ad4bebdfdddc567916a8cdd77f739350db99e1e01c098ea2e3111309d2beeff2eff5389f328372ec327eb590f7b3a120b2452ed24021d" +imagedeps="autoconf automake" + +regenerate() { + ./autogen.sh +} diff --git a/util/crossfile b/util/crossfile new file mode 100644 index 00000000..a50c89d0 --- /dev/null +++ b/util/crossfile @@ -0,0 +1,12 @@ +[host_machine] +system = 'astral' +cpu_family = 'x86_64' +cpu = 'x86_64' +endian = 'little' +[binaries] +c = 'x86_64-astral-gcc' +cpp = 'x86_64-astral-g++' +ar = 'x86_64-astral-ar' +strip = 'x86_64-astral-strip' +ld = 'x86_64-astral-ld' +pkgconfig = 'x86_64-astral-pkg-config'