Skip to content
Commits on Source (169)
......@@ -2,26 +2,31 @@
makepkg:
stage: build
rules:
- if: '$CI_COMMIT_TAG'
when: always
when: manual
script:
- seblu-build
- seblu-x86_64-build
artifacts:
name: $CI_PROJECT_NAME-$CI_COMMIT_REF_NAME
expire_in: 1 week
name: $CI_PROJECT_NAME-$CI_COMMIT_REF_NAME-$CI_COMMIT_SHA
expire_in: 3 month
paths:
- config.x86_64
- "*.pkg.tar.xz"
only:
refs:
- tags
- web
- "*.pkg.tar.*"
commitpkg:
stage: deploy
rules:
- if: '$CI_COMMIT_TAG'
when: always
when: manual
script:
- eval $(ssh-agent -s)
# - trap "kill $SSH_AGENT_PID" 0
# trap is broken in gitlab runner, see:
# https://gitlab.com/gitlab-org/gitlab-runner/issues/3009
# use a workaournd with sleep and kill:
- sleep 300 && kill "$SSH_AGENT_PID" & disown
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
- seblu-push
only:
refs:
- tags
- web
......@@ -2,38 +2,41 @@
# Customized version of linux for seblu computers
pkgname=linux-seblu
pkgver=4.20.2
pkgver=6.12.0_rc5
pkgrel=1
pkgdesc='The Linux Kernel cooked by Seblu'
arch=('x86_64')
license=('GPL2')
url='http://www.kernel.org'
options=('!strip' '!buildflags')
makedepends=('glibc' 'libelf' 'kmod' 'git' 'make' 'gcc' 'bc' 'sed')
depends=('linux-firmware' 'kernel-install-hook')
makedepends=('llvm' 'clang' 'lld' 'libelf' 'kmod' 'git' 'make' 'bc' 'sed' 'cpio'
'python' 'zstd')
optdepends=(
'linux-firmware: linux firmwares'
'kernel-install-hook: systemd installation helpers'
)
install=linux-seblu.install
#_repourl='git+https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git'
_repourl='git+https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git'
source=("$_repourl#tag=v${pkgver/_/-}"
_main=https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
_stable=https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
_next=https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
source=("git+$_main#tag=v6.12-rc5"
"config.$CARCH")
md5sums=('SKIP'
'6b4f2c5b079fffc801d4f0f14a966a65')
sha256sums=('c7b693570f0c9f445ca246eb397557405149aa45a5fb5ee29a7c426d6dbc0dee'
'e0f905f47cee645b0831181d44b30ce634aca0313f3240d1150762cca94c2d5a')
prepare() {
# fake linux directory if necessary
if [[ ${_repourl##*/} != 'linux.git' ]]; then
local _reponame="${_repourl##*/}"
ln -sfT "${_reponame%.git}" linux
fi
[[ ! -d linux && -d linux-stable ]] && ln -snf linux-stable linux
[[ ! -d linux && -d linux-next ]] && ln -snf linux-next linux
cd linux
# apply patches
for _f in "${source[@]}"; do
if [[ "$_f" =~ \.patch$ ]]; then
msg2 "Patching $_f"
patch -p1 < "$srcdir/$_f"
fi
# apply patch from the source array (should be a pacman feature)
local src
for src in "${source[@]}"; do
src="${src%%::*}"
src="${src##*/}"
[[ $src = *.patch ]] || continue
msg2 "Applying patch $src..."
patch -Np1 < "../$src"
done
# loading default config
......@@ -49,24 +52,26 @@ prepare() {
msg2 'Setting kernel build version'
echo "$(($pkgrel - 1 ))" > .version
# no scm version
# this prevent an issue with “make kernelrelease” which add -dirty to version
# because ownership of git files has fakely been changed by fakeroot when
# called from makepkg
echo '' > .scmversion
}
# prevent addition of -dirty to version
msg2 'Patch setlocalversion'
sed -i 's|no_dirty=false|no_dirty=true|' scripts/setlocalversion
build() {
cd linux
msg2 'Force use of LLVM in makefile'
# early makefile patching achieve 2 goals. Firstly, avoid adding variables to
# each make call. Secondly, it is later used by tools (e.g dkms) to build
# out-of-tree modules.
echo -e "\nLLVM = 1\nLLVM_IAS = 1\nexport LLVM LLVM_IAS" >> scripts/Kbuild.include
msg2 'Make prepare'
make prepare
}
msg2 'Make bzImage'
make bzImage
pkgver() {
make -C linux -s kernelversion|tr '-' '_'
}
msg2 'Make modules'
make modules
build() {
make -C linux all
}
package() {
......@@ -74,152 +79,115 @@ package() {
# get real compiled kernel version
kernrel=$(make kernelrelease)
pkgdesc+=", version $kernrel"
pkgdesc+=", release $kernrel"
pkgname="linux-$kernrel"
pkgver=$(make kernelversion|tr '-' '_')
provides=("linux=$pkgver" "linux-headers=$pkgver")
provides=("linux=$pkgver" "linux-headers=$pkgver" "linux=${pkgver%.*}" VIRTUALBOX-GUEST-MODULES WIREGUARD-MODULE KSMBD-MODULE)
msg2 "Kernel release: $kernrel"
msg2 "Package kernel version: $pkgver"
msg2 'Install vmlinuz'
install -D -m644 arch/x86/boot/bzImage "$pkgdir/usr/lib/kernel/vmlinuz-$kernrel"
msg2 'Installing vmlinuz'
install -D -m644 "$(make -s image_name)" "$pkgdir/usr/lib/kernel/vmlinuz-$kernrel"
msg2 'Install modules'
msg2 'Installing modules'
# disable DEPMOD because it fail due to poor hack in scripts/depmod.sh
# INSTALL_MOD_STRIP will cause modules to be fully stripped
make -s INSTALL_MOD_PATH="$pkgdir/usr" INSTALL_MOD_STRIP=1 DEPMOD=/bin/true modules_install
msg2 'Install sources'
install_sources
msg2 'Remove firmwares'
rm -rf "$pkgdir/usr/lib/firmware"
msg2 'Generate modules.dep and map files'
msg2 'Generating modules.dep and map files'
# run depmod to keep track of these files and remove them with the package
depmod -b "$pkgdir/usr" -F System.map "$kernrel"
msg2 'Symlink kernel into modules subdirectory'
# kernel-all expect kernel image in the modules directory
ln -s "../../kernel/vmlinuz-$kernrel" "$pkgdir/usr/lib/modules/$kernrel/vmlinuz"
msg2 'Add mkinitcpio pkgbase file'
# used by mkinitcpio to name the kernel
install -Dm644 <(echo "$pkgname") "$pkgdir/usr/lib/modules/$kernrel/pkgbase"
install_sources
msg2 'Removing firmwares'
rm -rvf "$pkgdir/usr/lib/firmware"
}
install_sources() {
local kernsrc="$pkgdir/usr/src/$pkgname"
local i
cd "$srcdir/linux"
# create $kernsrc directory
msg2 'Installing sources'
install -d -m 755 "$kernsrc"
msg2 'Installing symlinks in modules/'
# remove previous build and source links
rm -f "$pkgdir/usr/lib/modules/$kernrel"/{source,build}
ln -rs "$kernsrc" "$pkgdir/usr/lib/modules/$kernrel"/source
ln -rs "$kernsrc" "$pkgdir/usr/lib/modules/$kernrel"/build
# Copy kernel config files
cd "$srcdir/linux"
install -D -m644 Makefile "$kernsrc/Makefile"
install -D -m644 kernel/Makefile "$kernsrc/kernel/Makefile"
install -D -m644 .config "$kernsrc/.config"
for i in localversion*; do
msg2 'Installing build files'
install -Dt "$kernsrc" -m644 .config Makefile Module.symvers System.map
install -Dt "$kernsrc/kernel" -m644 kernel/Makefile
install -Dt "$kernsrc/arch/x86" -m644 arch/x86/Makefile
for i in version localversion*; do
[[ -e "$i" ]] && install -m644 "$i" "$kernsrc/$i"
done
# create include directory
install -d "$kernsrc/include"
for i in acpi asm-generic config crypto drm generated linux math-emu \
media net pcmcia scsi sound trace uapi video xen; do
cp -a include/$i "$kernsrc/include/"
done
# copy arch includes for external modules
install -d "$kernsrc/arch/x86"
cp -a arch/x86/include "$kernsrc/arch/x86/"
# copy files necessary for later builds, like nvidia and vmware
cp Module.symvers "$kernsrc"
cp -a scripts "$kernsrc"
# remove broken symlinks of unneeded architectures in scripts
rm -r "$kernsrc/scripts/dtc/include-prefixes"
# fix permissions on scripts dir
chmod og-w -R "$kernsrc/scripts"
# add x86 makefile
install -d "$kernsrc/.tmp_versions"
install -d "$kernsrc/arch/x86/kernel"
cp arch/x86/Makefile "$kernsrc/arch/x86/"
cp arch/x86/kernel/asm-offsets.s "$kernsrc/arch/x86/kernel/"
# add dm headers
install -d "$kernsrc/drivers/md"
cp drivers/md/*.h "$kernsrc/drivers/md"
# add inotify.h
install -d "$kernsrc/include/linux"
cp include/linux/inotify.h "$kernsrc/include/linux/"
# add wireless headers
install -d "$kernsrc/net/mac80211/"
cp net/mac80211/*.h "$kernsrc/net/mac80211/"
# add dvb headers for external modules
# in reference to:
# http://bugs.archlinux.org/task/11194
install -d "$kernsrc/include/config/dvb/"
cp include/config/dvb/*.h "$kernsrc/include/config/dvb/"
# add dvb headers for http://mcentral.de/hg/~mrec/em28xx-new
# in reference to:
# http://bugs.archlinux.org/task/13146
install -Dm644 drivers/media/dvb-frontends/lgdt330x.h \
"$kernsrc/drivers/media/dvb-frontends/dvb-frontends/lgdt330x.h"
install -Dm644 drivers/media/i2c/msp3400-driver.h \
"$kernsrc/drivers/media/i2c/msp3400-driver.h"
# add dvb headers
# in reference to:
# http://bugs.archlinux.org/task/20402
install -d "$kernsrc/drivers/media/usb/dvb-usb"
cp drivers/media/usb/dvb-usb/*.h "$kernsrc/drivers/media/usb/dvb-usb/"
install -d "$kernsrc/drivers/media/dvb-frontends"
cp drivers/media/dvb-frontends/*.h "$kernsrc/drivers/media/dvb-frontends/"
install -d "$kernsrc/drivers/media/tuners"
cp drivers/media/tuners/*.h "$kernsrc/drivers/media/tuners/"
# copy in Kconfig files
for i in $(find . -name "Kconfig*"); do
install -d "$kernsrc"/$(echo $i | sed 's|/Kconfig.*||')
cp "$i" "$kernsrc/$i"
done
msg2 'Installing scripts'
cp -t "$kernsrc" -a scripts
# remove unneeded architectures added by copying Kconfig
# add objtool for external module building when enabled VALIDATION_STACK option
# this is adding dependencty to glibc and libelf to the kernel package
msg2 'Installing objtool'
install -Dt "$kernsrc/tools/objtool" tools/objtool/objtool
msg2 'Installing headers'
cp -t "$kernsrc" -a include
# arch includes for external modules
cp -t "$kernsrc/arch/x86" -a arch/x86/include
install -Dt "$kernsrc/arch/x86/kernel" -m644 arch/x86/kernel/asm-offsets.s
# dm headers
install -Dt "$kernsrc/drivers/md" -m644 drivers/md/*.h
# wireless headers
install -Dt "$kernsrc/net/mac80211" -m644 net/mac80211/*.h
# dvb headers, http://bugs.archlinux.org/task/13146
install -Dt "$kernsrc/drivers/media/i2c" -m644 drivers/media/i2c/msp3400-driver.h
# dvb headers, http://bugs.archlinux.org/task/20402
install -Dt "$kernsrc/drivers/media/usb/dvb-usb" -m644 drivers/media/usb/dvb-usb/*.h
install -Dt "$kernsrc/drivers/media/dvb-frontends" -m644 drivers/media/dvb-frontends/*.h
install -Dt "$kernsrc/drivers/media/tuners" -m644 drivers/media/tuners/*.h
msg2 'Installing Kconfig files'
find . -name 'Kconfig*' -exec install -Dm644 {} "$kernsrc/{}" \;
msg2 'Removing unneeded architectures'
for i in "$kernsrc"/arch/*; do
[[ "${i##*/}" != x86 ]] && rm -rf "$i"
done
# add objtool for external module building when enabled VALIDATION_STACK option
# this is adding dependencty to glibc and libelf to the kernel package
install -d "$kernsrc/tools/objtool"
cp tools/objtool/objtool "$kernsrc/tools/objtool"
# fix permissions
chown -R root:root "$kernsrc"
find "$kernsrc" -type d -exec chmod 755 {} \;
# strip scripts directory
find "$kernsrc/scripts" -type f -perm -u+w 2>/dev/null | while read binary ; do
case "$(file -bi "$binary")" in
*application/x-sharedlib*) # Libraries (.so)
strip $STRIP_SHARED "$binary";;
*application/x-archive*) # Libraries (.a)
strip $STRIP_STATIC "$binary";;
*application/x-executable*) # Binaries
strip $STRIP_BINARIES "$binary";;
msg2 'Removing documentation'
rm -r "$kernsrc/Documentation"
msg2 'Stripping exectuables'
while read -rd '' i; do
case "$(file -Sbi "$i")" in
application/x-sharedlib\;*) # Libraries (.so)
strip -v $STRIP_SHARED "$i" ;;
application/x-archive\;*) # Libraries (.a)
strip -v $STRIP_STATIC "$i" ;;
application/x-executable\;*) # Binaries
strip -v $STRIP_BINARIES "$i" ;;
application/x-pie-executable\;*) # Relocatable binaries
strip -v $STRIP_SHARED "$i" ;;
esac
done
done < <(find "$kernsrc" -type f -perm -u+x -print0)
msg2 'Removing sources broken symlinks'
find -L "$kernsrc" -type l -printf 'Removing %P\n' -delete
# check rights
chown -R root.root "$kernsrc"
chmod -R u=rwX,go=rX "$kernsrc"
msg2 'Removing sources lost objects'
find "$kernsrc" -type f -name '*.o' -printf 'Removing %P\n' -delete
}
# vim:set ts=2 sw=2 ft=sh et:
#!/bin/bash -e
CONFIG_LOCAL=config.x86_64
CONFIG_REMOTE=https://gitlab.archlinux.org/archlinux/packaging/packages/linux/-/raw/main/config
vimdiff "$CONFIG_LOCAL" <(curl "$CONFIG_REMOTE")
source diff could not be displayed: it is too large. Options to address this: view the blob.
#!/bin/bash
if [[ -t 2 ]]; then
bld=$'\e[1;33m';
rst=$'\e[m';
else
bld=''
rst=''
fi
if (( $# == 0 )); then
mapfile SRCINFO < <(makepkg --printsrcinfo)
tag="v$(echo "${SRCINFO[*]}"|awk '/pkgver/ {print $3}')-$(echo "${SRCINFO[*]}"|awk '/pkgrel/ {print $3}')"
read -r -p "Push $bld$tag$rst? (y/N): " VALIDATE
[[ $VALIDATE == "y" ]] || exit 1
else
tag="$1"
fi
set -e
git tag "$tag"
git push origin "$tag"
......@@ -9,11 +9,11 @@ config_equal()
}
if config_equal; then
(cd "$SRC" && make menuconfig)
(cd "$SRC" && make ${1:-menuconfig})
else
[[ -e "$SRC" ]] && rm -rf "$SRC"
makepkg --nobuild --force
(cd "$SRC" && make oldconfig)
(cd "$SRC" && make ${1:-oldconfig})
fi
if ! config_equal; then
......