diff options
Diffstat (limited to 'remote')
| -rw-r--r-- | remote/modules/kernel/.gitignore | 5 | ||||
| -rw-r--r-- | remote/modules/kernel/kernel.build | 81 | ||||
| -rw-r--r-- | remote/modules/kernel/kernel.conf | 3 | ||||
| -rw-r--r-- | remote/rootfs/rootfs-stage31/rootfs-stage31.build | 1 | ||||
| -rw-r--r-- | remote/rootfs/rootfs-stage31/rootfs-stage31.conf | 3 | ||||
| -rw-r--r-- | remote/rootfs/rootfs-stage32/rootfs-stage32.build | 2 | ||||
| -rw-r--r-- | remote/rootfs/rootfs-stage32/rootfs-stage32.conf | 1 | ||||
| -rwxr-xr-x | remote/setup_target | 8 | ||||
| l--------- | remote/targets/stage31/kernel | 1 | ||||
| l--------- | remote/targets/stage32/kernel | 1 |
10 files changed, 97 insertions, 9 deletions
diff --git a/remote/modules/kernel/.gitignore b/remote/modules/kernel/.gitignore index 5e077cd8..56c69270 100644 --- a/remote/modules/kernel/.gitignore +++ b/remote/modules/kernel/.gitignore @@ -1,2 +1,3 @@ -ksrc/ -linux-*/ +ksrc +linux* +openslx.config diff --git a/remote/modules/kernel/kernel.build b/remote/modules/kernel/kernel.build new file mode 100644 index 00000000..8b238abf --- /dev/null +++ b/remote/modules/kernel/kernel.build @@ -0,0 +1,81 @@ +fetch_source() { + # get the source according to the distro + if [ "x$PACKET_MANAGER" == "xapt" ]; then + pdebug "apt-ing kernel source" + apt-get source linux-image-${KERNEL_VERSION} + [ ! -e ksrc ] && ln -s $(ls -d linux-*/) ksrc + elif [ "x$PACKET_MANAGER" == "xzypper" ]; then + pdebug "zypping kernel source" + zypper si kernel-source + + # 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 +} + +build() { + local TARGET_CONFIG_FILE="openslx.config" + [ -e "${TARGET_CONFIG_FILE}" ] && rm -f "${TARGET_CONFIG_FILE}" + # update config and copy to ksrc + 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')" + yes n | make oldconfig || perror "make oldconfig failed" + pinfo "Compiling kernel... (this will take some time)" + make || perror "make failed" + + # install modules to build directory + pinfo "Installing kernel modules..." + 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 + cp ksrc/arch/x86/boot/bzImage "${MODULE_BUILD_DIR}/${KERNEL_TARGET_NAME}" + pinfo "Kernel was successfully built at ${MODULE_BUILD_DIR}/${KERNEL_TARGET_NAME}" + [ -z "${KERNEL_BUILD_DIR}" ] && KERNEL_BUILD_DIR="${MODULE_BUILD_DIR}" +} + +post_copy() { + : +} + +# helper function to update the current kernel config with our parameters +update_config() { + + # first we need to update the current config + local BASE_CONFIG_FILE="/boot/config-$(uname -r)" + [ -e "${BASE_CONFIG_FILE}" ] || perror "$BASE_CONFIG_FILE could not be found! This should not happen." + + # 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 + cp "$BASE_CONFIG_FILE" "$TARGET_CONFIG_FILE" + + for WANTED_CONFIG in $(cat $OPENSLX_WANTED_CONFIG|sort -u); do + local CONFIG_PARAM_NAME=$(echo $WANTED_CONFIG | awk -F "=" '{print $1}') + local SEARCH_RESULT=$(grep "^$CONFIG_PARAM_NAME=" "$BASE_CONFIG_FILE") + + #echo "Process: $SEARCH_RESULT" + # analyse results + if [ "x$SEARCH_RESULT" == "x" ]; then + # no match, add it + echo $WANTED_CONFIG >> $TARGET_CONFIG_FILE + else + # match, change to our setting if they differ + if [ "x${SEARCH_RESULT: -1}" != "x${WANTED_CONFIG: -1}" ]; then + sed -i "s/$SEARCH_RESULT/$WANTED_CONFIG/" "$TARGET_CONFIG_FILE" + fi + fi + done +} diff --git a/remote/modules/kernel/kernel.conf b/remote/modules/kernel/kernel.conf new file mode 100644 index 00000000..0cd03752 --- /dev/null +++ b/remote/modules/kernel/kernel.conf @@ -0,0 +1,3 @@ +REQUIRED_BINARIES="" +REQUIRED_LIBRARIES="" +REQUIRED_DIRECTORIES="" diff --git a/remote/rootfs/rootfs-stage31/rootfs-stage31.build b/remote/rootfs/rootfs-stage31/rootfs-stage31.build index 9030e972..19a5838a 100644 --- a/remote/rootfs/rootfs-stage31/rootfs-stage31.build +++ b/remote/rootfs/rootfs-stage31/rootfs-stage31.build @@ -22,6 +22,7 @@ post_copy() { generate_rootfs copy_kernel_modules copy_firmware + copy_kernel # copy busybox that has been under /openslx back to / cp -r "${TARGET_BUILD_DIR}"/openslx/* "${TARGET_BUILD_DIR}" diff --git a/remote/rootfs/rootfs-stage31/rootfs-stage31.conf b/remote/rootfs/rootfs-stage31/rootfs-stage31.conf index 6d4af2c9..788ff8b3 100644 --- a/remote/rootfs/rootfs-stage31/rootfs-stage31.conf +++ b/remote/rootfs/rootfs-stage31/rootfs-stage31.conf @@ -1,4 +1,5 @@ -REQUIRED_MODULES=" busybox" +REQUIRED_MODULES=" busybox + kernel" REQUIRED_KERNEL_MODULES=" kernel/drivers/video/sis/sisfb.ko kernel/drivers/video/via/viafb.ko kernel/drivers/acpi/video.ko diff --git a/remote/rootfs/rootfs-stage32/rootfs-stage32.build b/remote/rootfs/rootfs-stage32/rootfs-stage32.build index a14bdfa4..e7c1d5f3 100644 --- a/remote/rootfs/rootfs-stage32/rootfs-stage32.build +++ b/remote/rootfs/rootfs-stage32/rootfs-stage32.build @@ -99,6 +99,6 @@ post_copy() { else pinfo "Not copying firmware from system, as '${TARGET_BUILD_DIR}/lib/firmware' already exists." fi - + copy_kernel } diff --git a/remote/rootfs/rootfs-stage32/rootfs-stage32.conf b/remote/rootfs/rootfs-stage32/rootfs-stage32.conf index 15bd0908..d2c1e5a9 100644 --- a/remote/rootfs/rootfs-stage32/rootfs-stage32.conf +++ b/remote/rootfs/rootfs-stage32/rootfs-stage32.conf @@ -1,3 +1,4 @@ +REQUIRED_MODULES=" kernel" REQUIRED_DEPENDENCIES="nfs-common aufs-tools squashfs-tools whois xfsprogs" REQUIRED_BINARIES=" bash more diff --git a/remote/setup_target b/remote/setup_target index e004d8bd..c070f1fc 100755 --- a/remote/setup_target +++ b/remote/setup_target @@ -3,8 +3,6 @@ MODE_DIR="${ROOT_DIR}/remote" MODULES_DIR="${MODE_DIR}/modules" -KERNEL_DIR="${MODE_DIR}/builds/kernel" - # Keep track of processed modules PROCESSED_MODULES="" @@ -136,7 +134,7 @@ copy_files_with_deps () { generate_target() { initial_checks - copy_kernel + #copy_kernel TARGET=$1 && shift TARGET_DIR="${MODE_DIR}/targets/${TARGET}" @@ -215,8 +213,8 @@ process_module() { pinfo "## Building" [ -e "${MODULE_DIR}/.built" ] || { build && touch "${MODULE_DIR}/.built"; } # remove *.la files as they might confuse libtool/linker of other tool packages - find "${MODULE_BUILD_DIR}" -name '*.la' -exec rm -f {} \; - [ -d "$TARGET_BUILD_DIR" ] && TARGET_BUILD_SIZE=$(du -bc "${TARGET_BUILD_DIR}" | awk 'END {print $1}') || TARGET_BUILD_SIZE=0 + [ -d "${MODULE_BUILD_DIR}" ] && find "${MODULE_BUILD_DIR}" -name '*.la' -exec rm -f {} \; + [ -d "${TARGET_BUILD_DIR}" ] && TARGET_BUILD_SIZE=$(du -bc "${TARGET_BUILD_DIR}" | awk 'END {print $1}') || TARGET_BUILD_SIZE=0 pinfo "## Copying files with dependencies" copy_files_with_deps pinfo "## Copying static module files" diff --git a/remote/targets/stage31/kernel b/remote/targets/stage31/kernel new file mode 120000 index 00000000..044f086d --- /dev/null +++ b/remote/targets/stage31/kernel @@ -0,0 +1 @@ +../../modules/kernel
\ No newline at end of file diff --git a/remote/targets/stage32/kernel b/remote/targets/stage32/kernel new file mode 120000 index 00000000..044f086d --- /dev/null +++ b/remote/targets/stage32/kernel @@ -0,0 +1 @@ +../../modules/kernel
\ No newline at end of file |
