From: <ke...@us...> - 2007-04-03 21:57:44
|
Revision: 949 http://svn.sourceforge.net/hackndev/?rev=949&view=rev Author: keddar Date: 2007-04-03 14:57:39 -0700 (Tue, 03 Apr 2007) Log Message: ----------- l4p: update from me latest t3 build, support new BFUGarux features and more.. :) Modified Paths: -------------- linux4palm/BFUGarux/init/live-lib Modified: linux4palm/BFUGarux/init/live-lib =================================================================== --- linux4palm/BFUGarux/init/live-lib 2007-03-30 21:01:50 UTC (rev 948) +++ linux4palm/BFUGarux/init/live-lib 2007-04-03 21:57:39 UTC (rev 949) @@ -24,8 +24,10 @@ MMC_MNTNEW="$UNION/mnt/mmc" LINUX2RAM=/linux2ram ### replaced with BFU if found... (DON'T USE /$LINUX2RAM :) CMD_MMC="$MMC_MNT$LINUX2RAM/cmdline" +liveload="1" # initial value LIVE_CHANGES="$MMC_MNT/live_changes.squashfs" + ######### REFLASH PARAMS BIN2FLASH="$MMC_MNT_ROOT/bin2flash" MTD_FREE_MD5="41d2e2c0c0edfccf76fa1c3e38bc1cf2 -" @@ -47,12 +49,12 @@ ## efetchall used for critical part, show info also if SilentBoot is used efetchall() { - echo -e " ${C_WHIT}>> $1${C_OFF}" + echo -e " ${C_WHIT}>> $1${C_OFF}" } ## don't show if SilentBoot is used efetch() { - if [ "$SILENT" = "" ]; then echo -e " ${C_WHIT}>> $1${C_OFF}"; fi + if [ "$SILENT" = "" ]; then echo -e " ${C_WHIT}>> $1${C_OFF}"; fi } einfo() { @@ -63,6 +65,10 @@ echo -e "$WARN $1${C_OFF}" } +ewarnn() { + echo -en "$WARN $1${C_OFF}" +} + eerr() { echo -e "$ERRO $1${C_OFF}" } @@ -94,12 +100,21 @@ einfo "Linux4Palm ${C_BLU}http://www.hackndev.com/${C_OFF}" einfo "Release codename : ${C_RED}${L4P_RELEASE}${C_OFF}" einfo "Version : $L4P_VERSION" - einfo "Kernel : $KERNEL_VER" + einfo "Kernel : $KERNEL_VER" ; einfo "SVN rev: $SVN" einfo "Bootloader: $BOOTL" - einfo "Unofficial rev.: ${C_GRE}$UNOFF${C_OFF}" + einfo "Build rev.: ${C_GRE}$REV${C_OFF}" einfo "Unofficial homepage : http://kedar.palmlinux.cz\n\n" } + +## inserting module - TODO ? dodelat, nebo nechat do_insmod_base tak jak je ?? +do_modprobe() { + if [ "`find /lib/modules/$KERNEL_VER/kernel/ -name $1.ko`" != "" ]; then + efetch $1 + modprobe $1 + fi +} + ## insert base kernel modules do_insmod_base() { ewarn "Loading core modules" @@ -123,14 +138,16 @@ modprobe squashfs fi - efetch "gpioed" - modprobe gpioed - do_die_msg "modprobe gpioed failed" + if [ -e /lib/modules/$KERNEL_VER/kernel/drivers/misc/gpioed.ko ]; then + efetch "gpioed" + modprobe gpioed + #do_die_msg "modprobe gpioed failed" + fi } ## probe modules from modules-???.squashfs, after unionfs is created do_insmod_ext() { - ewarn "Probing some modules from real root" + ewarn "Loading external modules..." modprobe -s -q tsc2101 $DEBUGCMD } @@ -152,7 +169,7 @@ ewarn "Mounting Ramdisk..." RAMSIZE="$BFURAMDiskSize" if [ "$RAMSIZE" = "" ]; then RAMSIZE="`cmdline_value ramsize`"; fi - if [ "$RAMSIZE" = "" ]; then RAMSIZE="80%"; fi + if [ "$RAMSIZE" = "" ]; then RAMSIZE="75%"; fi mount -t tmpfs -o size=$RAMSIZE tmpfs $MEMORY efetch "mounted with max size $RAMSIZE" } @@ -204,13 +221,13 @@ ## initialize usb network interface do_network_init() { - if [ "$usenet" != "0" ]; then - ewarn "Initializing network" - do_usb_power 0 - modprobe -s -q g_ether - do_die_msg "modprobe g_ether failed" - do_usb_power 1 - fi + if [ "$usenet" != "0" ]; then + ewarn "Initializing network" + do_usb_power 0 + modprobe -s -q g_ether + do_die_msg "modprobe g_ether failed" + do_usb_power 1 + fi } ## network configure in text mode - not used for BFUSettings @@ -312,7 +329,7 @@ ## choice default start: -## - if found config cmdline - run old textmode configure +## - if found cmdline 'config' - run old textmode configure ## - if BFUSource is empty - run default configured => SD-GPE-NET192 ## - in other case - run BFUSettings configure do_start_default() { @@ -365,11 +382,13 @@ fi if [ "$via" = "c" ]; then do_mount_nfs - do_chroot_nfs + cd $MEMORY/nfs + do_chroot fi if [ "$via" = "t" ]; then do_mmc_mount - do_chroot_oncard + cd $MMC_MNT + do_chroot fi unset via } @@ -408,21 +427,23 @@ NFS="$BFUAddress" if [ $BFUUseNet = "0" ]; then do_network_def; fi ### replace BFUUseNet=0 do_mount_nfs - do_chroot_nfs + cd $MEMORY/nfs + do_chroot fi #### source is real rootfs on nfs share if [ "$BFUSource" = "3" ]; then do_mmc_mount do_mmc_move ### xxxxx - do_chroot_oncard + cd $MMC_MNT + do_chroot fi } ## get modules from www server, from modlist.txt, or modlist-gpe.txt do_get_modules_www() { $DEBUGCMD - ewarn "Getting module list:"; efetch "$WWW/modlist.txt" + ewarnn "Getting module list:"; efetchall "$WWW/modlist.txt" cd $MEMORY wget "$WWW/modlist.txt" -P $MEMORY if [ -e modlist.txt ]; then @@ -432,7 +453,7 @@ wget "$WWW/modlist-gpe.txt" MODLIST="modlist-gpe.txt" fi - export MOD_STR + export MODLIST do_die MOD_STR="" mkdir -p $COPY2RAM @@ -447,21 +468,29 @@ MOD_STR="$mod $MOD_STR" fi done + + ## add modules coresponded with rev of garux + efetch "modules-$REV.squashfs" + MOD_STR="modules-$REV.squashfs $MOD_STR" + export MOD_STR + MODDIR="$COPY2RAM" + start_from_www="1" - $DEBUGCMD + + $DEBUGCMD } ## get modules from mmc card do_get_modules_mmc() { $DEBUGCMD - ewarn "Getting modules list..." + ewarnn "Getting modlist:" cd $MEMORY MOD_STR="" ## don't try copy modlist from mmc, if found in memory if [ ! -e $MEMORY/modlist-all.txt ]; then - efetch "$MMC_MNT$LINUX2RAM/$MODLIST" + efetchall "$MODLIST" cp "$MMC_MNT$LINUX2RAM/$MODLIST" . do_die fi @@ -482,8 +511,15 @@ MODDIR="$MMC_MNT$LINUX2RAM" fi done + + ## add modules coresponded with rev of garux + efetch "add modules-$REV.squashfs" + MOD_STR="modules-$REV.squashfs $MOD_STR" + export MOD_STR + start_from_mmc="1" + $DEBUGCMD } @@ -602,7 +638,7 @@ cd $MEMORY for mod in $MOD_STR ; do if [ -e $MODDIR/$mod ]; then - efetch "$mod" + efetchall "$mod" mkdir -p $IMAGES/$mod mount -t squashfs -o ro,loop $MODDIR/$mod "$IMAGES/$mod" else @@ -613,43 +649,20 @@ done } -## re-rooted to directory with new root +## chroot to directory with new root do_chroot() { cd $UNION mkdir -p mnt/live umount /sys - if [ ! -e $UNION/dev/console ]; then mknod $UNION/dev/console c 5 1; fi - if [ ! -e $UNION/dev/initctl ]; then mknod $UNION/dev/initctl p; fi - pivot_root . mnt/live - do_bin2flash_check - do_insmod_ext - ewarn "Running init..." - exec /usr/sbin/chroot . /sbin/init 5 <dev/console >dev/console 2>&1 - do_die -} - -do_chroot_nfs() { - cd $MEMORY/nfs - mkdir -p mnt/live - umount /sys - if [ ! -e $MEMORY/nfs/dev/console ]; then mknod $MEMORY/nfs/dev/console c 5 1; fi - if [ ! -e $MEMORY/nfs/dev/initctl ]; then mknod $MEMORY/nfs/dev/initctl p; fi - pivot_root . mnt/live - do_insmod_ext - ewarn "Running init..." - exec /usr/sbin/chroot . /sbin/init 5 <dev/console >dev/console 2>&1 - do_die -} - -do_chroot_oncard() { - cd $MMC_MNT - mkdir -p mnt/live - umount /sys if [ ! -e dev/console ]; then mknod dev/console c 5 1; fi if [ ! -e dev/initctl ]; then mknod dev/initctl p; fi pivot_root . mnt/live + if [ "$start_from_www" = "1" ]; then + do_bin2flash_check + fi do_insmod_ext ewarn "Running init..." + $initwait exec /usr/sbin/chroot . /sbin/init 5 <dev/console >dev/console 2>&1 do_die } @@ -672,7 +685,7 @@ ### einfo "Copying some file from init to real root (/)" ### cp -a /unioncopy/* $UNION 2>/dev/null if [ "$usekbd" != "0" ]; then ### fixme - rewrite for separated copy !? - ewarn "Copying ...resume.d/inputtattach to real root (/)" + efetch "Copying 'unioncopy' to real root (/)" cp -a /unioncopy/* $UNION 2>/dev/null fi fi @@ -682,7 +695,7 @@ ## if found rootcopy (in source dir for modules), recursive copy all to / do_rootcopy() { if [ -e $MMC_MNT$LINUX2RAM/rootcopy ]; then - ewarn "Copying 'rootcopy' to real root (/)" + efetch "Copying 'rootcopy' to real root (/)" cp -a $MMC_MNT$LINUX2RAM/rootcopy/* $UNION 2>/dev/null fi if [ "$start_from_www" = "1" ]; then @@ -700,15 +713,14 @@ ## unpack live_changes.squashfs if found (created if reboot, or manualy run Live_Save icon in GPE) do_load_live_changes() { - if [ "$start_from_mmc" = "1" ]; then - if [ "$liveskip" != "1" ]; then + if [ "$start_from_mmc" = "1" ]; then + if [ "$liveload" = "1" ]; then + ewarnn "Loading live_changes ..." if [ -e $LIVE_CHANGES ]; then - if message_skipped "$WARN Loading live_changes... " 3 "${C_REDY}SKIP${C_OFF}"; then - efetch "unpacking ..." - unsquashfs -f -dest $CHANGES $LIVE_CHANGES >/dev/null - else - efetchall "skiping ..." - fi + efetchall "unpacking ..." + unsquashfs -f -dest $CHANGES $LIVE_CHANGES >/dev/null + else + efetchall "not found ..." fi fi fi @@ -740,23 +752,22 @@ ## set cpufreq to fixed or auto frequency, using cpufreq governors do_cpufreq_scale() { - ewarn "Setting CPU speed..." - efetch "minimal frequency: "`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq`" kHz" - efetch "maximal frequency: "`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq`" kHz" - efetch "speed before is: "`cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed`" kHz" - if [ `cmdline_parameter cpufreq` ]; then - CPUFREQ="`cmdline_value cpufreq`" - efetch "read cpufreq from /proc/cmdline: $CPUFREQ'000' kHz" + if [ "$CPUFREQ" != "none" ]; then + modprobe cpu-pxa + ewarnn "Initializing cpu-freq... " +# efetch "minimal frequency: "`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq`" kHz" +# efetch "maximal frequency: "`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq`" kHz" +# efetch "speed before is: "`cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed`" kHz" + if [ "$CPUFREQ" = "" ]; then CPUFREQ="133"; efetch "set default value from init..."; fi + if [ "$CPUFREQ" != "auto" ]; then + echo $CPUFREQ'000' >/sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed + efetchall `cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed`" kHz" + else + GOVERNOR="conservative"; export GOVERNOR ; modprobe -q "cpufreq_$GOVERNOR" + echo "$GOVERNOR" >/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor + efetchall "$GOVERNOR" + fi fi - if [ "$CPUFREQ" = "" ]; then CPUFREQ="133"; efetch "set default value from init..."; fi - if [ "$CPUFREQ" != "auto" ]; then - echo $CPUFREQ'000' >/sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed - efetchall "after set is speed: "`cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed`" kHz" - else - GOVERNOR="conservative"; export GOVERNOR ; modprobe -q "cpufreq_$GOVERNOR" - echo "$GOVERNOR" >/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor - efetchall "cpufreq is set to auto ($GOVERNOR)" - fi } ## change cpufreq from text file 'cmdline' in source dir for modules/real root (if found file & cpu=) @@ -799,20 +810,24 @@ if [ `cmdline_parameter www` ]; then WWW="`cmdline_value www`"; else WWW="http://$NET_HOST_IP$LINUX2RAM"; fi if [ `cmdline_parameter lcdbl` ]; then LCDBL="`cmdline_value lcdbl`"; fi if [ `cmdline_parameter fsck` ]; then fsckon="1"; fi - if [ `cmdline_parameter ss` ]; then liveskip="1"; fi + if [ `cmdline_parameter ss` ]; then liveload="0"; fi + if [ `cmdline_parameter iw` ]; then initwait="read enter"; fi + if [ `cmdline_parameter cpufreq` ]; then CPUFREQ="`cmdline_value cpufreq`"; fi fi } ## check parameters from text file 'cmdline' in source dir for modules/real root do_cmdline_check_mmc() { - if [ -e $CMD_MMC ]; then - if [ `cmdline_parameter nokbd $CMD_MMC` ]; then usekbd="0"; fi - if [ `cmdline_parameter debug $CMD_MMC` ]; then DEBUGCMD="debug"; fi - if [ `cmdline_parameter mmcrw $CMD_MMC` ]; then rmode="rw"; fi - if [ `cmdline_parameter copy2ram $CMD_MMC` ]; then copy2ram="1"; fi - if [ `cmdline_parameter lcdbl $CMD_MMC` ]; then LCDBL="`cmdline_value lcdbl $CMD_MMC`"; do_lcdbl_set; fi - if [ `cmdline_parameter skipsaves $CMD_MMC` ]; then liveskip="1"; fi - fi + if [ -e $CMD_MMC ]; then + if [ `cmdline_parameter nokbd $CMD_MMC` ]; then usekbd="0"; fi + if [ `cmdline_parameter debug $CMD_MMC` ]; then DEBUGCMD="debug"; fi + if [ `cmdline_parameter mmcrw $CMD_MMC` ]; then rmode="rw"; fi + if [ `cmdline_parameter copy2ram $CMD_MMC` ]; then copy2ram="1"; fi + if [ `cmdline_parameter lcdbl $CMD_MMC` ]; then LCDBL="`cmdline_value lcdbl $CMD_MMC`"; do_lcdbl_set; fi + if [ `cmdline_parameter skipsaves $CMD_MMC` ]; then liveload="0"; fi + if [ `cmdline_parameter initwait $CMD_MMC` ]; then initwait="read enter"; fi + if [ `cmdline_parameter cpufreq $CMD_MMC` ]; then CPUFREQ="`cmdline_value cpufreq`"; fi + fi } ## import BFUSettings via BFULinuxHelper, and set value from it @@ -835,7 +850,7 @@ SILENT2="2>/dev/null" # <dev/stdout >/dev/null <dev/console >/dev/null fi - if [ "$BFUAddress" != "" ]; then LINUX2RAM="$BFUAddress"; fi + if [ "$BFUAddress" != "" ]; then LINUX2RAM="$BFUAddress"; CMD_MMC="$MMC_MNT$LINUX2RAM/cmdline"; fi if [ "$BFUUseNet" = "0" ]; then usenet="0"; fi if [ "$BFUKeyboard" = "0" ]; then usekbd="0"; fi if [ "$BFUDebug" = "1" ]; then DEBUGCMD="debug"; fi @@ -844,9 +859,10 @@ if [ "$BFUCPUspeed" = "1" ]; then CPUFREQ="133"; fi if [ "$BFUCPUspeed" = "2" ]; then CPUFREQ="266"; fi if [ "$BFUCPUspeed" = "3" ]; then CPUFREQ="399"; fi + if [ "$BFUCPUspeed" = "4" ]; then CPUFREQ="none"; fi if [ "$BFUCopy2RAM" = "1" ]; then copy2ram="1"; fi if [ "$BFUFSCK" = "1" ]; then fsckon="1"; fi - if [ "$BFULive" = "0" ]; then liveskip="1"; fi + if [ "$BFULiveChanges" = "0" ]; then liveload="0"; fi } ## run shell for debuging init, test problebs etc.. need stowaway/dicota keyboard @@ -978,21 +994,8 @@ do_flash_prepare() { if [ "$MTD_NEW" != "skip" ]; then efetchall "prepare for: ${C_YEL}$MTD_NEW${C_OFF} ..." - -## temporary(?) disabled - because MTD_DEV_MD5_AFTER is fixed, and MD5 for 0.1 and 0.2 is present in do_mtdX_setup -# if [ ! -e "$BIN2FLASH/$MTD_NEW.md5" ]; then -# efetch "${C_REDY}NOT FOUND: $MTD_NEW.md5" -# efetch "${C_YEL}create it, ONLY with MD5 number." -# efetch "${C_YEL}because flashing is DANGEROUS..." -# efetch "${C_YEL}without this is ${C_REDW}STOPED${C_OFF}" -# $PREFIX/bin/sleep 10 -# do_mmc_reini -# do_flash_restart -# fi - ## don't create backup if restore ;) if [ "$backup" != "NO" ]; then do_flash_backup; fi - efetchall "copy ${C_YEL}$MTD_NEW${C_OFF} to ${C_YEL}ramdisk${C_OFF}..." if [ -e $PREFIX/memory/$MTD_NEW ]; then $PREFIX/bin/rm $PREFIX/memory/$MTD_NEW; fi $PREFIX/bin/cp $BIN2FLASH/$MTD_NEW $PREFIX/memory This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |