Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Wed 26 Nov 2014, 14:38
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
depmod seems not to follow link
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
Page 1 of 1 Posts_count  
Author Message
Karl Godt


Joined: 20 Jun 2010
Posts: 3972
Location: Kiel,Germany

PostPosted: Thu 28 Feb 2013, 12:55    Post_subject:  depmod seems not to follow link
Sub_title: Want to store also /lib/modules/`uname -r` on a /boot partition
 

Got me a new HDD and wanted to use a /boot partition not only for GRUB , the kernel and probably an initrd.gz ,
but also to store the drivers on it , to be able to boot any Linux with a kernel and it's drivers without need to have the modules also on every partition , too .
Space is not that problem nowerdays , since the drivers compiled without debugging symbols occupy only 30-100 MB disk space ( FULL Debugging 1GB and more ).
The intention is a smaller menu.lst , where to edit the kernel line from " root=/dev/sdaY " to " root=/dev/sdaX " should be enough in the grub shell .

I tried something like this in /etc/rc.d/rc.sysinit to achieve this :
Code:
###+++2013-02-28 Support for mounting a boot partition containing the kernel modules
LINKTARGET=`readlink /lib/modules/$(uname -r)`
BOOTPARTITION=`echo "$LINKTARGET" | sed 's#/lib.*##'`
if [ "$BOOTPARTITION" ] ; then
echo "Using a Boot Partition"
BOOTDRIVE=`echo "$BOOTPARTITION" | grep -o -E -e 'hd[a-z][0-9]*|sd[a-z][0-9]*'`

if [ "$BOOTDRIVE" ] ; then
grep -w "$BOOTDRIVE" /proc/partitions || BOOTDRIVE='unknown';fi

if [ "$BOOTDRIVE" != 'unknown' ] ; then
BOOTPARTITION=`echo "$BOOTPARTITION" | sed 's#\(.*/[sh]d[a-z][0-9]*/\).*#\1#'`  #need to be like /mnt/sda1/
rm -rf "$BOOTPARTITION"
mkdir -p "$BOOTPARTITION"
mount /dev/$BOOTDRIVE "$BOOTPARTITION"
mount
else
echo "Sorry, could not find '$BOOTDRIVE' in /proc/partitions"
fi;fi
###+++2013-02-28 Support for mounting a boot partition containing the kernel modules


The outcome is that Busybox depmod and depmod-FULL both don't like to follow an absolute link like

/mnt/sda3/lib/modules/2.6.30.5: symbolic link to `/mnt/sda1/Kernel/Puppy-orig/2.6.30.5'

even if
Code:
cd /mnt/sda3 && chroot . && depmod 2.6.30.5


At boot time it gave me empty modules.* files first in /mnt/sda1/Kernel/Puppy-orig/2.6.30.5 and later on /mnt/sda1/

Any ideas ?
Back to top
View user's profile Send_private_message Visit_website 
amigo

Joined: 02 Apr 2007
Posts: 2278

PostPosted: Thu 28 Feb 2013, 14:44    Post_subject:  

You'd have to mount or bind the modules dir into the '/' to make that work.
In other words, /boot would have to be first mounted early in init process, then /lib/modules/`uname -r` would need to be 'bound' to /boot/whattever-dir-name
like this:
mount -o bind /boot/whattever-dir-name /lib/modules/`uname -r`

Remember that this also means that the kernel must contain hard-linked support for whatever filesystem /boot is on.
Back to top
View user's profile Send_private_message 
Karl Godt


Joined: 20 Jun 2010
Posts: 3972
Location: Kiel,Germany

PostPosted: Thu 28 Feb 2013, 15:50    Post_subject:  

Yup, first experiments seemed to work

ie
Code:
mount-FULL --bind /mnt/sda1/Kernel/Puppy-orig/2.6.30.5/ /mnt/sda3/lib/modules/2.6.30.5/

and mount output is as
/dev/sda1 on /mnt/sda3/lib/modules/2.6.30.5 type ext4 (rw,relatime,barrier=1,data=ordered)
from the outside running OS on sdb2

and depmod worked creating filled files from inside the chroot terminal .

The mounting from inside the chroot terminal did not work until now .

*

I guess i need a mountpoint.db file to point to the /mnt/sda1/Kernel/Puppy-orig/2.6.30.5/ directory , since /lib/modules/2.6.30.5 needs to be a directory .

Or transform link to directory and transform back at shutdown , but in case of a hard poweroff that would not work next boot .

Other idea i have would be the zdrv.sfs mounted as loopdevice , but that would likely be read-only and would probably not allow to write new modules.* files ..

Will experiment further . Thanks amigo !
Back to top
View user's profile Send_private_message Visit_website 
Karl Godt


Joined: 20 Jun 2010
Posts: 3972
Location: Kiel,Germany

PostPosted: Thu 28 Feb 2013, 18:10    Post_subject:  

Seems that I got it working with a Linkname as 2.6.30.5-LINK instead a db file so 2.6.30.5 can exist as directory :
Code:
###+++2013-02-28 Support for mounting a boot partition containing the kernel modules
LINKTARGET=`readlink /lib/modules/"$(uname -r)"-LINK`
if [ "$LINKTARGET" ] ; then
BOOTPARTITION=`echo "$LINKTARGET" | sed 's#/lib.*##'`
if [ "$BOOTPARTITION" ] ; then
echo "Using a Boot Partition"
BOOTDRIVE=`echo "$BOOTPARTITION" | grep -o -E -e 'hd[a-z][0-9]*|sd[a-z][0-9]*'`

if [ "$BOOTDRIVE" ] ; then
grep -w "$BOOTDRIVE" /proc/partitions || BOOTDRIVE='unknown' #;fi

if [ "$BOOTDRIVE" != 'unknown' ] ; then
BOOTPARTITION=`echo "$BOOTPARTITION" | sed 's#\(.*/[sh]d[a-z][0-9]*/\).*#\1#'`  #need to be like /mnt/sda1/
rm -rf "$BOOTPARTITION"
mkdir -p "$BOOTPARTITION"
rm -rf "/lib/modules/`uname -r`"
mkdir -p "/lib/modules/`uname -r`" ; sleep 2s
mount /dev/$BOOTDRIVE "$BOOTPARTITION" ; sleep 2s
mount-FULL --bind "$LINKTARGET" "/lib/modules/`uname -r`" ; sleep 2s
mount
else
echo "Sorry, could not find '$BOOTDRIVE' in /proc/partitions"
fi
else
echo "Got '$BOOTPARTITION' but no BOOTDRIVE '$BOOTDRIVE'"
fi;fi;fi
###+++2013-02-28 Support for mounting a boot partition containing the kernel modules

The mount shows in /tmp/bootsysinit.log as
Quote:
/dev/sda1 on /mnt/sda1 type ext4 (rw,relatime,barrier=1,data=ordered)
/dev/sda1 on /lib/modules/2.6.30.5 type ext4 (rw,relatime,barrier=1,data=ordered)

depmod ran some seconds now and the usb modules did load ,
so I had been able to finish the keyboard wizard , but missed the country wizard and xorgwizard did not start automatically . But I have had other weird behavior like ( /tmp/bootkernel.log of a kernel on sdb2 plus few /tmp/* files from xwin in /tmp/sda3 ) , all drivers deleted from /boot partition and such funny things before .

rc.sysinit is the only file I have my whole coding with for now , all other scripts should be Macpup Foxy 3 (Pup-4.3) original .

YippiHappy . Very Happy
Back to top
View user's profile Send_private_message Visit_website 
Display_posts:   Sort by:   
Page 1 of 1 Posts_count  
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » Off-Topic Area » Programming
Jump to:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0573s ][ Queries: 12 (0.0032s) ][ GZIP on ]