update: config merging
This commit is contained in:
1 parent
1806998f1b
commit
e7d330a56f
2 files changed
+60
-67
No files matched your search
@@ -4,45 +4,52 @@
|
||||
|
||||
DISTRO_VERSION="44"
|
||||
LOCAL_VERSION=${KERNEL_VERSION:=6.19.10}-300.fc${DISTRO_VERSION}.ms-r1
|
||||
HEADERS=/usr/src/kernels/$LOCAL_VERSION
|
||||
JOBS=$(nproc)
|
||||
BUILD=$(pwd)
|
||||
CROSS="aarch64-linux-gnu-"
|
||||
CMDLINE="console=tty0 console=ttyAMA0,115200n8 pcie_aspm=off cma=512M clk_ignore_unused=1 cpufreq.default_governor=schedutil"
|
||||
KERNEL_TREE=$BUILD/linux-${KERNEL_VERSION}
|
||||
KERNEL_CORE=$BUILD/core-${KERNEL_VERSION}
|
||||
KERNEL_PATCHES=$BUILD/linux-sky1
|
||||
LOGS=$BUILD/logs
|
||||
|
||||
CMDLINE_COMMON="console=tty0 console=ttyAMA0,115200n8 cma=512M clk_ignore_unused=1 cpufreq.default_governor=schedutil"
|
||||
CMDLINE_LOWPOWER="pcie_aspm=powersave pcie_aspm_policy=default $CMDLINE_COMMON"
|
||||
CMDLINE="pcie_aspm=off $CMDLINE_COMMON"
|
||||
|
||||
log() { printf '[%s] %s\n' "$(date '+%H:%M:%S')" "$*"; }
|
||||
die() { printf '[%s] ERROR: %s\n' "$(date '+%H:%M:%S')" "$*"; exit 1; }
|
||||
run() { "$@" 2>&1 > "/tmp/$1.error.log" || die "failed: $(echo /tmp/$1.error.log | tail -n 1)"; }
|
||||
get() { [ -f "/tmp/$1" ] || { run wget -q -O "/tmp/$1" "$2/$1"; cat "/tmp/$1"; return; }; log "using cached file /tmp/$1" >&2; cat "/tmp/$1"; }
|
||||
|
||||
uninstall() {
|
||||
log "removing modules"
|
||||
pkexec rm -rf /lib/modules/$LOCAL_VERSION* || die "failed"
|
||||
pkexec rm -rf "/lib/modules/$LOCAL_VERSION" "$HEADERS" || die "failed"
|
||||
log "removing boot images and configs"
|
||||
pkexec find /boot -name "*-$LOCAL_VERSION*" -delete || die "failed"
|
||||
log "done"
|
||||
}
|
||||
|
||||
[ -z "$UNINSTALL" ] || { uninstall; exit 0; }
|
||||
[ -z "$CLEAN" ] || rm -rf $KERNEL_TREE $KERNEL_CORE $KERNEL_PATCHES $LOGS; mkdir -p "$LOGS"
|
||||
[ -z "$CLEAN" ] || rm -rf $KERNEL_TREE $KERNEL_PATCHES $LOGS; mkdir -p "$LOGS"
|
||||
log "building linux kernel ${KERNEL_VERSION} for Fedora ${DISTRO_VERSION} with sky1-${TAG:=latest} patches"
|
||||
|
||||
append() {
|
||||
local series=$KERNEL_PATCHES/patches/series
|
||||
echo "$(grep -v -e'^<<<<<<<' -e '^>>>>>>>' -e'=======' $series)" > $series
|
||||
git add $series > /dev/null 2>&1
|
||||
GIT_EDITOR=true git rebase --continue > /dev/null 2>&1
|
||||
echo "$(grep -v -e'^<<<<<<<' -e '^>>>>>>>' -e'=======' $series)" >$series
|
||||
git add $series >/dev/null 2>&1
|
||||
GIT_EDITOR=true git rebase --continue >/dev/null 2>&1
|
||||
}
|
||||
|
||||
rebase() {
|
||||
git remote add $1 https://github.com/$1/linux-sky1.git > /dev/null 2>&1
|
||||
git fetch $1 > /dev/null 2>&1
|
||||
git rebase $1/$2 > /dev/null 2>&1 || append || die "could not rebase branch $1:$2"
|
||||
git remote add $1 https://github.com/$1/linux-sky1.git >/dev/null 2>&1
|
||||
git fetch $1 >/dev/null 2>&1
|
||||
git rebase $1/$2 >/dev/null 2>&1 || append || die "could not rebase branch $1:$2"
|
||||
}
|
||||
|
||||
if [ ! -d "$KERNEL_PATCHES" ]; then
|
||||
log "cloning linux-sky1 repository"
|
||||
git clone --depth=1 https://github.com/Sky1-Linux/linux-sky1.git > /dev/null 2>&1 || die "failed"
|
||||
run git clone --depth=1 https://github.com/Sky1-Linux/linux-sky1.git
|
||||
cd $KERNEL_PATCHES
|
||||
rebase srcshelton main # patches: fix Kconfig deps and module reachability
|
||||
rebase peppergrayxyz v6.19.10 # Update patch for 6.19.10
|
||||
@@ -58,43 +65,41 @@ if [ ! -d "$KERNEL_PATCHES" ]; then
|
||||
rebase lpennisi73-tech amvx-mmu-flexible-array-vb2-lock # patches: add amvx MMU flexible-array and vb2 queue lock fixes (6.18)
|
||||
fi
|
||||
|
||||
get() {
|
||||
if [ -f "/tmp/$1" ]; then log "using cached file /tmp/$1" >&2; cat "/tmp/$1"
|
||||
else wget -q -O "/tmp/$1" "$2/$1" || die "failed" >&2; cat "/tmp/$1"; fi
|
||||
}
|
||||
|
||||
if [ ! -d "$KERNEL_TREE" ]; then
|
||||
log "downloading linux kernel source tree"
|
||||
get "linux-${KERNEL_VERSION}.tar.xz" "https://www.kernel.org/pub/linux/kernel/v${KERNEL_VERSION:0:1}.x/" | tar -xf - -C $BUILD --xz
|
||||
log "applying patches"
|
||||
output="$LOGS/patches.log"; echo "" > $output
|
||||
output="$LOGS/patches.log"; echo "" >$output
|
||||
for p in "$KERNEL_PATCHES/patches-${TAG}"/*.patch; do
|
||||
patch -d "$KERNEL_TREE" -p1 --forward --batch -s <"$p" >> $output || die "could not apply patch: $p (see logs/patches.log)"
|
||||
patch -d "$KERNEL_TREE" -p1 --forward --batch -s <"$p" >>$output || die "could not apply patch: $p (see logs/patches.log)"
|
||||
done
|
||||
find "$KERNEL_TREE" \( -name '*.orig' -o -name '*.rej' \) -delete
|
||||
fi
|
||||
|
||||
if [ ! -d "$KERNEL_CORE" ]; then
|
||||
if [ ! -f "$KERNEL_TREE/.config-fedora" ]; then
|
||||
log "downloading fedora kernel core"
|
||||
get "kernel-core-${KERNEL_VERSION}-300.fc${DISTRO_VERSION}.aarch64.rpm" "https://download.fedoraproject.org/pub/fedora/linux/releases/${DISTRO_VERSION}/Everything/aarch64/os/Packages/k/" | rpm2cpio - | cpio -D $KERNEL_CORE -idm --quiet "./lib/modules/*"
|
||||
get "kernel-core-${KERNEL_VERSION}-300.fc${DISTRO_VERSION}.aarch64.rpm" "https://download.fedoraproject.org/pub/fedora/linux/releases/${DISTRO_VERSION}/Everything/aarch64/os/Packages/k/" \
|
||||
| rpm2cpio - \
|
||||
| cpio -i --quiet --to-stdout "./lib/modules/*/config" \
|
||||
> $KERNEL_TREE/.config-fedora
|
||||
fi
|
||||
|
||||
if [ ! -f "$KERNEL_TREE/.config.ms-r1" ] || [ -n "$REBUILD" ]; then
|
||||
if [ ! -f "$KERNEL_TREE/.config.ms-r1" ] || [ -n "$RECONFIGURE" ]; then
|
||||
log "configuring kernel"
|
||||
cd $KERNEL_TREE
|
||||
make mrproper > /dev/null 2>&1
|
||||
cp "$KERNEL_CORE/lib/modules/${KERNEL_VERSION}-300.fc44.aarch64/config" .config-fedora
|
||||
cp "$KERNEL_PATCHES/config/config.sky1-${TAG}" .config-sky1
|
||||
./scripts/kconfig/merge_config.sh -m -O . .config-fedora .config-sky1 > /dev/null
|
||||
./scripts/kconfig/merge_config.sh -m -O . .config "$BUILD/config/ms-r1.fragment" > /dev/null
|
||||
cp $KERNEL_PATCHES/config/config.sky1-${TAG} .config-sky1
|
||||
./scripts/kconfig/merge_config.sh -m -O . .config-sky1 .config-fedora >/dev/null
|
||||
./scripts/kconfig/merge_config.sh -m -O . .config "$BUILD/config/ms-r1.fragment" >/dev/null
|
||||
make ARCH=arm64 CROSS_COMPILE=$CROSS olddefconfig >/dev/null
|
||||
cp .config .config.ms-r1
|
||||
make ARCH=arm64 CROSS_COMPILE=$CROSS olddefconfig > /dev/null 2>&1
|
||||
fi
|
||||
|
||||
log "compiling kernel"; make -C "$KERNEL_TREE" ARCH=arm64 CROSS_COMPILE=$CROSS -j"$JOBS" Image modules > "$LOGS/build.log" 2>&1 || die "failed (see logs/build.log)"
|
||||
log "compiling kernel"; make -C "$KERNEL_TREE" ARCH=arm64 CROSS_COMPILE=$CROSS -j"$JOBS" </dev/null >"$LOGS/build.log" 2>&1 || die "failed (see logs/build.log)"
|
||||
log "done"
|
||||
[ -n "$INSTALL" ] || { log "note: run this script with INSTALL=1 to trigger kernel install (requires root privileges)"; exit 0; }
|
||||
[ -z "$(find /boot -maxdepth 1 -name "*-${LOCAL_VERSION}*" 2> /dev/null)" ] || { log "removing previously built kernel ${LOCAL_VERSION}"; uninstall; }
|
||||
[ -z "$(find /boot -maxdepth 1 -name "*-${LOCAL_VERSION}*" 2>/dev/null)" ] || { log "uninstalling legacy kernel ${LOCAL_VERSION} from previous build(s)"; uninstall; }
|
||||
|
||||
log "installing kernel"; pkexec make -C "$KERNEL_TREE" ARCH=arm64 modules_install install > "$LOGS/install.log" 2>&1 || die "failed (see logs/install.log)"
|
||||
log "copying header files"; pkexec cp -r "$KERNEL_TREE" "$HEADERS" || die "failed"
|
||||
log "installing kernel"; pkexec make -C "$DEVEL" ARCH=arm64 modules_install install clean </dev/null >"$LOGS/install.log" 2>&1 || die "failed (see logs/install.log)"
|
||||
log "updating grub2 arguments"; run pkexec grubby --update-kernel=/boot/vmlinuz-$LOCAL_VERSION --args="$(if [ -n "$LOWPOWER" ]; then echo $CMDLINE_LOWPOWER; else echo $CMDLINE; fi)"
|
||||
log "done"
|
||||
Reference in new issue
Block a user