3 # Making an image file which contains driver modules(.ko files)
4 # The image file will be in $TMP_DIR/$BIN_NAME (usr/tmp-mod/modules.img)
5 # CAUTION: This script MUST be run in the root directory of linux kernel source.
6 # Author: Wonil Choi (wonil22.choi@samsung.com)
11 make modules_prepare ARCH=arm
13 if [ "$?" != "0" ]; then
14 echo "Failed to make modules"
17 make modules_install ARCH=arm INSTALL_MOD_PATH=${TMP_DIR}
18 if [ "$?" != "0" ]; then
19 echo "Failed to make modules_install"
23 # modules image size is dynamically determined
24 BIN_SIZE=`du -s ${TMP_DIR}/lib | awk {'printf $1;'}`
25 let BIN_SIZE=${BIN_SIZE}+2048 # Additional 2 MB for journal + buffer
27 if [ -f ./scripts/make_ext4fs ]; then
28 echo "Make modules.img using by make_ext4fs tool"
29 ./scripts/make_ext4fs -l ${BIN_SIZE}K -b 1024 ${TMP_DIR}/${BIN_NAME} ${TMP_DIR}/lib/modules/
30 if [ "$?" != "0" ]; then
31 echo "Failed to make modules.img(using by make_ext4fs)"
38 dd if=/dev/zero of=${BIN_NAME} count=${BIN_SIZE} bs=1024
39 mkfs.ext4 -q -F -t ext4 -b 1024 ${BIN_NAME}
40 sudo -n mount -t ext4 ${BIN_NAME} ./tmp -o loop
41 if [ "$?" != "0" ]; then
42 echo "Failed to mount (or sudo)"
45 sudo cp modules/* ./tmp -rf
46 sudo -n chown root:root ./tmp -R
49 if [ "$?" != "0" ]; then
50 echo "Failed to umount (or sudo)"