Update the linux kernel for sysb/c to 4.9.10.

- We do not use latest 4.9.x because it relies on a new version of
  binutils, while older versions do not. (Note: we should be able to go
  a bit newer but I didn't bother testing >50 versions to figure this
  out).
- We do not use newer kernel versions because they require one or more
  of (new perl, new binutils, new make, new gcc, new bison, new tar).
- sysb and sysc are updated to use the SATA (libata) subsystem (aka sda)
  instead of IDE-emulating SATA subsystem (aka hda) which is now
  available to us.
- While theoretically according to docs 4.9 should work OOTB with our
  version of binutils this is not the case, so we have to do a bit of
  (interesting) patching. But this does not break anything.
- Thankfully serial support in 4.9 is not screwed over like it is in 2.6
  so we can revert to that.
- 4.9 has the linux-libre project at our disposal, instead of gNewSense.
  So we use this. Unfortunatley that takes forever because we have to
  use sed because our version of gawk is too old/buggy. :( I plan to
  introduce very shortly 1. parallelism 2. 'sysc snapshot' which will
  start from sysc to avoid this. I do not want to use linux-libre
  tarballs because they make modificiations directly from this script
  (aka not easily verifiable, use the source!) and this script allows
  for much greater flexibility.
- We compile the initramfs ahead-of-build using the in-tree cpio
  generator instead of also building cpio to use less packages. We do
  NOT build the initramfs into the kernel like 2.6 (unsupported).
- Oh and fix a kexec-tools checksum.
This commit is contained in:
fosslinux 2021-08-04 12:56:07 +10:00
parent e225435983
commit d429c48d76
23 changed files with 4166 additions and 2014 deletions

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,62 @@
# SPDX-FileCopyrightText: 2021 fosslinux <fosslinux@aussies.space>
#
# SPDX-License-Identifier: GPL-3.0-or-later
src_unpack() {
default || true # Predictable link errors - not a problem
cp ../src/deblob-4.9 ../src/deblob-check ${pkg}/
# Clear up storage space
rm -rf ../src
}
generate_autoconf_h() {
# generate include/linux/autoconf.h -- we do not have gperf rn to do it the normal way
mkdir -p include/generated
# Transform each of the CONFIG_* options that are =y into header
grep -E '=y$' .config | sed 's/=y$/ 1/' | sed 's/^/#define /' >> include/generated/autoconf.h
# Transform each of the CONFIG_* options that are unset into headers
grep -E ' is not set$' .config | sed 's/ is not set$//' | sed 's/#/#undef/' >> include/generated/autoconf.h
# Transform each of the non-boolean options into headers
grep -E '=.*$' .config | grep -v -E '=y$' | sed 's/=/ /' | sed 's/^/#define /' >> include/generated/autoconf.h
}
src_prepare() {
default
mv config .config
mkdir -p include/config
cp .config include/config/auto.conf
generate_autoconf_h
# Deblob the kernel
chmod +x deblob-4.9 deblob-check
# Don't use gawk, use sed
AWK=dosentexist ./deblob-4.9
# Remove shipped files
find . -name "*_shipped*" -delete
}
src_compile() {
# Generate the initramfs so we can remove /sysb
make ARCH=i386 prepare
make ARCH=i386 usr/
mkdir -p "${PREFIX}/boot"
mv usr/initramfs_data.cpio.gz "${PREFIX}/boot/initramfs-sysb"
make clean
rm -rf /sysb
sed -i 's:/sysb::' .config
cp .config include/config/auto.conf
rm include/generated/autoconf.h
generate_autoconf_h
make ARCH=i386 prepare
make ARCH=i386
}
src_install() {
cp arch/i386/boot/bzImage "${PREFIX}/boot/linux-4.9.10"
}

View file

@ -0,0 +1,18 @@
SPDX-FileCopyrightText: 2021 fosslinux <fosslinux@aussies.space>
SPDX-License-Identifier: GPL-2.0-only
Remove the 68() which I'm not really sure what it does but still works and
breaks our version of binutils.
--- arch/x86/boot/bioscall.S 2021-07-31 17:50:09.519480274 +1000
+++ arch/x86/boot/bioscall.S 2021-07-31 18:21:32.086972277 +1000
@@ -65,7 +65,7 @@
movw %ax, %es
/* Copy output state from stack frame */
- movw 68(%esp), %di /* Original %cx == 3rd argument */
+ movw %sp, %di /* Original %cx == 3rd argument */
andw %di, %di
jz 4f
movw %sp, %si

View file

@ -0,0 +1,22 @@
SPDX-FileCopyrightText: 2021 fosslinux <fosslinux@aussies.space>
SPDX-License-Identifier: GPL-2.0-only
There's something incorrect with this macro for live-bootstrap, most likely as
a result of the dodgy installation of linux-headers. However, there is no
problem with this, and it is verified that BITS_PER_LONG __BITS_PER_LONG
have functional and correct values.
--- tools/include/asm-generic/bitsperlong.h 2021-07-31 11:50:26.616768608 +1000
+++ tools/include/asm-generic/bitsperlong.h 2021-07-31 11:50:36.786847443 +1000
@@ -9,10 +9,6 @@
#define BITS_PER_LONG __WORDSIZE
#endif
-#if BITS_PER_LONG != __BITS_PER_LONG
-#error Inconsistent word size. Check asm/bitsperlong.h
-#endif
-
#ifndef BITS_PER_LONG_LONG
#define BITS_PER_LONG_LONG 64
#endif

View file

@ -0,0 +1,17 @@
SPDX-FileCopyrightText: 2021 fosslinux <fosslinux@aussies.space>
SPDX-License-Identifier: GPL-2.0-only
This seemingly useless statement (redefined a couple of lines later) is
not liked by our version of binutils.
--- arch/x86/kernel/vmlinux.lds.S 2021-07-31 18:45:14.787124887 +1000
+++ arch/x86/kernel/vmlinux.lds.S 2021-07-31 18:43:16.234180449 +1000
@@ -170,7 +170,6 @@
. = __vvar_beginning_hack + PAGE_SIZE;
} :data
- . = ALIGN(__vvar_page + PAGE_SIZE, PAGE_SIZE);
/* Init code and data - will be freed after init */
. = ALIGN(PAGE_SIZE);

View file

@ -0,0 +1,18 @@
SPDX-FileCopyrightText: 2021 fosslinux <fosslinux@aussies.space>
SPDX-License-Identifier: GPL-2.0-only
We do not use the _shipped version of the keymap generated using loadkeys.
For some reason the makefile needs to be patched for this to work...
--- drivers/tty/vt/Makefile 2021-07-27 21:11:24.743104498 +1000
+++ drivers/tty/vt/Makefile 2021-07-27 21:11:34.261186200 +1000
@@ -22,7 +22,7 @@
# Uncomment if you're changing the keymap and have an appropriate
# loadkeys version for the map. By default, we'll use the shipped
# versions.
-# GENERATE_KEYMAP := 1
+GENERATE_KEYMAP := 1
ifdef GENERATE_KEYMAP

View file

@ -0,0 +1,34 @@
SPDX-FileCopyrightText: 2021 fosslinux <fosslinux@aussies.space>
SPDX-License-Identifier: GPL-2.0-only
Our older version of binutils dosen't play very nicely with binutils for a
couple of edgecase macros. It seems that ALTERNATIVE is one of these. As we
know what your system will be (not Xen), we can manually evaluate and write
out the ALTERNATIVEs.
--- arch/x86/entry/entry_32.S 2021-07-31 11:40:07.458032771 +1000
+++ arch/x86/entry/entry_32.S 2021-07-31 11:40:42.835298841 +1000
@@ -412,9 +412,8 @@
movl %esp, %eax
call do_fast_syscall_32
- /* XEN PV guests always use IRET path */
- ALTERNATIVE "testl %eax, %eax; jz .Lsyscall_32_done", \
- "jmp .Lsyscall_32_done", X86_FEATURE_XENPV
+ testl %eax, %eax
+ jz .Lsyscall_32_done
/* Opportunistic SYSEXIT */
TRACE_IRQS_ON /* User mode traces as IRQs on. */
--- arch/x86/entry/vdso/vdso32/system_call.S 2021-07-31 11:41:40.379731622 +1000
+++ arch/x86/entry/vdso/vdso32/system_call.S 2021-07-31 11:43:40.294633506 +1000
@@ -55,8 +55,6 @@
/* If SYSENTER (Intel) or SYSCALL32 (AMD) is available, use it. */
ALTERNATIVE_2 "", SYSENTER_SEQUENCE, X86_FEATURE_SYSENTER32, \
SYSCALL_SEQUENCE, X86_FEATURE_SYSCALL32
-#else
- ALTERNATIVE "", SYSENTER_SEQUENCE, X86_FEATURE_SEP
#endif
/* Enter using int $0x80 */

View file

@ -0,0 +1,23 @@
SPDX-FileCopyrightText: 2021 fosslinux <fosslinux@aussies.space>
SPDX-License-Identifier: GPL-2.0-only
kconfig uses gperf, which we don't have at this stage. We manually generate
everything (in the actual script) that is actually required within kconfig,
and forgo everything that is not really required for the build.
--- Makefile 2021-07-30 21:25:43.577592065 +1000
+++ Makefile 2021-07-30 21:26:40.349015612 +1000
@@ -547,10 +547,10 @@
export KBUILD_DEFCONFIG KBUILD_KCONFIG
config: scripts_basic outputmakefile FORCE
- $(Q)$(MAKE) $(build)=scripts/kconfig $@
+ $(Q)true
%config: scripts_basic outputmakefile FORCE
- $(Q)$(MAKE) $(build)=scripts/kconfig $@
+ true
else
# ===========================================================================

View file

@ -0,0 +1,22 @@
SPDX-FileCopyrightText: 2021 fosslinux <fosslinux@aussies.space>
SPDX-License-Identifier: GPL-2.0-only
For some reason (old version of sed/bash?), this falsepos sed thing uses a
lot of RAM within bash and causes an overflow which is caught by bash
but prompts it to crash. As we are not using falsepos detection anyway it
is unused and hence can be set to an empty value.
--- deblob-check 2021-07-30 09:28:09.324276561 +1000
+++ deblob-check 2021-07-30 09:28:31.742449255 +1000
@@ -7232,9 +7232,7 @@
# $4 is the action for every complete input pattern.
set_sed_main () {
- falsepos=`${SED-sed} -n 's,^[+]\^*,,p' < "$regex_name" |
- ${SED-sed} -n -e 's,[$]$,\\\\([\\\\n]\\\\|$\\\\),' \
- -e '1h; 1!H; ${g;s,[\n],\\\\|,g;s,^\(..*\)$,\\\\(\1\\\\),;p;}'`
+ falsepos=
blobs=`${SED-sed} -n 's,^[-],,p' < "$regex_name" |
${SED-sed} -n -e 's,[$]$,\\\\([\\\\n]\\\\|$\\\\),' \
-e '1h; 1!H; ${g;s,[\n],\\\\|,g;s,^\(..*\)$,\\\\(\1\\\\),;p;}'`