update: shrink down initramfs size (~200MB -> ~60MB)
This commit is contained in:
1 parent
4dff0249bb
commit
562e4a1f6b
2 files changed
+132
-13
No files matched your search
@@ -7,7 +7,6 @@ BUILD_VERSION=${KERNEL_VERSION:=6.19.10}-300.fc${DISTRO_VERSION}.ms-r1
|
||||
HEADERS=/usr/src/kernels/$BUILD_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_PATCHES=$BUILD/linux-sky1
|
||||
@@ -48,9 +47,12 @@ setup() {
|
||||
sed -i "/^title/s/$/ Powersave Mode/" $conf
|
||||
}
|
||||
|
||||
[ -z "$LOCAL" ] || [[ "$(uname -m)" == "aarch64" ]] || die "LOCAL (=$LOCAL) can only be enabled on aarch64 machines"
|
||||
[ -z "$UNINSTALL" ] || { pkexec bash -c "$(sub purge)" && log "done"; exit 0; }
|
||||
[ -z "$CLEAN" ] || rm -rf $KERNEL_TREE $KERNEL_PATCHES $LOGS; mkdir -p "$LOGS"
|
||||
log "building linux kernel ${KERNEL_VERSION} (arm64) for Fedora ${DISTRO_VERSION} with sky1-${TAG:=latest} patches"
|
||||
[ -z "$CLEAN" ] || rm -rf $KERNEL_TREE $KERNEL_PATCHES $LOGS
|
||||
|
||||
mkdir -p "$LOGS"
|
||||
log "building linux kernel ${KERNEL_VERSION} (arm64) with sky1-${TAG:=latest} patches"
|
||||
|
||||
append() {
|
||||
local series=$KERNEL_PATCHES/patches/series
|
||||
@@ -69,6 +71,7 @@ if [ ! -d "$KERNEL_PATCHES" ]; then
|
||||
log "cloning linux-sky1 repository"
|
||||
run git clone --depth=1 https://github.com/Sky1-Linux/linux-sky1.git
|
||||
cd $KERNEL_PATCHES
|
||||
# see <https://github.com/Sky1-Linux/linux-sky1/pulls>
|
||||
git config user.email "build@ms-r1.local"
|
||||
git config user.name "Build"
|
||||
rebase srcshelton main # patches: fix Kconfig deps and module reachability
|
||||
@@ -91,15 +94,18 @@ if [ ! -d "$KERNEL_TREE" ]; then
|
||||
| tar -xf - --xz -C $BUILD
|
||||
fi
|
||||
|
||||
if [ ! -f "$KERNEL_TREE/.config-fedora" ]; then
|
||||
cd $KERNEL_TREE
|
||||
if [ ! -f "$KERNEL_TREE/.config-fedora" ] && [ -z "$LOCAL" ]; 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 -i --quiet --to-stdout "./lib/modules/*/config" \
|
||||
> .config
|
||||
[ -z "$LOCAL" ] || { yes "" | make -C "$KERNEL_TREE" localmodconfig >/dev/null 2>&1; sed -i '/is not set/d' .config; }
|
||||
mv .config .config-fedora
|
||||
> $KERNEL_TREE/.config-fedora
|
||||
fi
|
||||
|
||||
if [ ! -f "$KERNEL_TREE/.config-local" ] && [ -n "$LOCAL" ]; then
|
||||
log "loading local kernel config"
|
||||
yes "" | make -C "$KERNEL_TREE" localmodconfig >/dev/null 2>&1
|
||||
mv $KERNEL_TREE/.config $KERNEL_TREE/.config-local
|
||||
fi
|
||||
|
||||
if [ ! -f "$KERNEL_TREE/.patches-sky1" ]; then
|
||||
@@ -117,9 +123,10 @@ if [ ! -f "$KERNEL_TREE/.config.ms-r1" ] || [ -n "$REBUILD" ]; then
|
||||
cd $KERNEL_TREE
|
||||
make mrproper >/dev/null
|
||||
cp $KERNEL_PATCHES/config/config.sky1-${TAG} ".config-sky1"
|
||||
run ./scripts/kconfig/merge_config.sh -m -O . .config-sky1 .config-fedora
|
||||
run ./scripts/kconfig/merge_config.sh -m -O . .config-sky1 .config-$(if [ -n "$LOCAL" ]; then echo "local"; else echo "fedora"; fi)
|
||||
run ./scripts/kconfig/merge_config.sh -m -O . .config "$BUILD/config/ms-r1.fragment"
|
||||
make olddefconfig >/dev/null 2>&1
|
||||
CROSS=$(if [ -z "$LOCAL" ]; then echo "aarch64-linux-gnu-"; fi)
|
||||
make ARCH=arm64 CROSS_COMPILE=$CROSS olddefconfig >/dev/null 2>&1
|
||||
cp .config .config.ms-r1
|
||||
fi
|
||||
|
||||
|
||||
Reference in new issue
Block a user