From d0b28f00acd87c501ec9b5527a2231e4283656b0 Mon Sep 17 00:00:00 2001 From: Christian Rößler Date: Tue, 11 Feb 2014 18:04:21 +0100 Subject: [kernel] POSSIBLE BREAKER! kernel now per git, -distro switches, added config files for openSuse and Ubuntu --- remote/modules/kernel/kernel.build | 42 ++++++++++++++------------------------ 1 file changed, 15 insertions(+), 27 deletions(-) (limited to 'remote/modules/kernel/kernel.build') diff --git a/remote/modules/kernel/kernel.build b/remote/modules/kernel/kernel.build index 197935f7..6e988434 100644 --- a/remote/modules/kernel/kernel.build +++ b/remote/modules/kernel/kernel.build @@ -1,23 +1,7 @@ fetch_source() { - # get the source according to the distro - if [ "x$PACKET_MANAGER" == "xapt" ]; then - pdebug "apt-ing kernel source" - apt-get install -y dpkg-dev || perror "Installing dpkg-dev failed." - apt-get source linux-image-${KERNEL_CURRENT_VERSION} || perror "Fetching kernel source failed." - [ -z "$(ls -d linux-*/)" ] && perror "Source directory not found." - [ ! -e ksrc ] && ln -s "$(ls -d linux-*/)" "ksrc" - elif [ "x$PACKET_MANAGER" == "xzypper" ]; then - pdebug "zypping kernel source" - zypper --no-refresh install -y kernel-source || perror "Fetching kernel source failed." - - # find src directory - local SOURCE_DIR=$(rpm -ql kernel-source |grep -E -o '^/.*src/linux-[^/]+/' |head -1) - [ -z "${SOURCE_DIR}" ] && perror "Could not determine directory of kernel source..." - ln -sf "${SOURCE_DIR}" ksrc - else - pdebug "Packet manager not determined!" - fi - + pdebug "getting kernel sources via git ...." + [ -d ./ksrc ] && rm -rf ./ksrc # slightly brutal ... + git clone --depth 1 ${REQUIRED_GIT} ksrc || perror "Could not clone kernel git." # check for aufs local RSL=$(find ksrc/ -type d -name aufs) if [ -z "$RSL" ]; then @@ -26,10 +10,8 @@ fetch_source() { else pinfo "aufs detected in kernel source :)" fi - # remember the current kernel version echo "${KERNEL_CURRENT_VERSION}" > ksrc/KVERSION - } build() { @@ -39,7 +21,6 @@ build() { pinfo "Updating kernel config..." update_config cp "${TARGET_CONFIG_FILE}" ksrc/.config - # make kernel with the new config cd ksrc || perror "Could not cd to ksrc, was the kernel source fetched properly?" pinfo "Preparing kernel for new config ('make oldconfig')" @@ -48,6 +29,7 @@ build() { else make oldconfig || perror "make oldconfig failed" fi + pinfo "Compiling kernel... (this will take some time)" if gcc --version | grep "4\.7" && which distcc; then pinfo "USING DISTCC" @@ -85,6 +67,7 @@ update_config() { # check for our wanted config parameter local OPENSLX_WANTED_CONFIG="${ROOT_DIR}/data/kernel.wanted.config" + [ -e "${OPENSLX_WANTED_CONFIG}" ] || perror "$OPENSLX_WANTED_CONFIG does not exist! Please add a list of wanted kernel config parameters." # copy basic config file @@ -123,8 +106,9 @@ patch_aufs() { pinfo "Getting branch origin/$NEEDED_BRANCH" cd "$MODULE_DIR/aufs3-standalone" || perror "Could not CD to aufs3-standalone" git checkout "origin/aufs$NEEDED_BRANCH" - pinfo "Starting to patch..." + pinfo "Starting to patch... $NEEDED_BRANCH" tarcopy "Documentation fs" "$MODULE_DIR/ksrc" + local AUFSH if [ ! -e "include/linux/aufs_type.h" ]; then [ ! -e "include/uapi/linux/aufs_type.h" ] && perror "No aufs_type.h in aufs3-git" @@ -134,12 +118,16 @@ patch_aufs() { else AUFSH="include/linux/aufs_type.h" fi + pinfo "Using $AUFSH" - cp "$AUFSH" "$MODULE_DIR/ksrc/include/linux/" || perror "could not copy $AUFSH" + cp "$AUFSH" "$MODULE_DIR/ksrc/include/uapi/linux/" || perror "could not copy $AUFSH" cd "$MODULE_DIR/ksrc" || perror "Could not CD to kernel-source dir ksrc" - patch -p1 < "$MODULE_DIR/aufs3-standalone/aufs3-kbuild.patch" || perror "aufs3-standalone/aufs3-kbuild.patch failed" - patch -p1 < "$MODULE_DIR/aufs3-standalone/aufs3-base.patch" || perror "aufs3-standalone/aufs3-base.patch failed" - #patch -p1 < "$MODULE_DIR/aufs3-standalone/aufs3-proc_map.patch" || perror "aufs3-standalone/aufs3-proc_map.patch failed" + + patch -p1 < "$MODULE_DIR/aufs3-standalone/aufs3-kbuild.patch" || perror "aufs3-standalone/aufs3-kbuild.patch failed!" + patch -p1 < "$MODULE_DIR/aufs3-standalone/aufs3-base.patch" || perror "aufs3-standalone/aufs3-base.patch failed!" + [ -f "$MODULE_DIR/aufs3-standalone/aufs3-mmap.patch" ] && patch -p1 < "$MODULE_DIR/aufs3-standalone/aufs3-mmap.patch" \ + || pinfo "aufs3-mmap.patch: $? (hunk failed?)" + pinfo "Patched kernel source with aufs-${NEEDED_BRANCH}" cd "$MODULE_DIR" } -- cgit v1.2.3-55-g7522 From 4bec0cb2c252fde800865c48018b0dfa64e8776f Mon Sep 17 00:00:00 2001 From: Christian Rößler Date: Wed, 12 Feb 2014 15:31:52 +0100 Subject: [kernel] Some modif. in build script for openSuse 12.3 patching --- remote/modules/kernel/kernel.build | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'remote/modules/kernel/kernel.build') diff --git a/remote/modules/kernel/kernel.build b/remote/modules/kernel/kernel.build index 6e988434..6376ceb3 100644 --- a/remote/modules/kernel/kernel.build +++ b/remote/modules/kernel/kernel.build @@ -96,19 +96,17 @@ update_config() { patch_aufs() { pinfo "Cloning aufs3 standalone git" cd "$MODULE_DIR" - if [ ! -d "aufs3-standalone/.git" ]; then - rm -rf "aufs3-standalone" - git clone "git://aufs.git.sourceforge.net/gitroot/aufs/aufs3-standalone.git" || perror "Cloning aufs3 failed." - fi + [ -d "aufs3-standalone/.git" ] && rm -rf "aufs3-standalone" # if already there, kill it. + # git: --depth 1 won't work here due to later "checkout origin/branch" + git clone "git://aufs.git.sourceforge.net/gitroot/aufs/aufs3-standalone.git" || perror "Cloning aufs3 failed." # get the needed version [ ! -z ${KERNEL_CURRENT_VERSION} ] && local NEEDED_BRANCH=$(echo $KERNEL_CURRENT_VERSION | awk -F "." '{print $1"."$2}') \ || perror "KERNEL_CURRENT_VERSION not set, this should not happen!" pinfo "Getting branch origin/$NEEDED_BRANCH" cd "$MODULE_DIR/aufs3-standalone" || perror "Could not CD to aufs3-standalone" - git checkout "origin/aufs$NEEDED_BRANCH" + git checkout "origin/aufs$NEEDED_BRANCH" || perror "Could not checkout needed branch." pinfo "Starting to patch... $NEEDED_BRANCH" tarcopy "Documentation fs" "$MODULE_DIR/ksrc" - local AUFSH if [ ! -e "include/linux/aufs_type.h" ]; then [ ! -e "include/uapi/linux/aufs_type.h" ] && perror "No aufs_type.h in aufs3-git" @@ -120,14 +118,15 @@ patch_aufs() { fi pinfo "Using $AUFSH" - cp "$AUFSH" "$MODULE_DIR/ksrc/include/uapi/linux/" || perror "could not copy $AUFSH" +# cp "$AUFSH" "$MODULE_DIR/ksrc/include/uapi/linux/" || perror "could not copy $AUFSH" + cp "$AUFSH" "$MODULE_DIR/ksrc/include/linux/" || perror "could not copy $AUFSH" cd "$MODULE_DIR/ksrc" || perror "Could not CD to kernel-source dir ksrc" patch -p1 < "$MODULE_DIR/aufs3-standalone/aufs3-kbuild.patch" || perror "aufs3-standalone/aufs3-kbuild.patch failed!" patch -p1 < "$MODULE_DIR/aufs3-standalone/aufs3-base.patch" || perror "aufs3-standalone/aufs3-base.patch failed!" - [ -f "$MODULE_DIR/aufs3-standalone/aufs3-mmap.patch" ] && patch -p1 < "$MODULE_DIR/aufs3-standalone/aufs3-mmap.patch" \ - || pinfo "aufs3-mmap.patch: $? (hunk failed?)" - + if [ -f "$MODULE_DIR/aufs3-standalone/aufs3-mmap.patch" ]; then + patch -p1 < "$MODULE_DIR/aufs3-standalone/aufs3-mmap.patch" || pinfo "aufs3-mmap.patch: (hunks failed?)" + fi pinfo "Patched kernel source with aufs-${NEEDED_BRANCH}" cd "$MODULE_DIR" } -- cgit v1.2.3-55-g7522 From 7e4b95621a97a86d9c4aae298643e1c1dc5d0747 Mon Sep 17 00:00:00 2001 From: Christian Rößler Date: Wed, 12 Feb 2014 15:51:12 +0100 Subject: [kernel] kernel.build: A pinfo more informative --- remote/modules/kernel/kernel.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'remote/modules/kernel/kernel.build') diff --git a/remote/modules/kernel/kernel.build b/remote/modules/kernel/kernel.build index 6376ceb3..32d5368b 100644 --- a/remote/modules/kernel/kernel.build +++ b/remote/modules/kernel/kernel.build @@ -125,7 +125,7 @@ patch_aufs() { patch -p1 < "$MODULE_DIR/aufs3-standalone/aufs3-kbuild.patch" || perror "aufs3-standalone/aufs3-kbuild.patch failed!" patch -p1 < "$MODULE_DIR/aufs3-standalone/aufs3-base.patch" || perror "aufs3-standalone/aufs3-base.patch failed!" if [ -f "$MODULE_DIR/aufs3-standalone/aufs3-mmap.patch" ]; then - patch -p1 < "$MODULE_DIR/aufs3-standalone/aufs3-mmap.patch" || pinfo "aufs3-mmap.patch: (hunks failed?)" + patch -p1 < "$MODULE_DIR/aufs3-standalone/aufs3-mmap.patch" || pinfo "Problem patching aufs3-mmap.patch: hunks failed?" fi pinfo "Patched kernel source with aufs-${NEEDED_BRANCH}" cd "$MODULE_DIR" -- cgit v1.2.3-55-g7522 From 4f93f017addab5c44ee51471d573b1fba05cbfb1 Mon Sep 17 00:00:00 2001 From: Christian Rößler Date: Wed, 12 Feb 2014 17:39:43 +0100 Subject: [kernel] kernel.build: simplified aufs_type.h copying - oS 12.3 and 13.1 compatible so far --- remote/modules/kernel/kernel.build | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'remote/modules/kernel/kernel.build') diff --git a/remote/modules/kernel/kernel.build b/remote/modules/kernel/kernel.build index 32d5368b..79338fab 100644 --- a/remote/modules/kernel/kernel.build +++ b/remote/modules/kernel/kernel.build @@ -107,25 +107,19 @@ patch_aufs() { git checkout "origin/aufs$NEEDED_BRANCH" || perror "Could not checkout needed branch." pinfo "Starting to patch... $NEEDED_BRANCH" tarcopy "Documentation fs" "$MODULE_DIR/ksrc" - local AUFSH - if [ ! -e "include/linux/aufs_type.h" ]; then - [ ! -e "include/uapi/linux/aufs_type.h" ] && perror "No aufs_type.h in aufs3-git" - AUFSH="include/uapi/linux/aufs_type.h" - elif [ -e "include/uapi/linux/aufs_type.h" -a "$(stat -c %s "include/uapi/linux/aufs_type.h")" -gt "$(stat -c %s "include/linux/aufs_type.h")" ]; then - AUFSH="include/uapi/linux/aufs_type.h" - else - AUFSH="include/linux/aufs_type.h" - fi - pinfo "Using $AUFSH" -# cp "$AUFSH" "$MODULE_DIR/ksrc/include/uapi/linux/" || perror "could not copy $AUFSH" - cp "$AUFSH" "$MODULE_DIR/ksrc/include/linux/" || perror "could not copy $AUFSH" + # Quick-and-dirty aufs_type.h copying: + [ -e "include/linux/aufs_type.h" ] && cp "include/linux/aufs_type.h" "$MODULE_DIR/ksrc/include/linux/" + [ -e "include/uapi/linux/aufs_type.h" ] && cp "include/uapi/linux/aufs_type.h" "$MODULE_DIR/ksrc/include/uapi/linux/" + cd "$MODULE_DIR/ksrc" || perror "Could not CD to kernel-source dir ksrc" patch -p1 < "$MODULE_DIR/aufs3-standalone/aufs3-kbuild.patch" || perror "aufs3-standalone/aufs3-kbuild.patch failed!" patch -p1 < "$MODULE_DIR/aufs3-standalone/aufs3-base.patch" || perror "aufs3-standalone/aufs3-base.patch failed!" + + # this following 'if' is a burning shame - caused as patching under eg. openSuse 13.1 is always unsuccessful due to hunk failing if [ -f "$MODULE_DIR/aufs3-standalone/aufs3-mmap.patch" ]; then - patch -p1 < "$MODULE_DIR/aufs3-standalone/aufs3-mmap.patch" || pinfo "Problem patching aufs3-mmap.patch: hunks failed?" + patch -p1 < "$MODULE_DIR/aufs3-standalone/aufs3-mmap.patch" || pwarning "Problem patching aufs3-mmap.patch: hunks failed?" fi pinfo "Patched kernel source with aufs-${NEEDED_BRANCH}" cd "$MODULE_DIR" -- cgit v1.2.3-55-g7522 From 7811718358bbe8a43fe7c7258f35576991b99d21 Mon Sep 17 00:00:00 2001 From: Christian Rößler Date: Tue, 18 Feb 2014 14:49:44 +0100 Subject: [kernel] Added 'make prepare' and 'make scripts' for eg. nvidia compilation --- remote/modules/kernel/kernel.build | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'remote/modules/kernel/kernel.build') diff --git a/remote/modules/kernel/kernel.build b/remote/modules/kernel/kernel.build index 79338fab..78832905 100644 --- a/remote/modules/kernel/kernel.build +++ b/remote/modules/kernel/kernel.build @@ -23,28 +23,30 @@ build() { cp "${TARGET_CONFIG_FILE}" ksrc/.config # make kernel with the new config cd ksrc || perror "Could not cd to ksrc, was the kernel source fetched properly?" - pinfo "Preparing kernel for new config ('make oldconfig')" + pinfo "Preparing kernel for new config ('make oldconfig')." if [ "x$MLTK_QUIET" = "x1" ]; then - yes "" | make oldconfig || perror "make oldconfig failed" + yes "" | make oldconfig || perror "make oldconfig failed." else - make oldconfig || perror "make oldconfig failed" + make oldconfig || perror "make oldconfig failed." fi + make prepare || perror "make prepare failed." + make scripts || perror "make scripts failed." pinfo "Compiling kernel... (this will take some time)" if gcc --version | grep "4\.7" && which distcc; then pinfo "USING DISTCC" - make CC="distcc gcc-4.7" -j16 || perror "make failed" + make CC="distcc gcc-4.7" -j16 || perror "make failed." else # explicitly state number of cores here, as MAKEFLAGS seems to be overridden - make "-j$CPU_CORES" || perror "make failed" + make "-j$CPU_CORES" || perror "make failed." fi # install modules to build directory pinfo "Installing kernel modules..." if [ -d "${MODULE_BUILD_DIR}/lib/modules" ]; then - rm -r "${MODULE_BUILD_DIR}/lib/modules" || pwarning "Could not clean old modules" + rm -r "${MODULE_BUILD_DIR}/lib/modules" || pwarning "Could not clean old modules." fi - make INSTALL_MOD_PATH="${MODULE_BUILD_DIR}" INSTALL_MOD_STRIP=1 modules_install || perror "make modules_install failed in ${MODULE_BUILD_DIR}" + make INSTALL_MOD_PATH="${MODULE_BUILD_DIR}" INSTALL_MOD_STRIP=1 modules_install || perror "make modules_install failed in ${MODULE_BUILD_DIR}." cd - 2> /dev/null # copy kernel to build @@ -55,7 +57,7 @@ build() { post_copy() { mkdir -p "$TARGET_BUILD_DIR/../kernel" - cp -a "$MODULE_BUILD_DIR/kernel" "$TARGET_BUILD_DIR/../kernel/kernel" || perror "could not copy kernel to remote build dir" + cp -a "$MODULE_BUILD_DIR/kernel" "$TARGET_BUILD_DIR/../kernel/kernel" || perror "could not copy kernel to remote build dir." } # helper function to update the current kernel config with our parameters -- cgit v1.2.3-55-g7522