2022-04-24 04:59:17 +01:00
|
|
|
# SPDX-FileCopyrightText: 2021-22 fosslinux <fosslinux@aussies.space>
|
2022-04-13 00:08:29 +01:00
|
|
|
# SPDX-FileCopyrightText: 2022 Andrius Štikonas <andrius@stikonas.eu>
|
2021-08-04 03:56:07 +01:00
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
|
|
|
src_unpack() {
|
2022-04-13 00:08:29 +01:00
|
|
|
mkdir "${pkg}"
|
2022-04-24 04:59:17 +01:00
|
|
|
mv "${DISTFILES}/deblob-4.9" "${pkg}/"
|
2022-04-13 00:08:29 +01:00
|
|
|
# Remove all previous source tarballs
|
2022-04-24 04:59:17 +01:00
|
|
|
mv "${DISTFILES}/${pkg}.tar.gz" .
|
2022-05-09 19:55:26 +01:00
|
|
|
rm -r "${DISTFILES:?}/"*
|
2022-04-24 04:59:17 +01:00
|
|
|
mv "${pkg}.tar.gz" "${DISTFILES}"
|
2021-08-04 03:56:07 +01:00
|
|
|
default || true # Predictable link errors - not a problem
|
2022-04-24 04:59:17 +01:00
|
|
|
rm -r "${DISTFILES}" # Clear storage space
|
2021-08-04 03:56:07 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
2021-10-12 00:43:58 +01:00
|
|
|
chmod +x deblob-4.9
|
|
|
|
./deblob-4.9 --force
|
2021-08-04 03:56:07 +01:00
|
|
|
|
|
|
|
# Remove shipped files
|
|
|
|
find . -name "*_shipped*" -delete
|
|
|
|
}
|
|
|
|
|
|
|
|
src_compile() {
|
|
|
|
cp .config include/config/auto.conf
|
|
|
|
rm include/generated/autoconf.h
|
|
|
|
generate_autoconf_h
|
|
|
|
|
2021-10-12 00:43:58 +01:00
|
|
|
# Allow use of patched initramfs_list.sh (which is required anyway)
|
|
|
|
export PATH=$PWD/usr:$PATH
|
2021-08-04 03:56:07 +01:00
|
|
|
make ARCH=i386 prepare
|
|
|
|
make ARCH=i386
|
|
|
|
}
|
|
|
|
|
|
|
|
src_install() {
|
2021-10-10 21:54:23 +01:00
|
|
|
mkdir -p "${PREFIX}/boot"
|
2021-08-04 03:56:07 +01:00
|
|
|
cp arch/i386/boot/bzImage "${PREFIX}/boot/linux-4.9.10"
|
2021-10-10 21:54:23 +01:00
|
|
|
cp usr/gen_init_cpio "${PREFIX}/bin"
|
|
|
|
cp scripts/gen_initramfs_list.sh "${PREFIX}/bin"
|
2021-08-04 03:56:07 +01:00
|
|
|
}
|