mirror of
https://github.com/pygos/build.git
synced 2024-11-25 20:30:43 +01:00
David Oberhollenzer
882ce4a8f4
- All linux packages generate "linux" and "linux-modules" - Preference mechanism is used to select the right source package - Rootfs depends on "linux-modules" to install the selected kernels modules into the squashfs image - The release pacakge depends on "linux" to install the appropriate kernel to the boot partition Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
90 lines
2.5 KiB
Text
Executable file
90 lines
2.5 KiB
Text
Executable file
MAJOR="4"
|
|
MINOR="19"
|
|
RELEASE="32"
|
|
|
|
VERSION="$MAJOR.$MINOR.$RELEASE"
|
|
SRCDIR="linux-$VERSION"
|
|
TARBALL="linux-$VERSION.tar.xz"
|
|
URL="https://www.kernel.org/pub/linux/kernel/v$MAJOR.x"
|
|
SHA256SUM="a326d1154324aee3dd9a25ac44bc4ce7242ded097d4ca2e4c131e6f32918e7d9"
|
|
DEPENDS="initrd"
|
|
SUBPKG="linux linux-modules"
|
|
|
|
get_linux_cpu() {
|
|
case "$TARGET" in
|
|
i*86-*)
|
|
echo "x86"
|
|
;;
|
|
x86_64-*)
|
|
echo "x86_64"
|
|
;;
|
|
arm-*)
|
|
echo "arm"
|
|
;;
|
|
*)
|
|
echo "don't know how to map $TARGET to Linux arch" >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
}
|
|
|
|
prepare() {
|
|
return
|
|
}
|
|
|
|
build() {
|
|
local INITRDDIR="$PKGDEPLOYDIR/initrd"
|
|
local INITRDLIST="$INITRDDIR/initrd.list"
|
|
local LINUX_CPU=$(get_linux_cpu)
|
|
|
|
pkg install -omLD -R "$REPODIR" -r "$INITRDDIR" initrd
|
|
pkg install -R "$REPODIR" -r "$INITRDDIR" -l initrd initrd > "$INITRDLIST"
|
|
|
|
export KBUILD_OUTPUT="$PKGBUILDDIR"
|
|
|
|
make -C "$1" O="$PKGBUILDDIR" ARCH="$LINUX_CPU" CROSS_COMPILE="${TARGET}-" mrproper
|
|
cat_file_override "linux.config" > "$PKGBUILDDIR/.config"
|
|
sed -i "$PKGBUILDDIR/.config" -e 's,^CONFIG_CROSS_COMPILE=.*,CONFIG_CROSS_COMPILE="'$TARGET'-",'
|
|
sed -i "$PKGBUILDDIR/.config" -e 's,^CONFIG_INITRAMFS_SOURCE=.*,CONFIG_INITRAMFS_SOURCE="'$INITRDLIST'",'
|
|
sed -i "$PKGBUILDDIR/.config" -e 's,^CONFIG_LOCALVERSION=.*,CONFIG_LOCALVERSION="-'${OS_NAME}-${OS_RELEASE}'",'
|
|
make -C "$1" O="$PKGBUILDDIR" ARCH="$LINUX_CPU" CROSS_COMPILE="${TARGET}-" oldconfig
|
|
make -C "$1" O="$PKGBUILDDIR" ARCH="$LINUX_CPU" CROSS_COMPILE="${TARGET}-" -j $NUMJOBS $LINUX_TGT
|
|
|
|
rm -rf "$INITRDDIR"
|
|
}
|
|
|
|
deploy() {
|
|
local SOURCE="$1"
|
|
local LINUX_CPU=$(get_linux_cpu)
|
|
local target
|
|
|
|
mkdir -p "$PKGDEPLOYDIR/boot" "$PKGDEPLOYDIR/lib/modules"
|
|
touch "$PKGDEPLOYDIR/linux.desc" "$PKGDEPLOYDIR/linux.files"
|
|
touch "$PKGDEPLOYDIR/linux-modules.desc"
|
|
touch "$PKGDEPLOYDIR/linux-modules.files"
|
|
|
|
for target in $LINUX_TGT; do
|
|
case $target in
|
|
*Image)
|
|
cp "arch/$LINUX_CPU/boot/$target" "$PKGDEPLOYDIR/vmlinuz"
|
|
echo "file vmlinuz 0755 0 0" > "$PKGDEPLOYDIR/linux.files"
|
|
;;
|
|
modules)
|
|
export KBUILD_OUTPUT="$PKGBUILDDIR"
|
|
make -C "$SOURCE" O="$PKGBUILDDIR" ARCH="$LINUX_CPU" CROSS_COMPILE="${TARGET}-" INSTALL_MOD_PATH="$PKGDEPLOYDIR" modules_install
|
|
|
|
echo "dir lib 0755 0 0" > "$PKGDEPLOYDIR/linux-modules.files"
|
|
|
|
pkg_scan_dir "$PKGDEPLOYDIR/lib" | \
|
|
sed "s#$PKGDEPLOYDIR/##g" \
|
|
>> "$PKGDEPLOYDIR/linux-modules.files"
|
|
;;
|
|
esac
|
|
done
|
|
}
|
|
|
|
check_update() {
|
|
curl --silent -L https://www.kernel.org/feeds/kdist.xml | \
|
|
grep -o "[0-9.]*: longterm" | grep -o "[0-9.]*" | \
|
|
verson_find_greatest "$VERSION"
|
|
}
|