diff options
author | davidovski <david@davidovski.xyz> | 2022-05-31 11:05:19 +0100 |
---|---|---|
committer | davidovski <david@davidovski.xyz> | 2022-05-31 11:05:19 +0100 |
commit | 48ca75555522716f0f686dcae3dd6cf3d8ad714d (patch) | |
tree | 00c0f58550ba4661e87376f2f02c8001c69bae44 /repo/syslinux | |
parent | 871b2b573f01c1b3176a0f65458b3d281b41c437 (diff) |
removed idea of repos
Diffstat (limited to 'repo/syslinux')
-rw-r--r-- | repo/syslinux/0018-prevent-pow-optimization.patch | 36 | ||||
-rw-r--r-- | repo/syslinux/fix-sysmacros.patch | 12 | ||||
-rw-r--r-- | repo/syslinux/syslinux.post-upgrade | 61 | ||||
-rw-r--r-- | repo/syslinux/syslinux.trigger | 3 | ||||
-rw-r--r-- | repo/syslinux/syslinux.xibuild | 34 | ||||
-rw-r--r-- | repo/syslinux/update-extlinux | 284 | ||||
-rw-r--r-- | repo/syslinux/update-extlinux.conf | 74 |
7 files changed, 504 insertions, 0 deletions
diff --git a/repo/syslinux/0018-prevent-pow-optimization.patch b/repo/syslinux/0018-prevent-pow-optimization.patch new file mode 100644 index 0000000..0c42c7b --- /dev/null +++ b/repo/syslinux/0018-prevent-pow-optimization.patch @@ -0,0 +1,36 @@ +From: Lukas Schwaighofer <lukas@schwaighofer.name> +Date: Tue, 26 Feb 2019 23:13:58 +0100 +Subject: Prevent optimizing the pow() function + +With the current GCC 8.2.0 from Debian, a section of code calling pow() in +zzjson_parse.c is turned into a sequence calling exp(). Since no exp() +implementation is available in syslinux those optimizations need to be +disabled. +--- + com32/gpllib/zzjson/zzjson_parse.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/com32/gpllib/zzjson/zzjson_parse.c b/com32/gpllib/zzjson/zzjson_parse.c +index ecb6f61..e66a9d8 100644 +--- a/com32/gpllib/zzjson/zzjson_parse.c ++++ b/com32/gpllib/zzjson/zzjson_parse.c +@@ -138,6 +138,10 @@ static ZZJSON *parse_string2(ZZJSON_CONFIG *config) { + return zzjson; + } + ++static double __attribute__((optimize("O0"))) pow_noopt(double x, double y) { ++ return pow(x, y); ++} ++ + static ZZJSON *parse_number(ZZJSON_CONFIG *config) { + ZZJSON *zzjson; + unsigned long long ival = 0, expo = 0; +@@ -213,7 +217,7 @@ skipexpo: + if (dbl) { + dval = sign * (long long) ival; + dval += sign * frac; +- dval *= pow(10.0, (double) signexpo * expo); ++ dval *= pow_noopt(10.0, (double) signexpo * expo); + } + + zzjson = config->calloc(1, sizeof(ZZJSON)); diff --git a/repo/syslinux/fix-sysmacros.patch b/repo/syslinux/fix-sysmacros.patch new file mode 100644 index 0000000..dd622e8 --- /dev/null +++ b/repo/syslinux/fix-sysmacros.patch @@ -0,0 +1,12 @@ +diff --git a/extlinux/main.c b/extlinux/main.c +index a7ebd49..69bb164 100644 +--- a/extlinux/main.c ++++ b/extlinux/main.c +@@ -41,6 +41,7 @@ + #include <sys/types.h> + #include <sys/mount.h> + #include <sys/vfs.h> ++#include <sys/sysmacros.h> + + #include "linuxioctl.h" + diff --git a/repo/syslinux/syslinux.post-upgrade b/repo/syslinux/syslinux.post-upgrade new file mode 100644 index 0000000..9038866 --- /dev/null +++ b/repo/syslinux/syslinux.post-upgrade @@ -0,0 +1,61 @@ +#!/bin/sh + +# find given append opt +get_append_opt() { + awk -v search="$1" ' + $1 == "append" || $1 == "APPEND" { + split($0, a); + for (i in a) { + if (index(a[i], search) == 1) { + print a[i]; + } + } + }' /boot/extlinux.conf | sort | uniq +} + +# print default kernel options +get_default_opts() { + awk ' + $1 == "append" || $1 == "APPEND" { + opts=""; + space=""; + split($0, a); + for (i in a) { + if (i != 1 \ + && (index(a[i], "root=") != 1) \ + && (index(a[i], "initrd=") != 1) \ + && (index(a[i], "modules=") != 1)) { + opts = opts space a[i]; + space = " "; + } + } + print opts; + } + ' /boot/extlinux.conf | sort | uniq +} + +if ! [ -f /boot/extlinux.conf ]; then + exit 0 +fi + +# check if we already have a generated extlinux.conf +if grep -q '^# Generated by update-extlinux' /boot/extlinux.conf; then + exit 0 +fi + +# try fish out the kernel opts from extlinuix.conf's append line +root=$(get_append_opt 'root=' | head -n 1) +modules=$(get_append_opt 'modules=' | head -n 1) +opts=$(get_default_opts | head -n 1) + +# populate update-extlinux.conf with the info we know +if [ -n "$root" ]; then + sed -i -e "/^root=/s|.*|$root|g" /etc/update-extlinux.conf +fi +if [ -n "$modules" ]; then + sed -i -e "/^modules=/s|.*|$modules|g" /etc/update-extlinux.conf +fi +if [ -n "$opts" ]; then + sed -i -e "/^default_kernel_opts=/s|.*|default_kernel_opts=\"$opts\"|g" /etc/update-extlinux.conf +fi + diff --git a/repo/syslinux/syslinux.trigger b/repo/syslinux/syslinux.trigger new file mode 100644 index 0000000..fe91f43 --- /dev/null +++ b/repo/syslinux/syslinux.trigger @@ -0,0 +1,3 @@ +#!/bin/sh + +update-extlinux --warn-only diff --git a/repo/syslinux/syslinux.xibuild b/repo/syslinux/syslinux.xibuild new file mode 100644 index 0000000..19edc66 --- /dev/null +++ b/repo/syslinux/syslinux.xibuild @@ -0,0 +1,34 @@ +#!/bin/sh + +MAKEDEPS="make " +DEPS="util-linux sbase musl" + +PKG_VER=6.03 +SOURCE=https://mirrors.edge.kernel.org/pub/linux/utils/boot/syslinux/${PKG_VER%.*}.xx/syslinux-$PKG_VER.tar.xz +ADDITIONAL=" + update-extlinux.conf + update-extlinux + 0018-prevent-pow-optimization.patch + fix-sysmacros.patch + " +DESC="Boot loader for the Linux operating system" + +prepare () { + apply_patches +} + +build () { + make efi64 installer +} + +package () { + make -j1 INSTALLROOT="$PKG_DEST" MANDIR=/usr/share/man \ + bios efi64 install + + mkdir -p "$PKG_DEST"/etc/update-extlinux.d + cp update-extlinux.conf "$PKG_DEST"/etc/ + sed "/^version=/s/=.*/=$PKG_VER/" update-extlinux \ + > "$PKG_DEST"/sbin/update-extlinux + chmod 755 "$PKG_DEST"/sbin/update-extlinux +} + diff --git a/repo/syslinux/update-extlinux b/repo/syslinux/update-extlinux new file mode 100644 index 0000000..4799cd3 --- /dev/null +++ b/repo/syslinux/update-extlinux @@ -0,0 +1,284 @@ +#!/bin/sh + +version= +default=0 +timeout=5 +verbose=0 + +conf=/boot/extlinux.conf +myconf=/etc/update-extlinux.conf + +# read in extlinux settings +if [ -f "$myconf" ]; then + . $myconf +fi + +everbose() { + if [ "$verbose" = "0" ]; then + return + fi + + echo $* +} + +ewarn() { + echo "WARNING:" $@ >&2 +} + +eerror() { + echo "ERROR:" $@ >&2 + return 1 +} + +usage() { + echo "usage: $0 [-v|--verbose] [--warn-only]" +} + +while [ $# -gt 0 ]; do + opt="$1" + shift + case "$opt" in + -v|--verbose) + verbose=1 + ;; + --warn-only) + warn_only=1 + ;; + --) + break + ;; + -*) + usage + exit 1 + ;; + esac +done + +everbose "Updating extlinux configuration." + +if [ "x$root" = "x" ]; then + ewarn "Root device is not specified in $myconf." + blkid_export=$(blkid -o export /dev/root) + if [ -n "$blkid_export" ]; then + export $blkid_export + fi + if [ -z "$UUID" ]; then + # try parse /proc/mount for mounted / + dev=$(awk '$2 == "/" {dev=$1} END {print dev}' /proc/mounts) + if [ -n "$dev" ]; then + blkid_export=$(blkid -o export $dev) + if [ -n "$blkid_export" ]; then + export "$blkid_export" + fi + fi + fi + if [ -z "$UUID" ]; then + if [ -z "$dev" ]; then + if [ -n "$warn_only" ]; then + ewarn "Failed to detect root device. extlinux.conf is not updated" + exit 0 + else + eerror "Failed to detect root device" + exit 1 + fi + else + root=$dev + fi + else + root=UUID=$UUID + fi + everbose "Root device is: $root" +fi + +rtimeout=$(( ${timeout} * 10 )) +syslinux_menu=menu.c32 +menu_hidden= + +# vesa menu has been requested? +if [ "$vesa_menu" = "1" ]; then + syslinux_menu=vesamenu.c32 +fi + +umask 0022 +rm -f $conf.new +echo "# Generated by update-extlinux $version" > $conf.new +if [ -n "$serial_port" ]; then + echo "SERIAL $serial_port ${serial_baud:-115200}" >> $conf.new +fi +echo "DEFAULT $syslinux_menu" >> $conf.new +echo "PROMPT 0" >> $conf.new +echo "MENU TITLE XiLinux/$(uname -s) Boot Menu" >> $conf.new +if [ "$hidden" = "1" ]; then + echo "MENU HIDDEN" >> $conf.new +fi +echo "MENU AUTOBOOT XiLinux will be booted automatically in # seconds." >> $conf.new +echo "TIMEOUT $rtimeout" >> $conf.new + +lst=0 +if [ -f "/boot/xen.gz" ]; then + for kernel in $(find /boot -name "vmlinuz-*" -type f); do + tag=$(basename $kernel | cut -b9-) + everbose "Found Xen hypervisor: /boot/xen.gz, kernel: $kernel" + + if [ -f "/boot/initramfs-$tag" ]; then + everbose "Found initramfs: /boot/initramfs-$tag" + initramfs="initramfs-$tag" + else + initramfs= + fi + initramfs_stage="${initramfs:+---} $initramfs" + + if [ -f "/boot/amd-ucode.img" ]; then + everbose "Found microcode for AMD CPUs: /boot/amd-ucode.img" + ucode_image_amd="amd-ucode.img" + case "$xen_opts" in + *ucode=scan* ) ;; + * ) xen_opts="$xen_opts ucode=scan" ;; + esac + fi + if [ -f "/boot/intel-ucode.img" ]; then + everbose "Found microcode for Intel CPUs: /boot/intel-ucode.img" + ucode_image_intel="intel-ucode.img" + case "$xen_opts" in + *ucode=scan* ) ;; + * ) xen_opts="$xen_opts ucode=scan" ;; + esac + fi + ucode_image_stage="${ucode_image_amd:+---} $ucode_image_amd ${ucode_image_intel:+---} $ucode_image_intel" + + label=xen-$(grep -w -l $tag /usr/share/kernel/*/kernel.release \ + | cut -d/ -f5) + if [ "$label" = "xen-" ]; then + label=xen-$lst + fi + + dom0_kernel_stage="--- $(basename $kernel) root=$root modules=${modules}${TYPE:+,$TYPE} $default_kernel_opts" + + echo "LABEL $label" >> $conf.new + if [ "$label" = "$default" ]; then + echo " MENU DEFAULT" >> $conf.new + fi + echo " MENU LABEL Xen + Linux $tag" >> $conf.new + echo " COM32 mboot.c32" >> $conf.new + echo " APPEND xen.gz $xen_opts $dom0_kernel_stage $initramfs_stage $ucode_image_stage" >> $conf.new + echo "" >> $conf.new + lst=$(($lst + 1)) + done +fi + +for kernel in $(find /boot -name "vmlinuz*" -type f); do + case $kernel in + *vmlinuz) tag=vanilla;; + *vmlinuz-*) tag=$(basename $kernel | cut -b9-);; + *) continue;; + esac + everbose "Found kernel: $kernel" + label=$(grep -w -l $tag /usr/share/kernel/*/kernel.release | cut -d/ -f5) + if [ -z "$label" ]; then + if [ "$tag" = vanilla ]; then + label="vanilla" + else + label=$lst + fi + fi + echo "LABEL $label" >> $conf.new + if [ "$label" = "$default" ]; then + echo " MENU DEFAULT" >> $conf.new + fi + echo " MENU LABEL Linux $tag" >> $conf.new + echo " LINUX $(basename $kernel)" >> $conf.new + initrd= + if [ -f "/boot/initramfs-$tag" ]; then + everbose "Found initramfs: /boot/initramfs-$tag" + initrd="initramfs-$tag" + fi + if [ -f "/boot/amd-ucode.img" ]; then + everbose "Found microcode for AMD CPUs: /boot/amd-ucode.img" + initrd="amd-ucode.img${initrd:+,}${initrd}" + fi + if [ -f "/boot/intel-ucode.img" ]; then + everbose "Found microcode for Intel CPUs: /boot/intel-ucode.img" + initrd="intel-ucode.img${initrd:+,}${initrd}" + fi + echo " INITRD ${initrd}" >> $conf.new + echo " APPEND root=$root modules=${modules}${TYPE:+,$TYPE} $default_kernel_opts" >> $conf.new + echo "" >> $conf.new + lst=$(($lst + 1)) +done + +if [ -n "$password" ]; then + echo "NOESCAPE 1" >> $conf.new + echo "MENU MASTER PASSWD $password" >> $conf.new + echo "" >> $conf.new + chmod o-r $conf.new +fi + +everbose "$lst entries found." + +for entry in /etc/update-extlinux.d/*; do + [ -f "$entry" ] && { cat $entry; echo ""; } >> $conf.new +done + +echo "MENU SEPARATOR" >> $conf.new +echo "" >> $conf.new + +if [ -f "/boot/hdt.c32" ]; then + everbose "Found Hardware Detection Tool: /boot/hdt.c32" + echo "LABEL hdt" >> $conf.new + echo " MENU LABEL Hardware info" >> $conf.new + if [ -n "$password" ]; then + echo " MENU PASSWD" >> $conf.new + fi + echo " COM32 hdt.c32" >> $conf.new + if [ -f "/boot/memtest" ]; then + everbose "Found memtest86+: /boot/memtest" + echo " APPEND memtest=memtest" >> $conf.new + fi + echo "" >> $conf.new +elif [ -f "/boot/memtest" ]; then + everbose "Found memtest86+: /boot/memtest" + echo "LABEL memtest" >> $conf.new + echo " MENU LABEL Memtest86+" >> $conf.new + echo " KERNEL memtest" >> $conf.new + echo "" >> $conf.new +fi + +for i in reboot poweroff; do + [ -f "/boot/$i.c32" ] || continue + everbose "Found $i" + # make first char capital + cap=$( echo $i | awk '{sub(".", substr(toupper($0),1,1), $0); print}' ) + echo "LABEL $i" >> $conf.new + echo " MENU LABEL $cap" >> $conf.new + echo " COM32 $i.c32" >> $conf.new + echo "" >> $conf.new +done + +if cmp -s $conf.new $conf; then + everbose "Configuration unchanged." + rm $conf.new +fi + +if [ "$overwrite" != "1" ]; then + exit 0 +elif [ -f "$conf.new" ]; then + # keep a backup just in case + if [ -f "$conf" ]; then + mv $conf $conf.old + fi + + mv $conf.new $conf +fi + +everbose "Installing libutil.c32 libcom32.c32 mboot.c32 menu.c32 vesamenu.c32 to /boot." +cp /usr/share/syslinux/libutil.c32 \ + /usr/share/syslinux/libcom32.c32 \ + /usr/share/syslinux/mboot.c32 \ + /usr/share/syslinux/menu.c32 \ + /usr/share/syslinux/vesamenu.c32 \ + /boot + +case "$(findmnt -n -o FSTYPE -T /boot)" in +ext*) extlinux --update /boot || [ -n "$warn_only" ];; +esac + diff --git a/repo/syslinux/update-extlinux.conf b/repo/syslinux/update-extlinux.conf new file mode 100644 index 0000000..1dddff2 --- /dev/null +++ b/repo/syslinux/update-extlinux.conf @@ -0,0 +1,74 @@ +# configuration for extlinux config builder + +# overwrite +# Overwrite current /boot/extlinux.conf. If this is not '1' we will only +# write to /boot/extlinux.conf.new +overwrite=1 + +# vesa_menu +# use fancy vesa menu (vesamenu.c32) menus, won't work with serial +vesa_menu=0 + +# default_kernel_opts +# default kernel options +default_kernel_opts=quiet + +# modules +# modules which should be loaded before pivot_root +modules=sd-mod,usb-storage,ext4 + +# root +# root device - if not specified, will be guessed using +# blkid -o export /dev/root +root= + +# verbose +# if set to non-zero, update-extlinux will be a lot more verbose. +verbose=0 + +# hidden +# if set to non-zero, the boot menu will be hidden by default. +hidden=1 + +# timeout +# number of seconds to wait before booting default +timeout=3 + +# default +# default kernel to boot +default=lts + +# serial_port +# serial port number - if not specified, serial console will be disabled +serial_port= + +# serial_baud +# the baudrate for the serial port. Will use 115200 if unset +serial_baud=115200 + +# xen_opts +# options to hand to xen hypervisor, useful ones are: +# dom0_mem=384M (give domain-0 environment 384M ram) +xen_opts=dom0_mem=384M + +# if you copy /usr/share/syslinux/reboot.c32 to /boot/, a menu entry +# will be auto-generated for it + +# if you copy hdt.c32, libgpl.c32, and libmenu.c32 from /usr/share/syslinux/ +# to /boot/, a menu entry will be auto-generated for HDT + +# if you download and install /boot/memtest, then if HDT is present it +# will use it, else a separate menu entry will be auto-generated for +# memtest + +# optional password +# you can generate a SHA512 password using: mkpasswd +# +# if you assign a password, you should make this file world-unreadable +# +# if a password is assigned, the menu entries can't be edited at boot +# time, and HDT if present is password-protected +# +# you can also include "MENU PASSWD" in any custom entries you have in +# /etc/update-extlinux.d/ +password='' |