• Home
  • Help
  • Search
  • Login
  • Register
Pages: [1]
Author Topic: Saving rootfs changes  (Read 1362 times)
jdonth
Jr. Member
**

Karma: 0
Posts: 75

Azle, Texas


View Profile
« on: June 20, 2009, 08:25:22 AM »

I am using the *great* SheevaPlug installer (alpha-6).

After I make modifications to the "original" rootfs that came with the installer (such as adding packages, etc.), how can I "repackage" the updated rootfs on the SheevaPlug into a new rootfs.tar.gz that I can use with the installer to create another "clean" plug without having to re-install all the changes again?

The exact tar command (or sequence) to do this would be greatly appreciated.

~Joe
Logged

...I've always depended on the kindness of strangers

plugger
Newbie
*

Karma: 0
Posts: 10


View Profile
« Reply #1 on: June 21, 2009, 01:41:46 PM »

I haven't used the installer, so I'm not sure what's going on with your current configuration. But nobody's answered you yet so here's a low quality response on how to .tar.gz a root folder.

In general if you're trying to archive a filesystem with tar, what you want to do is something like

tar -cX my_rootfs.tar.gz / | gzip -c > ./my_rootfs.tar.gz

The "X my_rootfs.tar.gz" part is an exclude filter to avoid trouble when tar encounters the ultimate my_rootfs.tar.gz file that gzip is streaming to the disk within the same process. It's just to be safe; I'm not sure if that's an issue or not.

Keep in mind tar isn't really good for this because it doesn't include the /dev directory. I don't know if that's a problem for what you're trying to do. Maybe you haven't messed with it at this point.

If you're into cloning plugs and don't mind spending a few bucks extra per plug (plus having something sticking out of it), a better approach is probably just to buy an SD card for each plug, copy your root folder from the NAND into each SD card, and then have all of them boot from the SD. You'd basically be following the first half of the instructions in this FAQ:

http://www.openplug.org/plugwiki/index.php/SD_Card_As_Root_File_System#Create_a_bootable_file_system_on_the_SD_card

On the source plug (after messing around in the NAND filesystem as needed) you would mount the SD as /dev/sda1 and copy your root filesystem recursively starting with / from the NAND into the mount point, using cp -ax. Then copy the /dev folder (without the -x argument) to the mount point. Unplug, pop out the SD card, put a new one back in, plug, fdisk (using ext2), mkdir, mkfs, mount, cp -ax, cp -a, repeat. Pump out as many SD cards as you need for all your plugs.

Now you've got to have them all boot off the SD cards, maybe including your source plug if you have an SD for it, so follow the second batch of instructions:

http://www.openplug.org/plugwiki/index.php/SD_Card_As_Root_File_System#Booting_from_the_SD_Card

You have to screw with uboot on each plug to prioritize the SD card over the NAND when booting. Plug your USB into the little slave USB port, run whatever unpleasant USB-serial drivers / terminal stuff you need to on the host system, reboot the card from SSH using shutdown -r now, hit ENTER like it says, and get to the Marvell>> prompt. (Make sure you can do this before buying 10 SD cards off Amazon.) Edit the bootargs variable as described, on each plug, then plug them all in and you've got cloned plugs with filesystems on SD instead of NAND.

Lots of people have trouble with certain cards. I used a Kingston 8GB SDHC
Logged

plugger
Newbie
*

Karma: 0
Posts: 10


View Profile
« Reply #2 on: June 21, 2009, 02:05:33 PM »

Hmmm... it seems I hit Ctrl instead of Shift while typing and all that crap got posted before I finished.

I was going to say you could do all this stuff with no SD cards, just a single USB drive (or SD)- loosely following the first half of the FAQ, the second half, then the first half again only backwards. Copy the NAND onto the USB drive. Take the drive to the second plug, move USB ahead of NAND in boot order there, boot up into your USB drive, mount the NAND from its /dev handle to some mount point in your filesystem, then blow everything away on the NAND before copying the whole USB root folder and its /dev back into the NAND. If you aren't going to have bootable USB drives attached to your cloned plug, you can unplug the USB at this point and you're finished, otherwise go to uboot again and undo what you did before so that the NAND is prioritized.

Maybe the installer's really nice and it's easier just to repeat what you did in the UI each time, who knows.
Logged

restamp
Global Moderator
Sr. Member
*****

Karma: 4
Posts: 273


View Profile
« Reply #3 on: June 21, 2009, 07:50:19 PM »

I used the following technique to get the root filesystem off the sheevaplug, although I am operating with an SDcard rather than the internal NAND, and I frankly must admit I haven't tried this with the NAND.  I used 'nc':  On a remote linux box on my local LAN, (let's say it's at address 192.168.0.100) I ran the command
Code:
nc -l -p 2345 >mmcblk0p1
Then on the SheevaPlug, I ran the command
Code:
nc 192.168.0.100 2345 </dev/mmcblk0p1
This transferred the entire root fs image to the remote box, and it did it rather speedily at that.  I could then "mount -o loop mmcblk0p1 /mnt/sheevaroot", make any changes (or do a quick tar+gzip), "umount /mnt/sheevaroot", and have a fs image for backup or to put wherever I wanted for installation elsewhere.  The other advantage to this approach is that you get the true contents of the root fs, including the files that underlie the mount points, instead of all the various /proc and /var temp files from the pseudo-fs's that are overlayed on it.   YMMV, but you might try substituting /dev/mtdblock1 for /dev/mmcblk0p1.  Of course, what you'll get will be a jffs2 image instead of the (in my case) ext2.

I will mention that I also tried it the other way, too -- dd'ing and nc'ing an ext2 fs to a spare partition on my SDcard -- and it failed miserably.  I don't know why, but it quickly ground to a halt, making essentially no progress after the first few 100k.

Logged

jdonth
Jr. Member
**

Karma: 0
Posts: 75

Azle, Texas


View Profile
« Reply #4 on: June 22, 2009, 09:06:16 AM »

Thanks plugger and restamp.

I'll play around with your ideas and post if I have any real success.

Logged

...I've always depended on the kindness of strangers

Pages: [1]
Print
Jump to: