• Home
  • Help
  • Search
  • Login
  • Register
Pages: [1]
Author Topic: SDroot vs mount  (Read 2749 times)
karurosu
Global Moderator
Full Member
*****

Karma: 0
Posts: 116



View Profile WWW
« on: April 21, 2009, 07:14:11 PM »

I was wondering, would there be a difference between using the SD card for root, to just mounting it somewhere (AFAIK /usr is the best place)?

I am thinking about the memory to buy, and I think a 4 gb USB and some big USB (8 gb maybe). Use the SD to store programs and software and the USB for external storage (probably at mnt)

What do you think?
Logged

karurosu
Global Moderator
Full Member
*****

Karma: 0
Posts: 116



View Profile WWW
« Reply #1 on: April 30, 2009, 09:22:21 PM »

I have a couple of related questions, first of all, where is the kernel image supposed to be stored?
As far as I understand looking at the documentation and tutorials the image should be flashed to mtdblock1.
Now, as I see it, the other image should go to mtdblock2, if you use an USB or a SD you can skip this step.
I want to use the 512 on the NAND for something (mainly /etc and /bin) and the SD for the heavy stuff (/usr for apps and portage, /var for portage compile dir, and the /mnt/sd for storage).

My plan is to do something like this:
1) Format mtdblock2 somehow to jffs2 and mount it as root.
2) Format a SD with ext3 and mount it at /mnt/root
3) Bind /usr to /mnt/sd/usr and /var to /mnt/sd/var
4) Compile, install gentoo.
5) Flash the kernel uImage to mtdblock1. Configure uboot.
6) Boot using mtdblock2 as root, but modify fstab to mount (and bind) the SD.

The only step that I am not sure if its possible is 2.
What do you think? Is this setup possible?

Thanks.
Logged

Raśl Porcel
Global Moderator
Jr. Member
*****

Karma: 0
Posts: 68


View Profile
« Reply #2 on: May 01, 2009, 05:25:52 AM »

There wouldn't be any difference, just that you'll be using two different storage systems.

The kernel can be wherever you want it to be, just put it in a place where U-Boot is able to access it. ATM the (official) U-boot in the plug doesn't support SD. You can put it on a TFTP server, mtdblock1, USB, etc...

As for if its possible, looks correct to me.
Logged

kilowatt
Global Moderator
Full Member
*****

Karma: 3
Posts: 106


View Profile
« Reply #3 on: May 01, 2009, 05:33:19 AM »

The file system is usually in the third partition of the Flash.  Since the flash doesn't really have a partition table, we need to tell the kernel where the partition boundaries are.  Once we have decided on the partition sizes we want to use we must be consistent in what we tell the kernel.  If we decide to change the partition size and thus the boundaries we will need to rewrite the images stored in the effected partition. you could come up with a partition scheme that had a large second partition for the file system and a small third partition for the kernel.  Your bootargs and bootcmd would need to change to match what you are using.  I think the u-boot always needs to be in the first flash partition.

Some configurations are telling the kernel about all three partitions of the flash through the bootargs ie:
mtdparts=nand_mtd:0x100000@0x000000(u-boot)ro,0x400000@0x100000(uImage),0x1fb00000@0x500000(rootfs)

Some are telling the kernel about just two ie:
mtdparts=nand_mtd:0x400000@0x100000(uImage)ro,0x1fb00000@0x500000(rootfs)

The format here is a list of size@starting location(name)[ro]

 The kernel enumerates them in the order shown so if the rootfs is in the third partition the kernel is told about it will be /dev/mtdblock2.
If rootfs is the second one in the bootargs it will be /dev/mtdblock1.

The reason we don't always tell the kernel about the u-boot partition is to make it really difficult for the kernel to access it.  That way we don't corrupt it with a typo.  The 'ro' shown in these two examples tells the kernel to make the partition read only which is another safeguard against writing to it by mistake.

Note in the second example the 'ro' on the kernel partition will make it impossible to rewrite the kernel.  We would need to reboot with different bootargs in order to change the kernel.  Setting the rootfs partition to ro would probably not work well.

Mark
Logged

karurosu
Global Moderator
Full Member
*****

Karma: 0
Posts: 116



View Profile WWW
« Reply #4 on: May 01, 2009, 11:33:29 AM »

Hey, thanks for the info.
Just a question, these mtdparts are kernel parameters or uboot?
And yeah, my objective is to use 2 storage, first because I dont want to waste the 512 of internal memory and second because as you said SD booting is not supported and I want to use my SD for root.

 
Logged

kilowatt
Global Moderator
Full Member
*****

Karma: 3
Posts: 106


View Profile
« Reply #5 on: May 01, 2009, 11:52:50 AM »

the mtdparts=.... is part of your u-boot bootargs and are passed to the kernel as it command line arguments.

For instance if in u-boot my bootargs looks like this.

bootargs=console=ttyS0,115200 mtdparts=orion_nand:0x100000@0x000000(u-boot)ro,0x400000@0x100000(uImage),0x1fb00000@0x500000(rootfs) rw root=/dev/sda1 rootdelay=10

If i run dmesg after boot and search for the kernel command line I see:

Kernel command line: console=ttyS0,115200 mtdparts=orion_nand:0x100000@0x000000(u-boot)ro,0x400000@0x100000(uImage),0x1fb00000@0x500000(rootfs) rw root=/dev/sda1 rootdelay=10

By the way this boots with my root file system on the first partition of my usb 2.0 harddrive.
Logged

karurosu
Global Moderator
Full Member
*****

Karma: 0
Posts: 116



View Profile WWW
« Reply #6 on: May 01, 2009, 12:38:02 PM »

Thanks again for the information.
Just one question left: whats the difference between orion_nand and nand_mtd?
Logged

kilowatt
Global Moderator
Full Member
*****

Karma: 3
Posts: 106


View Profile
« Reply #7 on: May 01, 2009, 12:58:07 PM »

if you move to a kernel built from mail line kernel source as opposed to the ones supplied from Marvell you need to switch from using nand_mtd to orion_nand.  It is based on the name the kernel understands to be the flash device.  There are two other u-boot parameters that need to also change if you move to a main line kernel.  They are posted a number of times in this forum under the kernel discussions.
Logged

Pages: [1]
Print
Jump to: