mirror of
https://github.com/fosslinux/live-bootstrap.git
synced 2026-03-04 10:25:25 +01:00
Remove the notion of "sys*"
- This idea originates from very early in the project and was, at the
time, a very easy way to categorise things.
- Now, it doesn't really make much sense - it is fairly arbitary, often
occuring when there is a change in kernel, but not from builder-hex0
to fiwix, and sysb is in reality completely unnecessary.
- In short, the sys* stuff is a bit of a mess that makes the project
more difficult to understand.
- This puts everything down into one folder and has a manifest file that
is used to generate the build scripts on the fly rather than using
coded scripts.
- This is created in the "seed" stage.
stage0-posix -- (calls) --> seed -- (generates) --> main steps
Alongside this change there are a variety of other smaller fixups to the
general structure of the live-bootstrap rootfs.
- Creating a rootfs has become much simpler and is defined as code in
go.sh. The new structure, for an about-to-be booted system, is
/
-- /steps (direct copy of steps/)
-- /distfiles (direct copy of distfiles/)
-- all files from seed/*
-- all files from seed/stage0-posix/*
- There is no longer such a thing as /usr/include/musl, this didn't
really make any sense, as musl is the final libc used. Rather, to
separate musl and mes, we have /usr/include/mes, which is much easier
to work with.
- This also makes mes easier to blow away later.
- A few things that weren't properly in packages have been changed;
checksum-transcriber, simple-patch, kexec-fiwix have all been given
fully qualified package names.
- Highly breaking change, scripts now exist in their package directory
but NOT WITH THE packagename.sh. Rather, they use pass1.sh, pass2.sh,
etc. This avoids manual definition of passes.
- Ditto with patches; default directory is patches, but then any patch
series specific to a pass are named patches-passX.
This commit is contained in:
parent
0907cfd073
commit
6ed2e09f3a
546 changed files with 700 additions and 1299 deletions
31
steps/musl-1.1.24/pass1.sh
Executable file
31
steps/musl-1.1.24/pass1.sh
Executable file
|
|
@ -0,0 +1,31 @@
|
|||
# SPDX-FileCopyrightText: 2021 Andrius Štikonas <andrius@stikonas.eu>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
src_prepare() {
|
||||
default
|
||||
|
||||
# tcc does not support complex types
|
||||
rm -rf src/complex
|
||||
|
||||
# Configure fails without this
|
||||
mkdir -p /dev
|
||||
}
|
||||
|
||||
src_configure() {
|
||||
CC=tcc ./configure \
|
||||
--host=i386 \
|
||||
--disable-shared \
|
||||
--prefix="${PREFIX}" \
|
||||
--libdir="${LIBDIR}" \
|
||||
--includedir="${PREFIX}/include/"
|
||||
|
||||
# configure script creates this file
|
||||
if test -f /dev/null; then
|
||||
rm /dev/null
|
||||
fi
|
||||
}
|
||||
|
||||
src_compile() {
|
||||
make "${MAKEJOBS}" CROSS_COMPILE= AR="tcc -ar" RANLIB=true CFLAGS="-DSYSCALL_NO_TLS"
|
||||
}
|
||||
1
steps/musl-1.1.24/pass2.sh
Symbolic link
1
steps/musl-1.1.24/pass2.sh
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
pass1.sh
|
||||
33
steps/musl-1.1.24/pass3.sh
Executable file
33
steps/musl-1.1.24/pass3.sh
Executable file
|
|
@ -0,0 +1,33 @@
|
|||
# SPDX-FileCopyrightText: 2021 Andrius Štikonas <andrius@stikonas.eu>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
src_prepare() {
|
||||
default
|
||||
|
||||
# tcc does not support complex types
|
||||
rm -rf src/complex
|
||||
}
|
||||
|
||||
src_configure() {
|
||||
CC=tcc ./configure \
|
||||
--host=i386 \
|
||||
--disable-shared \
|
||||
--prefix="${PREFIX}" \
|
||||
--libdir="${LIBDIR}" \
|
||||
--includedir="${PREFIX}/include"
|
||||
|
||||
# configure script creates this file
|
||||
if test -f /dev/null; then
|
||||
rm /dev/null
|
||||
fi
|
||||
}
|
||||
|
||||
src_compile() {
|
||||
make "${MAKEJOBS}" PREFIX="${PREFIX}" CROSS_COMPILE= CFLAGS="-DSYSCALL_NO_TLS" AS_CMD='as -o $@ $<'
|
||||
}
|
||||
|
||||
src_install() {
|
||||
rm -rf "${PREFIX}/include"
|
||||
make PREFIX="${PREFIX}" DESTDIR="${DESTDIR}" install
|
||||
}
|
||||
1
steps/musl-1.1.24/patches-pass3/avoid_set_thread_area.patch
Symbolic link
1
steps/musl-1.1.24/patches-pass3/avoid_set_thread_area.patch
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
../patches/avoid_set_thread_area.patch
|
||||
1
steps/musl-1.1.24/patches-pass3/avoid_sys_clone.patch
Symbolic link
1
steps/musl-1.1.24/patches-pass3/avoid_sys_clone.patch
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
../patches/avoid_sys_clone.patch
|
||||
1
steps/musl-1.1.24/patches-pass3/set_thread_area.patch
Symbolic link
1
steps/musl-1.1.24/patches-pass3/set_thread_area.patch
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
../patches/set_thread_area.patch
|
||||
1
steps/musl-1.1.24/patches-pass3/va_list.patch
Symbolic link
1
steps/musl-1.1.24/patches-pass3/va_list.patch
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
../patches/va_list.patch
|
||||
43
steps/musl-1.1.24/patches/avoid_set_thread_area.patch
Normal file
43
steps/musl-1.1.24/patches/avoid_set_thread_area.patch
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
# SPDX-FileCopyrightText: 2023 Richard Masters <grick23@gmail.com>
|
||||
# SPDX-License-Identifier: MIT
|
||||
diff -r -u musl-1.1.24.orig/arch/i386/pthread_arch.h musl-1.1.24/arch/i386/pthread_arch.h
|
||||
--- arch/i386/pthread_arch.h 2019-10-13 21:58:27.000000000 +0000
|
||||
+++ arch/i386/pthread_arch.h 2023-04-07 11:56:04.649119523 +0000
|
||||
@@ -1,8 +1,8 @@
|
||||
+extern pthread_t g_pthread;
|
||||
+
|
||||
static inline struct pthread *__pthread_self()
|
||||
{
|
||||
- struct pthread *self;
|
||||
- __asm__ ("movl %%gs:0,%0" : "=r" (self) );
|
||||
- return self;
|
||||
+ return g_pthread;
|
||||
}
|
||||
|
||||
#define TP_ADJ(p) (p)
|
||||
diff -r -u musl-1.1.24.orig/src/env/__init_tls.c musl-1.1.24/src/env/__init_tls.c
|
||||
--- src/env/__init_tls.c 2019-10-13 21:58:27.000000000 +0000
|
||||
+++ src/env/__init_tls.c 2023-04-07 11:56:43.565120289 +0000
|
||||
@@ -10,20 +10,19 @@
|
||||
#include "syscall.h"
|
||||
|
||||
volatile int __thread_list_lock;
|
||||
+pthread_t g_pthread;
|
||||
|
||||
int __init_tp(void *p)
|
||||
{
|
||||
pthread_t td = p;
|
||||
td->self = td;
|
||||
- int r = __set_thread_area(TP_ADJ(p));
|
||||
- if (r < 0) return -1;
|
||||
- if (!r) libc.can_do_threads = 1;
|
||||
td->detach_state = DT_JOINABLE;
|
||||
td->tid = __syscall(SYS_set_tid_address, &__thread_list_lock);
|
||||
td->locale = &libc.global_locale;
|
||||
td->robust_list.head = &td->robust_list.head;
|
||||
td->sysinfo = __sysinfo;
|
||||
td->next = td->prev = td;
|
||||
+ g_pthread = td;
|
||||
return 0;
|
||||
}
|
||||
|
||||
18
steps/musl-1.1.24/patches/avoid_sys_clone.patch
Normal file
18
steps/musl-1.1.24/patches/avoid_sys_clone.patch
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
# SPDX-FileCopyrightText: 2023 Richard Masters <grick23@gmail.com>
|
||||
# SPDX-License-Identifier: MIT
|
||||
--- src/process/posix_spawn.c 2019-10-13 21:58:27.000000000 +0000
|
||||
+++ src/process/posix_spawn.c 2023-04-07 11:50:47.253113271 +0000
|
||||
@@ -182,8 +182,11 @@
|
||||
args.envp = envp;
|
||||
pthread_sigmask(SIG_BLOCK, SIGALL_SET, &args.oldmask);
|
||||
|
||||
- pid = __clone(child, stack+sizeof stack,
|
||||
- CLONE_VM|CLONE_VFORK|SIGCHLD, &args);
|
||||
+ pid = fork();
|
||||
+ if (pid == 0) {
|
||||
+ _exit(child(&args));
|
||||
+ }
|
||||
+
|
||||
close(args.p[1]);
|
||||
|
||||
if (pid > 0) {
|
||||
63
steps/musl-1.1.24/patches/fenv.patch
Normal file
63
steps/musl-1.1.24/patches/fenv.patch
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
SPDX-FileCopyrightText: 2021 Andrius Štikonas <andrius@stikonas.eu>
|
||||
SPDX-FileCopyrightText: 2021 fosslinux <fosslinux@aussies.space>
|
||||
|
||||
SPDX-License-Identifier: MIT
|
||||
|
||||
tcc does not seem to support stmxcsr and ldmxcsr.
|
||||
Remove those. This might break float exception handling but we
|
||||
are unlikely to need it.
|
||||
diff -U3 -r src/fenv/i386/fenv.s src/fenv/i386/fenv.s
|
||||
--- src/fenv/i386/fenv.s 2019-10-13 22:58:27.000000000 +0100
|
||||
+++ src/fenv/i386/fenv.s 2021-02-01 00:27:04.924135707 +0000
|
||||
@@ -17,7 +17,6 @@
|
||||
jz 1f
|
||||
fnclex
|
||||
1: push %edx
|
||||
- stmxcsr (%esp)
|
||||
pop %edx
|
||||
and $0x3f,%eax
|
||||
or %eax,%edx
|
||||
@@ -26,7 +25,6 @@
|
||||
not %ecx
|
||||
and %ecx,%edx
|
||||
push %edx
|
||||
- ldmxcsr (%esp)
|
||||
pop %edx
|
||||
1: xor %eax,%eax
|
||||
ret
|
||||
@@ -77,11 +75,9 @@
|
||||
pop %edx
|
||||
testl $0x02000000,(%edx)
|
||||
jz 1f
|
||||
- stmxcsr (%esp)
|
||||
shl $3,%ch
|
||||
andb $0x9f,1(%esp)
|
||||
or %ch,1(%esp)
|
||||
- ldmxcsr (%esp)
|
||||
1: pop %ecx
|
||||
ret
|
||||
|
||||
@@ -107,7 +103,6 @@
|
||||
testl $0x02000000,(%edx)
|
||||
jz 1f
|
||||
push %eax
|
||||
- stmxcsr (%esp)
|
||||
pop %edx
|
||||
and $0x3f,%edx
|
||||
or %edx,4(%ecx)
|
||||
@@ -143,7 +138,6 @@
|
||||
shl $3,%ecx
|
||||
or $0x1f80,%ecx
|
||||
mov %ecx,4(%esp)
|
||||
- ldmxcsr 4(%esp)
|
||||
1: ret
|
||||
|
||||
.global fetestexcept
|
||||
@@ -158,7 +152,6 @@
|
||||
pop %edx
|
||||
testl $0x02000000,(%edx)
|
||||
jz 1f
|
||||
- stmxcsr 4(%esp)
|
||||
or 4(%esp),%eax
|
||||
1: and %ecx,%eax
|
||||
ret
|
||||
17
steps/musl-1.1.24/patches/makefile.patch
Normal file
17
steps/musl-1.1.24/patches/makefile.patch
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
SPDX-FileCopyrightText: 2021 Andrius Štikonas <andrius@stikonas.eu>
|
||||
SPDX-FileCopyrightText: 2021 fosslinux <fosslinux@aussies.space>
|
||||
|
||||
SPDX-License-Identifier: MIT
|
||||
|
||||
tcc -ar does not support creating empty archives
|
||||
--- Makefile 2019-10-13 22:58:27.000000000 +0100
|
||||
+++ Makefile 2021-02-01 00:21:14.974687663 +0000
|
||||
@@ -167,7 +167,7 @@
|
||||
|
||||
$(EMPTY_LIBS):
|
||||
rm -f $@
|
||||
- $(AR) rc $@
|
||||
+ touch $@
|
||||
|
||||
lib/%.o: obj/crt/$(ARCH)/%.o
|
||||
cp $< $@
|
||||
17
steps/musl-1.1.24/patches/musl_weak_symbols.patch
Normal file
17
steps/musl-1.1.24/patches/musl_weak_symbols.patch
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
SPDX-FileCopyrightText: 2021 Andrius Štikonas <andrius@stikonas.eu>
|
||||
SPDX-FileCopyrightText: 2021 fosslinux <fosslinux@aussies.space>
|
||||
|
||||
SPDX-License-Identifier: MIT
|
||||
|
||||
Replace weak symbols with strong to workaround an issue with tcc -ar
|
||||
This won't be necessary once we can rebuild with ar from binutils.
|
||||
--- src/include/features.h 2021-02-02 23:15:42.791932948 +0000
|
||||
+++ src/include/features.h 2021-02-02 23:17:21.394647015 +0000
|
||||
@@ -6,6 +6,6 @@
|
||||
#define weak __attribute__((__weak__))
|
||||
#define hidden __attribute__((__visibility__("hidden")))
|
||||
#define weak_alias(old, new) \
|
||||
- extern __typeof(old) new __attribute__((__weak__, __alias__(#old)))
|
||||
+ extern __typeof(old) new __attribute__((/*__weak__, */__alias__(#old)))
|
||||
|
||||
#endif
|
||||
35
steps/musl-1.1.24/patches/set_thread_area.patch
Normal file
35
steps/musl-1.1.24/patches/set_thread_area.patch
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
SPDX-FileCopyrightText: 2020 Rich Felker <dalias@aerifal.cx>
|
||||
|
||||
SPDX-License-Identifier: MIT
|
||||
|
||||
From 0b0640219338b80cf47026d1970b5503414ed7f3 Mon Sep 17 00:00:00 2001
|
||||
From: Rich Felker <dalias@aerifal.cx>
|
||||
Date: Sun, 30 Aug 2020 21:37:12 -0400
|
||||
Subject: fix i386 __set_thread_area fallback
|
||||
|
||||
this code is only needed for pre-2.6 kernels, which are not actually
|
||||
supported anyway, and was never tested. the fallback path using
|
||||
SYS_modify_ldt failed to clear the upper bits of %eax (all ones due to
|
||||
SYS_set_thread_area's return value being an error) before modifying
|
||||
%al to attempt a new syscall.
|
||||
---
|
||||
src/thread/i386/__set_thread_area.s | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
(limited to 'src/thread/i386/__set_thread_area.s')
|
||||
|
||||
diff --git src/thread/i386/__set_thread_area.s src/thread/i386/__set_thread_area.s
|
||||
index c2c21dd5..aa6852be 100644
|
||||
--- src/thread/i386/__set_thread_area.s
|
||||
+++ src/thread/i386/__set_thread_area.s
|
||||
@@ -28,6 +28,7 @@ __set_thread_area:
|
||||
ret
|
||||
2:
|
||||
mov %ebx,%ecx
|
||||
+ xor %eax,%eax
|
||||
xor %ebx,%ebx
|
||||
xor %edx,%edx
|
||||
mov %ebx,(%esp)
|
||||
--
|
||||
cgit v1.2.1
|
||||
|
||||
18
steps/musl-1.1.24/patches/sigsetjmp.patch
Normal file
18
steps/musl-1.1.24/patches/sigsetjmp.patch
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
SPDX-FileCopyrightText: 2021 Andrius Štikonas <andrius@stikonas.eu>
|
||||
SPDX-FileCopyrightText: 2021 fosslinux <fosslinux@aussies.space>
|
||||
|
||||
SPDX-License-Identifier: MIT
|
||||
|
||||
tcc does not like jecxz instruction.
|
||||
--- src/signal/i386/sigsetjmp.s 2019-10-13 22:58:27.000000000 +0100
|
||||
+++ src/signal/i386/sigsetjmp.s 2021-02-01 00:19:25.671735415 +0000
|
||||
@@ -5,7 +5,8 @@
|
||||
sigsetjmp:
|
||||
__sigsetjmp:
|
||||
mov 8(%esp),%ecx
|
||||
- jecxz 1f
|
||||
+ cmp %ecx,0
|
||||
+ je 1f
|
||||
|
||||
mov 4(%esp),%eax
|
||||
popl 24(%eax)
|
||||
64
steps/musl-1.1.24/patches/stdio_flush_on_exit.patch
Normal file
64
steps/musl-1.1.24/patches/stdio_flush_on_exit.patch
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
SPDX-FileCopyrightText: 2021 Paul Dersey <pdersey@gmail.com>
|
||||
|
||||
SPDX-License-Identifier: MIT
|
||||
|
||||
Make sure real __stdio_exit() is called on exit and not the dummy
|
||||
noop versions. This fixes the issue of truncated output when redirecting
|
||||
output to a file or pipe. It also fixes truncated output on programs
|
||||
that forget to call fclose()
|
||||
diff --git a/src/exit/exit.c b/src/exit/exit.c
|
||||
index a6869b37..a4164682 100644
|
||||
--- src/exit/exit.c
|
||||
+++ src/exit/exit.c
|
||||
@@ -2,16 +2,6 @@
|
||||
#include <stdint.h>
|
||||
#include "libc.h"
|
||||
|
||||
-static void dummy()
|
||||
-{
|
||||
-}
|
||||
-
|
||||
-/* atexit.c and __stdio_exit.c override these. the latter is linked
|
||||
- * as a consequence of linking either __toread.c or __towrite.c. */
|
||||
-weak_alias(dummy, __funcs_on_exit);
|
||||
-weak_alias(dummy, __stdio_exit);
|
||||
-weak_alias(dummy, _fini);
|
||||
-
|
||||
extern weak hidden void (*const __fini_array_start)(void), (*const __fini_array_end)(void);
|
||||
|
||||
static void libc_exit_fini(void)
|
||||
diff --git a/src/internal/stdio_impl.h b/src/internal/stdio_impl.h
|
||||
index d7398f59..69141813 100644
|
||||
--- src/internal/stdio_impl.h
|
||||
+++ src/internal/stdio_impl.h
|
||||
@@ -47,9 +47,9 @@ struct _IO_FILE {
|
||||
struct __locale_struct *locale;
|
||||
};
|
||||
|
||||
-extern hidden FILE *volatile __stdin_used;
|
||||
-extern hidden FILE *volatile __stdout_used;
|
||||
-extern hidden FILE *volatile __stderr_used;
|
||||
+extern FILE *volatile __stdin_used;
|
||||
+extern FILE *volatile __stdout_used;
|
||||
+extern FILE *volatile __stderr_used;
|
||||
|
||||
hidden int __lockfile(FILE *);
|
||||
hidden void __unlockfile(FILE *);
|
||||
diff --git a/src/stdio/__stdio_exit.c b/src/stdio/__stdio_exit.c
|
||||
index a5e42c67..5947a141 100644
|
||||
--- src/stdio/__stdio_exit.c
|
||||
+++ src/stdio/__stdio_exit.c
|
||||
@@ -1,10 +1,5 @@
|
||||
#include "stdio_impl.h"
|
||||
|
||||
-static FILE *volatile dummy_file = 0;
|
||||
-weak_alias(dummy_file, __stdin_used);
|
||||
-weak_alias(dummy_file, __stdout_used);
|
||||
-weak_alias(dummy_file, __stderr_used);
|
||||
-
|
||||
static void close_file(FILE *f)
|
||||
{
|
||||
if (!f) return;
|
||||
--
|
||||
2.30.0
|
||||
|
||||
41
steps/musl-1.1.24/patches/va_list.patch
Normal file
41
steps/musl-1.1.24/patches/va_list.patch
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
SPDX-FileCopyrightText: 2019 Giovanni Mascellani <gio@debian.org>
|
||||
|
||||
SPDX-License-Identifier: MIT
|
||||
|
||||
From 1642f5982009e110615a29745f9cafd51a5c1597 Mon Sep 17 00:00:00 2001
|
||||
From: Giovanni Mascellani <gio@debian.org>
|
||||
Date: Tue, 11 Jun 2019 11:20:07 +0200
|
||||
Subject: [PATCH] stdarg.h: add support for tcc.
|
||||
|
||||
---
|
||||
arch/i386/bits/alltypes.h.in | 14 +++++++++++++-
|
||||
1 file changed, 13 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/arch/i386/bits/alltypes.h.in b/arch/i386/bits/alltypes.h.in
|
||||
index 1a8432d3..44cb5987 100644
|
||||
--- arch/i386/bits/alltypes.h.in
|
||||
+++ arch/i386/bits/alltypes.h.in
|
||||
@@ -2,7 +2,19 @@
|
||||
#define _Int64 long long
|
||||
#define _Reg int
|
||||
|
||||
-#if __GNUC__ >= 3
|
||||
+#ifdef __TINYC__
|
||||
+typedef char *__builtin_va_list;
|
||||
+#define __builtin_va_start(ap,last) ap = ((char *)&(last)) + ((sizeof(last)+3)&~3)
|
||||
+#define __builtin_va_arg(ap,type) (ap += (sizeof(type)+3)&~3, *(type *)(ap - ((sizeof(type)+3)&~3)))
|
||||
+#define __builtin_va_copy(dest, src) (dest) = (src)
|
||||
+#define __builtin_va_end(ap)
|
||||
+#ifndef __TINYC_redefine_va_list
|
||||
+#define __TINYC_redefine_va_list
|
||||
+#undef __DEFINED_va_list
|
||||
+#endif
|
||||
+#endif
|
||||
+
|
||||
+#if __GNUC__ >= 3 || defined(__TINYC__)
|
||||
TYPEDEF __builtin_va_list va_list;
|
||||
TYPEDEF __builtin_va_list __isoc_va_list;
|
||||
#else
|
||||
--
|
||||
GitLab
|
||||
|
||||
1
steps/musl-1.1.24/sources
Normal file
1
steps/musl-1.1.24/sources
Normal file
|
|
@ -0,0 +1 @@
|
|||
https://musl.libc.org/releases/musl-1.1.24.tar.gz 1370c9a812b2cf2a7d92802510cca0058cc37e66a7bedd70051f0a34015022a3
|
||||
Loading…
Add table
Add a link
Reference in a new issue