summaryrefslogtreecommitdiffstats
path: root/remote
diff options
context:
space:
mode:
authorMichael Neves2013-04-24 18:19:49 +0200
committerMichael Neves2013-04-24 18:19:49 +0200
commit97472f07e21c73e9d767de7960dc1e05ba48b53d (patch)
treee4119718dbddd68664480436767fc12d4a319700 /remote
parentfix rsyslog (diff)
parentWe will require wpad for the future ... (diff)
downloadtm-scripts-97472f07e21c73e9d767de7960dc1e05ba48b53d.tar.gz
tm-scripts-97472f07e21c73e9d767de7960dc1e05ba48b53d.tar.xz
tm-scripts-97472f07e21c73e9d767de7960dc1e05ba48b53d.zip
Merge branch 'master' of git.openslx.org:openslx-ng/tm-scripts
Diffstat (limited to 'remote')
-rw-r--r--remote/modules/kernel/.gitignore3
-rw-r--r--remote/modules/kernel/kernel.build81
-rw-r--r--remote/modules/kernel/kernel.conf3
-rw-r--r--remote/modules/systemd/data/etc/systemd/system/udhcpc@.service2
-rw-r--r--remote/rootfs/rootfs-stage31/rootfs-stage31.build1
-rw-r--r--remote/rootfs/rootfs-stage31/rootfs-stage31.conf3
-rw-r--r--remote/rootfs/rootfs-stage32/rootfs-stage32.build2
-rw-r--r--remote/rootfs/rootfs-stage32/rootfs-stage32.conf1
-rw-r--r--remote/rootfs/rootfs-stage32/rootfs-stage32.conf.zypper1
-rwxr-xr-xremote/setup_target10
l---------remote/targets/stage31/kernel1
l---------remote/targets/stage32/kernel1
12 files changed, 100 insertions, 9 deletions
diff --git a/remote/modules/kernel/.gitignore b/remote/modules/kernel/.gitignore
new file mode 100644
index 00000000..56c69270
--- /dev/null
+++ b/remote/modules/kernel/.gitignore
@@ -0,0 +1,3 @@
+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/modules/systemd/data/etc/systemd/system/udhcpc@.service b/remote/modules/systemd/data/etc/systemd/system/udhcpc@.service
index e7d4d170..a945e743 100644
--- a/remote/modules/systemd/data/etc/systemd/system/udhcpc@.service
+++ b/remote/modules/systemd/data/etc/systemd/system/udhcpc@.service
@@ -3,7 +3,7 @@ Description=DHCP Client
[Service]
Type=simple
-ExecStart=/openslx/sbin/udhcpc -O domain -O nissrv -O nisdomain -t 8 -s /etc/udhcpc.openslx.script -i %I
+ExecStart=/openslx/sbin/udhcpc -O domain -O nissrv -O nisdomain -O wpad -t 8 -s /etc/udhcpc.openslx.script -i %I
[Install]
WantedBy=multi-user.target
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 8b056e1b..164a3464 100644
--- a/remote/rootfs/rootfs-stage32/rootfs-stage32.build
+++ b/remote/rootfs/rootfs-stage32/rootfs-stage32.build
@@ -105,6 +105,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 1ff35bcb..d421cf1b 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/rootfs/rootfs-stage32/rootfs-stage32.conf.zypper b/remote/rootfs/rootfs-stage32/rootfs-stage32.conf.zypper
index a8a8c1b3..c4c79d73 100644
--- a/remote/rootfs/rootfs-stage32/rootfs-stage32.conf.zypper
+++ b/remote/rootfs/rootfs-stage32/rootfs-stage32.conf.zypper
@@ -1,4 +1,5 @@
pinfo "If aufs install fails, run zypper addrepo http://jftp.inai.de/openSUSE_12.3/ j.eng-i586"
+REQUIRED_MODULES=" kernel"
REQUIRED_DEPENDENCIES="nfs-client aufs squashfs"
REQUIRED_PACKAGES="timezone"
REQUIRED_BINARIES=" bash
diff --git a/remote/setup_target b/remote/setup_target
index 1f4840b8..43765ce3 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}"
@@ -218,8 +216,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"
@@ -243,7 +241,7 @@ local TOOL_STR="$TOOL_STR post_process_target:"
#move systemd files from /lib to /etc/lib
pinfo "move systemd files from /lib/systemd to /etc/systemd"
-if [ -d "${TARGET_BUILD_DIR}/lib" ]; then
+if [ -d "${TARGET_BUILD_DIR}/lib/systemd" ]; then
cd "${TARGET_BUILD_DIR}/lib"
tarcopy "systemd" "${TARGET_BUILD_DIR}/etc"
cd - &> /dev/null
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