aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/mkmodimg.sh
diff options
context:
space:
mode:
authorcodeworkx <daniel.hillenbrand@codeworkx.de>2012-06-02 13:09:29 +0200
committercodeworkx <daniel.hillenbrand@codeworkx.de>2012-06-02 13:09:29 +0200
commitc6da2cfeb05178a11c6d062a06f8078150ee492f (patch)
treef3b4021d252c52d6463a9b3c1bb7245e399b009c /scripts/mkmodimg.sh
parentc6d7c4dbff353eac7919342ae6b3299a378160a6 (diff)
downloadkernel_samsung_smdk4412-c6da2cfeb05178a11c6d062a06f8078150ee492f.tar.gz
kernel_samsung_smdk4412-c6da2cfeb05178a11c6d062a06f8078150ee492f.tar.bz2
kernel_samsung_smdk4412-c6da2cfeb05178a11c6d062a06f8078150ee492f.zip
samsung update 1
Diffstat (limited to 'scripts/mkmodimg.sh')
-rwxr-xr-xscripts/mkmodimg.sh47
1 files changed, 47 insertions, 0 deletions
diff --git a/scripts/mkmodimg.sh b/scripts/mkmodimg.sh
new file mode 100755
index 00000000000..e4cc9f128dd
--- /dev/null
+++ b/scripts/mkmodimg.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+
+# mkmod.sh
+# Making an image file which contains driver modules(.ko files)
+# The image file will be in $TMP_DIR/$BIN_NAME (usr/tmp-mod/modules.img)
+# CAUTION: This script MUST be run in the root directory of linux kernel source.
+# Author: Wonil Choi (wonil22.choi@samsung.com)
+
+TMP_DIR="usr/tmp-mod"
+BIN_NAME="modules.img"
+
+make modules
+if [ "$?" != "0" ]; then
+ echo "Failed to make modules"
+ exit 1
+fi
+make modules_install ARCH=arm INSTALL_MOD_PATH=${TMP_DIR}
+if [ "$?" != "0" ]; then
+ echo "Failed to make modules_install"
+ exit 1
+fi
+
+# modules image size is dynamically determined
+BIN_SIZE=`du -s ${TMP_DIR}/lib | awk {'printf $1;'}`
+let BIN_SIZE=${BIN_SIZE}+1024+512 # 1 MB journal + 512 KB buffer
+
+cd ${TMP_DIR}/lib
+mkdir -p tmp
+dd if=/dev/zero of=${BIN_NAME} count=${BIN_SIZE} bs=1024
+mkfs.ext4 -q -F -t ext4 -b 1024 ${BIN_NAME}
+sudo -n mount -t ext4 ${BIN_NAME} ./tmp -o loop
+if [ "$?" != "0" ]; then
+ echo "Failed to mount (or sudo)"
+ exit 1
+fi
+cp modules/* ./tmp -rf
+sudo -n chown root:root ./tmp -R
+sync
+sudo -n umount ./tmp
+if [ "$?" != "0" ]; then
+ echo "Failed to umount (or sudo)"
+ exit 1
+fi
+mv ${BIN_NAME} ../
+cd ../
+rm lib -rf
+