[a/kernel-gwh] common kernel for all hosts

This commit is contained in:
Gwenhael Le Moine 2023-08-25 13:26:59 +02:00
parent 317f8e8d58
commit def29bfc06
No known key found for this signature in database
GPG key ID: FDFE3669426707A7

View file

@ -4,9 +4,8 @@ set -e
set -x set -x
CWD=$(pwd) CWD=$(pwd)
THIS_HOST=${THIS_HOST:-$(hostname -s)} PRGNAM=$(basename "$CWD")
PRGNAM=$(basename "$CWD")-$THIS_HOST BUILD=${BUILD:-7}
BUILD=${BUILD:-6}
BRANCH=${BRANCH:-mainline} # stable ; mainline BRANCH=${BRANCH:-mainline} # stable ; mainline
ARCH=$(uname -m) ARCH=$(uname -m)
@ -20,10 +19,14 @@ NUMJOBS=${NUMJOBS:-$(nproc)}
ANEW=${ANEW:-true} ANEW=${ANEW:-true}
CONFIG=${CONFIG:-""} CONFIG=${CONFIG:-""}
rm -fr "$PKG" REPOSITORY=${REPOSITORY:-/home/installs/SlackBuilds/_repositories/$PRGNAM}
VERSION=${VERSION:-$(curl https://www.kernel.org/feeds/kdist.xml | grep -o "[0-9.rc-]*: $BRANCH" | head -n1 | cut -d: -f1)} VERSION=${VERSION:-$(curl https://www.kernel.org/feeds/kdist.xml | grep -o "[0-9.rc-]*: $BRANCH" | head -n1 | cut -d: -f1)}
mkdir -p "$REPOSITORY"
rm -fr "$PKG"
mkdir -p "$PKG/usr/src/" mkdir -p "$PKG/usr/src/"
if [ -e "/usr/src/linux-$VERSION" ] && [[ "$ANEW" != "true" ]]; then if [ -e "/usr/src/linux-$VERSION" ] && [[ "$ANEW" != "true" ]]; then
cp -a "/usr/src/linux-$VERSION" "$PKG/usr/src/" cp -a "/usr/src/linux-$VERSION" "$PKG/usr/src/"
@ -34,13 +37,12 @@ else
SRC_URL="https://git.kernel.org/torvalds/t" SRC_URL="https://git.kernel.org/torvalds/t"
fi fi
[ ! -e "$CWD"/linux-"$VERSION".tar.gz ] && wget -c "$SRC_URL/linux-$VERSION.tar.gz" -O "$CWD/linux-$VERSION.tar.gz" [ ! -e "$REPOSITORY"/linux-"$VERSION".tar.gz ] && wget -c "$SRC_URL/linux-$VERSION.tar.gz" -O "$REPOSITORY/linux-$VERSION.tar.gz"
tar xf "$CWD/linux-$VERSION.tar.gz" -C "$PKG/usr/src/" tar xf "$REPOSITORY/linux-$VERSION.tar.gz" -C "$PKG/usr/src/"
fi fi
cd "$PKG/usr/src/" || exit 1 cd "$PKG/usr/src/" || exit 1
mv "linux-$VERSION" "linux-${VERSION}-gwh" mv "linux-$VERSION" "linux-${VERSION}-gwh"
#ln -s "linux-$VERSION" linux
cd "linux-${VERSION}-gwh" cd "linux-${VERSION}-gwh"
if [ -n "$CONFIG" ] && [ -e "$CONFIG" ]; then if [ -n "$CONFIG" ] && [ -e "$CONFIG" ]; then
@ -49,7 +51,8 @@ fi
if [ ! -f .config ]; then if [ ! -f .config ]; then
zcat /proc/config.gz > .config zcat /proc/config.gz > .config
fi fi
read
# read
make oldconfig "$@" make oldconfig "$@"
@ -66,6 +69,7 @@ if [ -z "${HEADERS_ARCH}" ]; then
*) HEADERS_ARCH=$(uname -m) ;; *) HEADERS_ARCH=$(uname -m) ;;
esac esac
fi fi
# Generate the kernel headers and clean them up: # Generate the kernel headers and clean them up:
( echo "Generating headers from the Linux kernel source tree in ${KERNEL_SOURCE}:" ( echo "Generating headers from the Linux kernel source tree in ${KERNEL_SOURCE}:"
make headers_install ARCH="${HEADERS_ARCH}" INSTALL_HDR_PATH="$PKG/usr" make headers_install ARCH="${HEADERS_ARCH}" INSTALL_HDR_PATH="$PKG/usr"
@ -83,22 +87,22 @@ fi
VERSION=$(basename "$(find "$PKG/lib/modules/" -type d -maxdepth 1 -mindepth 1 | head -n1)") VERSION=$(basename "$(find "$PKG/lib/modules/" -type d -maxdepth 1 -mindepth 1 | head -n1)")
mkdir -p "$PKG/boot/" mkdir -p "$PKG/boot/"
# cp System.map "$PKG/boot/System.map-gwh-$VERSION" cp System.map "$PKG/boot/System.map-gwh-$VERSION"
# cp .config "$PKG/boot/config-gwh-$VERSION" cp .config "$PKG/boot/config-gwh-$VERSION"
# cp "arch/${ARCH}/boot/bzImage" "$PKG/boot/vmlinuz-gwh-$VERSION" cp "arch/${ARCH}/boot/bzImage" "$PKG/boot/vmlinuz-gwh-$VERSION"
cp System.map "$PKG/boot/System.map-gwh" # cp System.map "$PKG/boot/System.map-gwh"
cp .config "$PKG/boot/config-gwh" # cp .config "$PKG/boot/config-gwh"
cp "arch/${ARCH}/boot/bzImage" "$PKG/boot/vmlinuz-gwh" # cp "arch/${ARCH}/boot/bzImage" "$PKG/boot/vmlinuz-gwh"
make clean make clean
cd "$PKG/boot/" || exit 1 cd "$PKG/boot/" || exit 1
# ln -s "vmlinuz-gwh-$VERSION" vmlinuz-gwh ln -s "vmlinuz-gwh-$VERSION" vmlinuz-gwh
# ln -s "config-gwh-$VERSION" config-gwh ln -s "config-gwh-$VERSION" config-gwh
# ln -s "System.map-gwh-$VERSION" System.map-gwh ln -s "System.map-gwh-$VERSION" System.map-gwh
ln -s vmlinuz-gwh "vmlinuz-gwh-$VERSION" # ln -s vmlinuz-gwh "vmlinuz-gwh-$VERSION"
ln -s config-gwh "config-gwh-$VERSION" # ln -s config-gwh "config-gwh-$VERSION"
ln -s System.map-gwh "System.map-gwh-$VERSION" # ln -s System.map-gwh "System.map-gwh-$VERSION"
mkdir -p "$PKG/install" mkdir -p "$PKG/install"
cat <<EOF > "$PKG/install/doinst.sh" cat <<EOF > "$PKG/install/doinst.sh"