Author Topic: Root On Sd  (Read 4559 times)

malcolmxavier

  • Newbie
  • *
  • Posts: 25
    • View Profile
Root On Sd
« on: June 09, 2005, 02:15:24 pm »
Ok so I wen through the steps on the OpenZaurus HowTo page. Several times in various iterations with no avail.  I put comments in the /sbin/init file to try and pinpoint where the problem may lie.  But I am not confused because everything should be working...

I'll add a snippet of the code and where is succeeded and where it fails...

Code: [Select]
######################################
#  Only a snippet from the full /etc/init script
######################################

echo "Pivoting Root..." >> /dev/tty0
/sbin/insmod /lib/modules/2.4.18-rmk7-pxa3-embedix/kernel/drivers/block/sharp_mmcsd_m.o

######################################
echo "Success with insmod" >> /dev/tty0 #got here!        
######################################

     if [ -z "$IMAGE" ]
     then
           IMAGE='/dev/mmcda1'
    /bin/mount -o remount,rw /
     else
          /bin/mount -t ext2 -o defaults,sync,noatime /dev/mmcda1 /media/card
     fi
        
     /sbin/losetup /dev/loop0 $IMAGE
     /bin/mount -t ext2 /dev/loop0 /media/image

######################################
echo "Saw the mount" >> dev/tty0   ## This also seems to succeed!!
######################################

     if [ -f /media/image/sbin/init ]
     then

######################################
echo "found init" >> /dev/tty0         ## Never gets here and goes straight to Failure
######################################

     if(/sbin/pivot_root /media/image /media/image/media/realroot)
     then

######################################
echo " Successful" >> /dev/tty0
######################################
          /bin/mount -t ext2 -o move /media/realroot/media/card /media/card
          exec /sbin/init $1
     fi
fi
        
echo " Failed!" >> /dev/tty0
exec /sbin/init.org $1        

I know that /media/image/sbin/init exists because after opie boots I mount the opie.img under image and I can see it.  I have a feeling that it's not really mounting, but I don't understand why.

Could it be that my /ect/rcS.d/S39sd doesn't come soomer?  I really am shooting in the dark here.  

Please help!
-John
-----------------------------------
Zaurus SL5500
1 Gig Lexar SD card
Ambicom WiFi WL1100C-CF
OpenZaurus 3.5.3 with Opie 1.2.0

CoreDump

  • Hero Member
  • *****
  • Posts: 713
    • View Profile
    • http://www.hentges.net
Root On Sd
« Reply #1 on: June 09, 2005, 02:55:29 pm »
Quote
Ok so I wen through the steps on the OpenZaurus HowTo page. Several times in various iterations with no avail.  I put comments in the /sbin/init file to try and pinpoint where the problem may lie.  But I am not confused because everything should be working...

[...]

I know that /media/image/sbin/init exists because after opie boots I mount the opie.img under image and I can see it.  I have a feeling that it's not really mounting, but I don't understand why.

Could it be that my /ect/rcS.d/S39sd doesn't come soomer?  I really am shooting in the dark here. 

/etc/init.d/sd is not used at all. Not the one in flash and not the one inside your image.
rboot loads the driver and mounts the card.

Anyways, debugging a custom /sbin/init can be a _real_ pain. I'd dump the content of "mount" into the console right after rboot tried to mount the SD card. If it does (which is unlikely by the looks of it) you can narrow your problem down. If it doesn I'd hack up a custom /sbin/init which drops into a shell right after booting the kernel.

Then I'd enter each command manually and see where it borks.
Did I mention that debugging /sbin/init can be a real pain?  

FUBAR'ed permissions can be the cause for many problems. I'd run chown -R root.root on all files inside the image just to be on the safe side.

This little snipplet of wisdom cost me 3 days of my life....
Webmaster of hentges.net & Embedded Linux Developer.

malcolmxavier

  • Newbie
  • *
  • Posts: 25
    • View Profile
Root On Sd
« Reply #2 on: June 09, 2005, 08:41:33 pm »
Quote
This little snipplet of wisdom cost me 3 days of my life....
[div align=\"right\"][{POST_SNAPBACK}][/a][/div]


Well since it took you 3 days of your life and I just don't have that much time on my hands I bagged it for now in favor of your most excellent altboot program. It worked great, I tried all of your self made loop-roms and they all worked except I couldn't get my WiFi (Ambicom) working with any of them, so I built my own.  One question (maybe this is better posed on the other [a href=\"https://www.oesf.org/forums/index.php?showtopic=12915]thread[/url], but does the size of the self build ROM come into play with the speed. I built one on my SD card that is 250M (yeah a little excessive, but I never want to run out of space) and it seems a tad slower than your 71M Opie-GPE combo.  It is liveable, but I was just curious.

Thanks for the advice!
-John
-----------------------------------
Zaurus SL5500
1 Gig Lexar SD card
Ambicom WiFi WL1100C-CF
OpenZaurus 3.5.3 with Opie 1.2.0

CoreDump

  • Hero Member
  • *****
  • Posts: 713
    • View Profile
    • http://www.hentges.net
Root On Sd
« Reply #3 on: June 10, 2005, 11:43:44 am »
Quote
Well since it took you 3 days of your life and I just don't have that much time on my hands I bagged it for now in favor of your most excellent altboot program. It worked great, I tried all of your self made loop-roms and they all worked except I couldn't get my WiFi (Ambicom) working with any of them, so I built my own.

One question (maybe this is better posed on the other thread, but does the size of the self build ROM come into play with the speed. I built one on my SD card that is 250M (yeah a little excessive, but I never want to run out of space) and it seems a tad slower than your 71M Opie-GPE combo.  It is liveable, but I was just curious.

Um dunno why that would be but it is possible. I don't have enough space on any of my cards to do some tests but will try to keep it in mind.

Quote
Thanks for the advice!
[div align=\"right\"][a href=\"index.php?act=findpost&pid=83620\"][{POST_SNAPBACK}][/a][/div]

You are welcome  
Webmaster of hentges.net & Embedded Linux Developer.

niv

  • Full Member
  • ***
  • Posts: 237
    • View Profile
Root On Sd
« Reply #4 on: August 14, 2005, 03:53:05 pm »
Another question if I may:
can I create the image on a Vfat formated SD?

CoreDump

  • Hero Member
  • *****
  • Posts: 713
    • View Profile
    • http://www.hentges.net
Root On Sd
« Reply #5 on: August 15, 2005, 04:47:21 am »
Quote
Another question if I may:
can I create the image on a Vfat formated SD?
[div align=\"right\"][a href=\"index.php?act=findpost&pid=91831\"][{POST_SNAPBACK}][/a][/div]

Yes  
Webmaster of hentges.net & Embedded Linux Developer.

niv

  • Full Member
  • ***
  • Posts: 237
    • View Profile
Root On Sd
« Reply #6 on: August 16, 2005, 06:55:25 am »
more simple answers:
1. do you have a opie.img file ready for download?
2. is there a GPE.img ready for DL?
3. when I did: dd of=opie.img if=/dev/zero bs=1024 count=150000 on a 512Mb SD I got: out of space.
I df and see root is 100% full

what to do?

zaurus 5500,3.5.3
Niv

Greg2

  • Hero Member
  • *****
  • Posts: 790
    • View Profile
    • http://
Root On Sd
« Reply #7 on: August 16, 2005, 09:40:35 am »
Quote
more simple answers:
1. do you have a opie.img file ready for download?
2. is there a GPE.img ready for DL?
CoreDump had an oz3.5.3-opie-gpe-ext2loop image that worked very well in both gui's... but it dosen't appear to be available on his server now. You could ask him if he would put it up for you... it's 16.5MBs gzipped (70MBs extracted).
Quote
3. when I did: dd of=opie.img if=/dev/zero bs=1024 count=150000 on a 512Mb SD I got: out of space.
I df and see root is 100% full
Your trying to create a 147.9289940828402 MB file.
Try count=148480 for a 145 MB file or something like that.  

Greg

niv

  • Full Member
  • ***
  • Posts: 237
    • View Profile
Root On Sd
« Reply #8 on: August 16, 2005, 10:51:54 am »
problem was that my current path was /
I think the guide needs to say - you need to be at /media/card to do the dd command.

any chance to copy it to the wiki - and revise?
where to put it in the wiki?

CoreDump

  • Hero Member
  • *****
  • Posts: 713
    • View Profile
    • http://www.hentges.net
Root On Sd
« Reply #9 on: August 16, 2005, 11:01:19 am »
Why so comlicated?

bs=1M count=$SIZE_IN_MEGABYTES
Webmaster of hentges.net & Embedded Linux Developer.

niv

  • Full Member
  • ***
  • Posts: 237
    • View Profile
Root On Sd
« Reply #10 on: August 16, 2005, 11:46:03 am »
ok, I ran install_init.sh and I now see that I did'nt need it - cause hentges roms has it already :-/

do I still need to run copy_files.sh <location> ?
Code: [Select]
#!/bin/sh

if [ $# -eq 0 ]
then
    echo "Usage: $0 "
    exit
fi

NEWROOT=$1

# if you want to link the home folder comment in the next line this will
# speed up writes to your home folder because it is on internal memory,
# however you are now dependent on internal memory.  This was more of an
# issue for pre-3.5.1 releases as 3.5.1 runs much faster.
#HOMELINK="yes"

# add folders here that you want to create on the new file system instead of copying
CREATELIST="/var /proc"


# you shouldn't need to modify below here

for FOLDER in /*
do
    # these are the exceptions
    if [ "$FOLDER" = "/dev" ]
    then
  # for /dev we need to move the ramdisk out of the way and copy the files in the actual folder
  echo "Copying $FOLDER"
  mkdir /dev.tmp
  mount -o move /dev /dev.tmp
  cp -a /dev /$NEWROOT/
  mount -o move /dev.tmp /dev
  rmdir /dev.tmp

    elif [ "$FOLDER" = "/home" ]
    then
  # /home can be either linked or copied
  if [ "$HOMELINK" = "yes" ]
  then
      echo "Linking $FOLDER"
      ln -s /media/realroot/"$FOLDER" /$NEWROOT/"$FOLDER"
  else
      echo "Copying $FOLDER"
      cp -a "$FOLDER" /$NEWROOT/
  fi

    elif [ "$FOLDER" = "/media" ]
    then
  # the media folder is a special case because we want to create the folder and
  # its immediate subfolders, but not more than that
  echo "Creating $FOLDER"
  mkdir /$NEWROOT/"$FOLDER"
  
  for MFOLDER in "$FOLDER"/*
  do
      echo "Creating $MFOLDER"
      mkdir /$NEWROOT/"$MFOLDER"
  done    

    elif [ "$FOLDER" = "/mnt" ]
    then
  # we create the /mnt folder, test for links, copy them, and then create folders
  echo "Creating $FOLDER"
  mkdir /$NEWROOT/"$FOLDER"
  
  for MFOLDER in "$FOLDER"/*
  do
      # copy the links
      if [ -L "$MFOLDER" ]
      then
    echo "Copying $MFOLDER"
    cp -a "$MFOLDER" /"$NEWROOT"/"$FOLDER"
      else
    echo "Creating $MFOLDER"
    mkdir /$NEWROOT/"$MFOLDER"
      fi
  done    

    else
  # check to see if this folder is in our create list
  for CFOLDER in $CREATELIST
  do
      if [ "$CFOLDER" = "$FOLDER" ]
      then  
    echo "Creating $FOLDER"
    mkdir /$NEWROOT/"$FOLDER"
      fi
  done

  # if it has not been created (i.e. it is not
  # in the create list) than copy it
  if [ ! -e "/$NEWROOT/$FOLDER" ]
  then
      echo "Copying $FOLDER"
      cp -a "$FOLDER" /$NEWROOT/
  fi
    fi
done
      
if [ -f /$NEWROOT/sbin/init.org ]
then
    echo "Cleaning up"
    mv /$NEWROOT/sbin/init.org /$NEWROOT/sbin/init
    rm /$NEWROOT/etc/rboot.conf
fi
« Last Edit: August 16, 2005, 11:46:33 am by niv »

niv

  • Full Member
  • ***
  • Posts: 237
    • View Profile
Root On Sd
« Reply #11 on: August 16, 2005, 11:56:46 am »
BUG: if I say no at: Do you want to search for cardfs image now? - it asks for target over and over

I created an image on a fat SD. mounted it and tried to run carsfs. I can't have it install to /mnt/image

I think I must mkfs.ext2 /dev/mmcda1 , then run cardfs,
make the image on the CF and move all to there.

right?
« Last Edit: August 16, 2005, 12:00:14 pm by niv »

CoreDump

  • Hero Member
  • *****
  • Posts: 713
    • View Profile
    • http://www.hentges.net
Root On Sd
« Reply #12 on: August 16, 2005, 02:30:30 pm »
Quote
BUG: if I say no at: Do you want to search for cardfs image now? - it asks for target over and over

I created an image on a fat SD. mounted it and tried to run carsfs. I can't have it install to /mnt/image

I think I must mkfs.ext2 /dev/mmcda1 , then run cardfs,
make the image on the CF and move all to there.

right?
[div align=\"right\"][a href=\"index.php?act=findpost&pid=92039\"][{POST_SNAPBACK}][/a][/div]

I'll check for that bug.
The installer parses /etc/ipkg.conf and checks for destinations beside "dest root"
As a workaround you could enter a destination pointing to the mountpoint of your image file.

I'll think about adding a "Custom Destination" menu entry.
Webmaster of hentges.net & Embedded Linux Developer.

niv

  • Full Member
  • ***
  • Posts: 237
    • View Profile
Root On Sd
« Reply #13 on: August 16, 2005, 02:33:11 pm »
you mean:
umount /dev/mmcda1
mount -t ext2 /dev/loop0 /media/cf ?

CoreDump

  • Hero Member
  • *****
  • Posts: 713
    • View Profile
    • http://www.hentges.net
Root On Sd
« Reply #14 on: August 16, 2005, 03:03:49 pm »
Quote
you mean:
umount /dev/mmcda1
mount -t ext2 /dev/loop0 /media/cf ?
[div align=\"right\"][a href=\"index.php?act=findpost&pid=92057\"][{POST_SNAPBACK}][/a][/div]

Mounting the loop-image to /media/cf would work, too.
I was however suggesting to edit /etc/ipkg.conf and add the mountpoint of your loop-image as a "dest".

Your solution is quicker though  
Webmaster of hentges.net & Embedded Linux Developer.