mirror of
https://github.com/void-linux/void-packages.git
synced 2025-08-04 03:42:56 +02:00
rpi-kernel: cleanup template
* define kernel arch + cross globally * fix typo ($arch -> $_arch) * simplify "Remove unneeded architectures"
This commit is contained in:
parent
6dc2654685
commit
91dd3a62c6
1 changed files with 48 additions and 59 deletions
|
@ -41,76 +41,67 @@ mutable_files="
|
||||||
/usr/lib/modules/${_kernver}/modules.alias.bin
|
/usr/lib/modules/${_kernver}/modules.alias.bin
|
||||||
/usr/lib/modules/${_kernver}/modules.devname"
|
/usr/lib/modules/${_kernver}/modules.devname"
|
||||||
|
|
||||||
|
_arch=
|
||||||
|
case "$XBPS_TARGET_MACHINE" in
|
||||||
|
arm*) _arch=arm ;;
|
||||||
|
aarch64*) _arch=arm64 ;;
|
||||||
|
esac
|
||||||
|
_cross=
|
||||||
|
if [ "$CROSS_BUILD" ]; then
|
||||||
|
_cross="CROSS_COMPILE=${XBPS_CROSS_TRIPLET}-"
|
||||||
|
fi
|
||||||
|
|
||||||
pre_configure() {
|
pre_configure() {
|
||||||
# Remove .git directory, otherwise scripts/setkernelversion.sh
|
# Remove .git directory, otherwise scripts/setkernelversion.sh
|
||||||
# modifies KERNELRELEASE and appends + to it.
|
# modifies KERNELRELEASE and appends + to it.
|
||||||
rm -rf .git
|
rm -rf .git
|
||||||
}
|
}
|
||||||
do_configure() {
|
do_configure() {
|
||||||
if [ "$CROSS_BUILD" ]; then
|
local target defconfig
|
||||||
_args="CROSS_COMPILE=${XBPS_CROSS_TRIPLET}-"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Use upstream default configuration, no need to maintain ours.
|
# Use upstream's default configuration, no need to maintain ours.
|
||||||
case "$XBPS_TARGET_MACHINE" in
|
case "$XBPS_TARGET_MACHINE" in
|
||||||
|
# RPi3
|
||||||
aarch64*)
|
aarch64*)
|
||||||
echo "CONFIG_CONNECTOR=y" >> arch/arm64/configs/bcmrpi3_defconfig
|
target=bcmrpi3_defconfig
|
||||||
echo "CONFIG_PROC_EVENTS=y" >> arch/arm64/configs/bcmrpi3_defconfig
|
|
||||||
echo "CONFIG_F2FS_FS_SECURITY=y" >> arch/arm64/configs/bcmrpi3_defconfig
|
|
||||||
echo "CONFIG_CGROUP_PIDS=y" >> arch/arm64/configs/bcmrpi3_defconfig
|
|
||||||
make ${makejobs} ${_args} ARCH=arm64 bcmrpi3_defconfig
|
|
||||||
;;
|
;;
|
||||||
|
# RPi2 / RPi3
|
||||||
armv7l*)
|
armv7l*)
|
||||||
echo "CONFIG_USER_NS=y" >> arch/arm/configs/bcm2709_defconfig
|
target=bcm2709_defconfig
|
||||||
echo "CONFIG_CONNECTOR=y" >> arch/arm/configs/bcm2709_defconfig
|
|
||||||
echo "CONFIG_PROC_EVENTS=y" >> arch/arm/configs/bcm2709_defconfig
|
|
||||||
echo "CONFIG_F2FS_FS_SECURITY=y" >> arch/arm/configs/bcm2709_defconfig
|
|
||||||
echo "CONFIG_CGROUP_PIDS=y" >> arch/arm/configs/bcm2709_defconfig
|
|
||||||
make ${makejobs} ${_args} ARCH=arm bcm2709_defconfig
|
|
||||||
;;
|
;;
|
||||||
|
# RPi1
|
||||||
armv6l*)
|
armv6l*)
|
||||||
echo "CONFIG_USER_NS=y" >> arch/arm/configs/bcmrpi_defconfig
|
target=bcmrpi_defconfig
|
||||||
echo "CONFIG_CONNECTOR=y" >> arch/arm/configs/bcmrpi_defconfig
|
|
||||||
echo "CONFIG_PROC_EVENTS=y" >> arch/arm/configs/bcmrpi_defconfig
|
|
||||||
echo "CONFIG_F2FS_FS_SECURITY=y" >> arch/arm/configs/bcmrpi_defconfig
|
|
||||||
echo "CONFIG_CGROUP_PIDS=y" >> arch/arm/configs/bcmrpi_defconfig
|
|
||||||
make ${makejobs} ${_args} ARCH=arm bcmrpi_defconfig
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
defconfig="arch/${_arch}/configs/${target}"
|
||||||
|
echo "CONFIG_CONNECTOR=y" >> "$defconfig"
|
||||||
|
echo "CONFIG_PROC_EVENTS=y" >> "$defconfig"
|
||||||
|
echo "CONFIG_F2FS_FS_SECURITY=y" >> "$defconfig"
|
||||||
|
echo "CONFIG_CGROUP_PIDS=y" >> "$defconfig"
|
||||||
|
|
||||||
|
make ${makejobs} ${_cross} ARCH=${_arch} ${target}
|
||||||
|
|
||||||
# Always use our revision to CONFIG_LOCALVERSION to match our pkg version.
|
# Always use our revision to CONFIG_LOCALVERSION to match our pkg version.
|
||||||
sed -i -e "s|^\(CONFIG_LOCALVERSION=\).*|\1\"_${revision}\"|" .config
|
vsed -i -e "s|^\(CONFIG_LOCALVERSION=\).*|\1\"_${revision}\"|" .config
|
||||||
}
|
}
|
||||||
do_build() {
|
do_build() {
|
||||||
if [ "$CROSS_BUILD" ]; then
|
local target
|
||||||
_args="CROSS_COMPILE=${XBPS_CROSS_TRIPLET}-"
|
|
||||||
fi
|
|
||||||
|
|
||||||
case "$XBPS_TARGET_MACHINE" in
|
case "$XBPS_TARGET_MACHINE" in
|
||||||
arm*)
|
arm*)
|
||||||
_arch=arm
|
target="zImage modules dtbs"
|
||||||
_targets="zImage modules dtbs"
|
|
||||||
;;
|
;;
|
||||||
aarch64*)
|
aarch64*)
|
||||||
unset LDFLAGS
|
target="Image modules dtbs"
|
||||||
_arch=arm64
|
|
||||||
_targets="Image modules dtbs"
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
make ${makejobs} ${_args} ARCH=${_arch} prepare
|
make ${makejobs} ${_cross} ARCH=${_arch} prepare
|
||||||
make ${makejobs} ${_args} ARCH=${_arch} ${_targets}
|
make ${makejobs} ${_cross} ARCH=${_arch} ${target}
|
||||||
}
|
}
|
||||||
do_install() {
|
do_install() {
|
||||||
case "$XBPS_TARGET_MACHINE" in
|
|
||||||
arm*)
|
|
||||||
_arch="arm"
|
|
||||||
;;
|
|
||||||
aarch64*)
|
|
||||||
_arch="arm64"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
local hdrdest
|
local hdrdest
|
||||||
|
|
||||||
# Run depmod after compressing modules.
|
# Run depmod after compressing modules.
|
||||||
|
@ -173,14 +164,11 @@ do_install() {
|
||||||
cp Module.symvers ${hdrdest}
|
cp Module.symvers ${hdrdest}
|
||||||
cp -a scripts ${hdrdest}
|
cp -a scripts ${hdrdest}
|
||||||
|
|
||||||
# fix permissions on scripts dir
|
|
||||||
chmod og-w -R ${hdrdest}/scripts
|
|
||||||
|
|
||||||
# copy arch includes for external modules
|
# copy arch includes for external modules
|
||||||
mkdir -p ${hdrdest}/arch/${_arch}
|
mkdir -p ${hdrdest}/arch/${_arch}
|
||||||
cp -a arch/${_arch}/include ${hdrdest}/arch/${_arch}
|
cp -a arch/${_arch}/include ${hdrdest}/arch/${_arch}
|
||||||
|
|
||||||
mkdir -p ${hdrdest}/arch/${arch}/kernel
|
mkdir -p ${hdrdest}/arch/${_arch}/kernel
|
||||||
cp arch/${_arch}/Makefile ${hdrdest}/arch/${_arch}
|
cp arch/${_arch}/Makefile ${hdrdest}/arch/${_arch}
|
||||||
cp arch/${_arch}/kernel/asm-offsets.s ${hdrdest}/arch/${_arch}/kernel
|
cp arch/${_arch}/kernel/asm-offsets.s ${hdrdest}/arch/${_arch}/kernel
|
||||||
|
|
||||||
|
@ -207,10 +195,11 @@ do_install() {
|
||||||
done
|
done
|
||||||
|
|
||||||
# Remove unneeded architectures
|
# Remove unneeded architectures
|
||||||
for arch in alpha arc avr32 blackfin c6x cris frv h8300 \
|
# (save the correct one + Kconfig and delete all others)
|
||||||
hexagon ia64 m* n* p* s* um v850 x86 xtensa; do
|
mkdir -p arch-backup
|
||||||
rm -rf ${hdrdest}/arch/${arch}
|
cp ${hdrdest}/arch/${_arch} ${hdrdest}/arch/Kconfig arch-backup/
|
||||||
done
|
rm -rf ${hdrdest}/arch
|
||||||
|
mv arch-backup ${hdrdest}/arch
|
||||||
|
|
||||||
# Compress all modules with xz to save a few MBs.
|
# Compress all modules with xz to save a few MBs.
|
||||||
msg_normal "$pkgver: compressing kernel modules with gzip, please wait...\n"
|
msg_normal "$pkgver: compressing kernel modules with gzip, please wait...\n"
|
||||||
|
|
Loading…
Add table
Reference in a new issue