summaryrefslogtreecommitdiffstats
path: root/remote/modules/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'remote/modules/kernel')
-rw-r--r--remote/modules/kernel/kernel.build83
-rw-r--r--remote/modules/kernel/kernel.conf.opensuse2
-rw-r--r--remote/modules/kernel/kernel.conf.ubuntu2
-rw-r--r--remote/modules/kernel/kernel.conf.ubuntu.13.042
4 files changed, 39 insertions, 50 deletions
diff --git a/remote/modules/kernel/kernel.build b/remote/modules/kernel/kernel.build
index 197935f7..78832905 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,30 +21,32 @@ 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')"
+ 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
@@ -73,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
@@ -85,6 +69,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
@@ -113,33 +98,31 @@ 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"
- pinfo "Starting to patch..."
+ 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/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"
- #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!"
+
+ # 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" || pwarning "Problem patching aufs3-mmap.patch: hunks failed?"
+ fi
pinfo "Patched kernel source with aufs-${NEEDED_BRANCH}"
cd "$MODULE_DIR"
}
diff --git a/remote/modules/kernel/kernel.conf.opensuse b/remote/modules/kernel/kernel.conf.opensuse
new file mode 100644
index 00000000..a66564fe
--- /dev/null
+++ b/remote/modules/kernel/kernel.conf.opensuse
@@ -0,0 +1,2 @@
+REQUIRED_GIT_BRANCH="-b openSUSE-${SYS_VERSION}"
+REQUIRED_GIT="git://kernel.opensuse.org/kernel.git $REQUIRED_GIT_BRANCH"
diff --git a/remote/modules/kernel/kernel.conf.ubuntu b/remote/modules/kernel/kernel.conf.ubuntu
new file mode 100644
index 00000000..1c876d15
--- /dev/null
+++ b/remote/modules/kernel/kernel.conf.ubuntu
@@ -0,0 +1,2 @@
+REQUIRED_GIT_BRANCH="-b master"
+REQUIRED_GIT="git://kernel.ubuntu.com/ubuntu/ubuntu-${SYS_CODENAME}.git $REQUIRED_GIT_BRANCH"
diff --git a/remote/modules/kernel/kernel.conf.ubuntu.13.04 b/remote/modules/kernel/kernel.conf.ubuntu.13.04
new file mode 100644
index 00000000..e9192f01
--- /dev/null
+++ b/remote/modules/kernel/kernel.conf.ubuntu.13.04
@@ -0,0 +1,2 @@
+REQUIRED_GIT_BRANCH="-b master"
+REQUIRED_GIT="git://kernel.ubuntu.com/ubuntu-archive/ubuntu-${SYS_CODENAME}.git $REQUIRED_GIT_BRANCH"