diff options
| -rw-r--r-- | remote/modules/kernel/kernel.build | 42 | ||||
| -rw-r--r-- | remote/modules/kernel/kernel.conf.opensuse | 2 | ||||
| -rw-r--r-- | remote/modules/kernel/kernel.conf.ubuntu | 2 | ||||
| -rwxr-xr-x | remote/setup_target | 4 |
4 files changed, 21 insertions, 29 deletions
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" } 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..e9192f01 --- /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-archive/ubuntu-${SYS_CODENAME}.git $REQUIRED_GIT_BRANCH" diff --git a/remote/setup_target b/remote/setup_target index 21831fde..9ae948ab 100755 --- a/remote/setup_target +++ b/remote/setup_target @@ -524,8 +524,8 @@ clean_kernel_module() { [ "x$USER_INPUT" == "xy" ] && CLEAN=1 fi - pinfo "Cleaning kernel module (including sources and compiled stuff)." if [[ $CLEAN == 1 ]]; then + pinfo "Cleaning kernel module (including sources and compiled stuff)." cd "${TARGET_DIR}/kernel" || perror "Could not cd to ${TARGET_DIR}/kernel" if [ -e build ]; then rm -rf build || perror "Could not delete ${TARGET_DIR}/kernel/build" @@ -549,10 +549,10 @@ clean_kernel_module() { if [ -L ksrc ]; then unlink ksrc || perror "Could not unlink ${TARGET_DIR}/kernel/ksrc." fi + pinfo "Done cleaning kernel." else pinfo "Not confirmed, not cleaning kernel module." fi - pinfo "Done cleaning kernel." } # Recursively strip binaries and libraries in the given directory |
