summaryrefslogtreecommitdiffstats
path: root/remote/setup_target
diff options
context:
space:
mode:
authorMichael Neves2013-03-19 17:01:28 +0100
committerMichael Neves2013-03-19 17:01:28 +0100
commitc8bb72f64e50c40b5a6bd5ac1a2bb5b4bd3b7b7a (patch)
tree1709f6496b55581f6d936c5fcf8e72926452d011 /remote/setup_target
parentadjustments to generate_initramfs and generate_squashfs (diff)
downloadtm-scripts-c8bb72f64e50c40b5a6bd5ac1a2bb5b4bd3b7b7a.tar.gz
tm-scripts-c8bb72f64e50c40b5a6bd5ac1a2bb5b4bd3b7b7a.tar.xz
tm-scripts-c8bb72f64e50c40b5a6bd5ac1a2bb5b4bd3b7b7a.zip
copy_kernel in setup_target and some other modifications
Diffstat (limited to 'remote/setup_target')
-rwxr-xr-xremote/setup_target40
1 files changed, 33 insertions, 7 deletions
diff --git a/remote/setup_target b/remote/setup_target
index c1a45787..c5566fc2 100755
--- a/remote/setup_target
+++ b/remote/setup_target
@@ -3,23 +3,37 @@
MODE_DIR="${ROOT_DIR}/remote"
MODULES_DIR="${MODE_DIR}/modules"
-# check for target directory
-TARGET_DIR="${MODE_DIR}/targets/${TARGET}"
-[ -d $TARGET_DIR ] || perror "Given target directory does not exist: $TARGET"
-TARGET_BUILD_DIR="${MODE_DIR}/builds/${TARGET}"
+KERNEL_DIR="${MODE_DIR}/builds/kernel"
# Keep track of processed modules
PROCESSED_MODULES=""
initial_checks () {
+
# check for required tools
for BIN in git locate depmod
do
local TEST=$(which ${BIN})
[ -z "$TEST" ] && pinfo "Installing $BIN..." && apt-get install $BIN
done
+
}
+copy_kernel() {
+
+ local KERNEL_VER="vmlinuz-$(uname -r)"
+ [ -e "${KERNEL_DIR}/${KERNEL_VER}" ] && return
+
+ local TOOL_STR="$TOOL_STR copy_kernel:"
+
+ [ ! -d "${KERNEL_DIR}" ] && mkdir -p ${KERNEL_DIR}
+
+ pinfo "New kernel found. Copying '${KERNEL_VER}' to '${KERNEL_DIR}'."
+ pinfo "You may want to update your systems firmware/modules to match the current kernel."
+
+ cp "/boot/${KERNEL_VER}" "${KERNEL_DIR}" || perror "Cannot copy kernel from '/boot/${KERNEL_VER}' to '${KERNEL_DIR}'"
+
+}
read_config () {
unset REQUIRED_BINARIES
@@ -135,14 +149,20 @@ copyfileswithdependencies () {
generate_target() {
initial_checks
+ copy_kernel
+
+ TARGET=$1
+ TARGET_DIR="${MODE_DIR}/targets/${TARGET}"
+ TARGET_BUILD_DIR="${MODE_DIR}/builds/${TARGET}"
+ [ -d $TARGET_DIR ] || perror "Given target directory does not exist: $TARGET_DIR"
[[ $TARGET == builds || $TARGET == modules ]] && \
perror "Target directory cannot be named 'builds' nor 'modules'."
-
+
pinfo "Generating '$TARGET_BUILD_DIR' for '$TARGET'"
# if no arguments assume all.
- if [ "x$1" = "x" -o "x$1" = "xall" ]; then
+ if [ "x$2" = "x" -o "x$2" = "xall" ]; then
MODULES=$(ls ${TARGET_DIR})
set -- $MODULES
else
@@ -221,7 +241,13 @@ process_module() {
}
clean_modules() {
- if [ "x$1" = "x" -o "x$1" = "xall" ]; then
+
+ TARGET=$1
+ TARGET_DIR="${MODE_DIR}/targets/${TARGET}"
+ TARGET_BUILD_DIR="${MODE_DIR}/builds/${TARGET}"
+ [ -d $TARGET_DIR ] || perror "Given target directory does not exist: $TARGET_DIR"
+
+ if [ "x$2" = "x" -o "x$2" = "xall" ]; then
if [ -d ${TARGET_BUILD_DIR} ]; then
pinfo "Cleaning '${TARGET_BUILD_DIR}'" \
&& rm -rf "${TARGET_BUILD_DIR}"/* \