wok-4.x annotate linux/stuff/gztazmod.sh @ rev 6714
linux/bootloader.sh: align initrdlen to 32bits
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Thu Oct 14 13:41:19 2010 +0200 (2010-10-14) |
parents | a8d7e0cbe748 |
children |
rev | line source |
---|---|
pankso@3 | 1 #!/bin/sh |
pankso@3 | 2 # gztazmod.sh: Compress Linux kernel modules for SliTaz GNU/Linux. |
pankso@3 | 3 # 2007/10/04 <pankso@slitaz.org> - GNU General Public License. |
pankso@3 | 4 # |
pankso@3 | 5 |
pankso@3 | 6 # We do our work in the kernel version modules directory. |
pankso@3 | 7 if [ -z "$1" ] ; then |
pankso@3 | 8 echo "" |
pankso@3 | 9 echo -e "\033[1musage:\033[0m `basename $0` path/to/kernel-version" |
pankso@3 | 10 echo "" |
pankso@3 | 11 exit 1 |
pankso@3 | 12 fi |
pankso@3 | 13 |
pankso@3 | 14 if [ ! -r "$1" ] ; then |
pankso@3 | 15 echo "" |
pankso@3 | 16 echo -e "Error : $1 does not exist." |
pankso@3 | 17 echo "" |
pankso@3 | 18 exit 1 |
pankso@3 | 19 fi |
pankso@3 | 20 |
pankso@3 | 21 cd $1 |
pankso@3 | 22 |
pankso@3 | 23 # Status functions. |
pankso@3 | 24 status() |
pankso@3 | 25 { |
pankso@3 | 26 local CHECK=$? |
pankso@3 | 27 echo -en "\\033[70G[ " |
pankso@3 | 28 if [ $CHECK = 0 ]; then |
pankso@3 | 29 echo -en "\\033[1;33mOK" |
pankso@3 | 30 else |
pankso@3 | 31 echo -en "\\033[1;31mFailed" |
pankso@3 | 32 fi |
pankso@3 | 33 echo -e "\\033[0;39m ]" |
pankso@3 | 34 } |
pankso@3 | 35 |
pankso@3 | 36 # Script start. |
pankso@3 | 37 echo "" |
pankso@3 | 38 echo "Starting gztazmod.sh to build compressed kernel modules... " |
pankso@3 | 39 echo "" |
pankso@3 | 40 |
pankso@3 | 41 # Find all modules. |
pascal@900 | 42 echo -n "Searching all modules to compress them... " |
pascal@1907 | 43 find . -name "*.ko" -exec lzma e '{}' '{}'.gz \; 2> /dev/null |
pankso@3 | 44 status |
pascal@1907 | 45 find . -name "*.ko" -exec rm '{}' \; |
pankso@3 | 46 |
pankso@3 | 47 # Build a new temporary modules.dep. |
pankso@3 | 48 echo -n "Building tmp.dep... " |
pascal@1907 | 49 sed 's/\.ko.gz/.ko/g' modules.dep > tmp.dep |
pascal@1907 | 50 sed -i 's/\.ko.gz/.ko/g' tmp.dep |
pascal@1907 | 51 sed -i 's/\.ko/.ko.gz/g' tmp.dep |
pankso@3 | 52 status |
pankso@3 | 53 |
pankso@3 | 54 # Destroy original modules.dep |
pankso@3 | 55 echo -n "Destroying modules.dep... " |
pankso@3 | 56 rm modules.dep |
pankso@3 | 57 status |
pankso@3 | 58 |
pankso@3 | 59 # Remove tmp.dep to modules.dep. |
pankso@3 | 60 echo -n "Removing tmp.dep to modules.dep... " |
pankso@3 | 61 mv tmp.dep modules.dep |
pankso@3 | 62 status |
pankso@3 | 63 |
pankso@3 | 64 # Script end. |
pankso@3 | 65 echo "" |
pankso@3 | 66 echo "Kernel modules `basename $1` are ready." |
pankso@3 | 67 echo "" |