| Welcome to AT91SAM Community Forum http://www.at91.com/samphpbb/ |
|
| Changing the Filesystem (Jffs2) location in NAND Flash http://www.at91.com/samphpbb/viewtopic.php?f=12&t=20563 |
Page 1 of 1 |
| Author: | maguirre [ Mon Dec 12, 2011 7:14 am ] |
| Post subject: | Changing the Filesystem (Jffs2) location in NAND Flash |
Hello everyone I am a bit of a newbie at this, so bear with me please. I am looking for help on how to change the location in flash that the kernel expects the filesystem to be at I am working with a SAM9M10-G45-EK dev board and I have been following the directions outlined http://www.at91.com/linux4sam/bin/view/ ... inuxKernel to get linux running on this board. Things have been working according to plan and I've been able to create/configure my own linux image which I have been able to load via tftp and I have been able to run successfuly. Up to this point I have been putting everything; bootstrap, uboot, linux kernel and filesystem in NANDflash. Because I have been adding packages to the linux distribution the kernel image has grown to the point where the size of the kernel overruns the memory address where the example in the demo (http://www.at91.com/linux4sam/pub/Linux ... sh_map.png) stores the filesystem. and therefore I have needed to push the flash address of the filesystem. Pushing up the filesystem allows me the run linux once (and only once) and when I do that it appears that linux is expecting the filesystem to be at the original address and therefore overwrites the flash location of the kernel. The flash original memory map looked like this : set bootStrapAddr 0x00000000 set ubootAddr 0x00020000 set ubootEnvAddr 0x00060000 set kernelAddr 0x00200000 set rootfsAddr 0x00400000 The new memory map looks like this: bootStrapAddr 0x00000000 ubootAddr 0x00020000 ubootEnvAddr 0x00060000 kernelAddr 0x00200000 rootfsAddr 0x00600000 How can I tell Linux that rootfsAddr has been shifted? Thanks in advance for your help |
|
| Author: | CptTitanic [ Mon Dec 12, 2011 6:44 pm ] |
| Post subject: | Re: Changing the Filesystem (Jffs2) location in NAND Flash |
You'll need to edit/patch the mtd_partition table. Here's the one used on the 9G20 http://tomoyo.sourceforge.jp/cgi-bin/lx ... am9g20ek.c |
|
| Author: | maguirre [ Mon Dec 12, 2011 8:21 pm ] |
| Post subject: | Re: Changing the Filesystem (Jffs2) location in NAND Flash |
Thanks for your response. I am bit confused though. During bootup I see the message 3 cmdlinepart partitions found on MTD device atmel_nand Creating 3 MTD partitions on "atmel_nand": 0x000000000000-0x000000400000 : "bootstrap/uboot/kernel" 0x000000400000-0x000004000000 : "rootfs" 0x000004000000-0x000010000000 : "data" As a disclaimer I am passing the following boot arguments too bootargs=mem=64M console=ttyS0,115200 mtdparts=atmel_nand:4M(bootstrap/uboot/kernel)ro,60M(rootfs),-(data) root=/dev/mtdblock1 rw rootfstype=jffs2 which clearly is different from what I see in the file /linux-2.6.30/arch/arm/mach-at91/board-sam9m10g45ek.c /* * NAND flash */ static struct mtd_partition __initdata ek_nand_partition[] = { { .name = "Partition 1", .offset = 0, .size = SZ_64M, }, { .name = "Partition 2", .offset = MTDPART_OFS_NXTBLK, .size = MTDPART_SIZ_FULL, }, }; Do the boot arguments override what's in the driver file? Which one should I be modifying? |
|
| Author: | CptTitanic [ Tue Dec 13, 2011 3:56 am ] |
| Post subject: | Re: Changing the Filesystem (Jffs2) location in NAND Flash |
Evidently it is taking the ones from the command line. I'm not using them and it's taking it from the table I mentioned. So how is it failing the second time around, not loading linux at all, or is JFFS2 destroying itself and not mounting? |
|
| Author: | maguirre [ Tue Dec 13, 2011 6:44 am ] |
| Post subject: | Re: Changing the Filesystem (Jffs2) location in NAND Flash |
Thanks for reply again. I really appreciate you taking the time to answer my questions. The second time around things seem to be working because I ended up changing my flash memory map to look like the following: Currently bootStrapAddr 0x00000000 ubootAddr 0x00020000 ubootEnvAddr 0x00060000 kernelAddr 0x00080000 <- Shifted this address down rootfsAddr 0x00400000 Previously bootStrapAddr 0x00000000 ubootAddr 0x00020000 ubootEnvAddr 0x00060000 kernelAddr 0x00200000 <- Shifted this address down rootfsAddr 0x00400000 in Uboot I am passing the following arguments to linux: bootargs=mem=64M console=ttyS0,115200 mtdparts=atmel_nand:4M(bootstrap/uboot/kernel)ro,60M(rootfs),-(data) root=/dev/mtdblock1 rw rootfstype=jffs2 This apparently creates 3 partitions which I look like the following: $# cat /proc/mtd dev: size erasesize name mtd0: 00400000 00020000 "bootstrap/uboot/kernel" mtd1: 03c00000 00020000 "rootfs" mtd2: 0c000000 00020000 "data" and ~# df -h Filesystem Size Used Available Use% Mounted on /dev/root 60.0M 40.1M 19.9M 67% / tmpfs 40.0K 0 40.0K 0% /mnt/.psplash none 30.0M 68.0K 30.0M 0% /dev tmpfs 30.0M 244.0K 29.8M 1% /var/volatile tmpfs 30.0M 0 30.0M 0% /dev/shm tmpfs 30.0M 0 30.0M 0% /media/ram How I am still confused. When I create files they are added to the mtd1 partition and not to the "data" partition. Does anyone know why or if there is a need for the "data" partition to be the biggest yet it doesn't appear to be getting used at all? Also can I just mount the "data" partition and use it as I am using the "rootfs" partition? Thanks again for your help |
|
| Author: | CptTitanic [ Tue Dec 13, 2011 8:44 pm ] |
| Post subject: | Re: Changing the Filesystem (Jffs2) location in NAND Flash |
You'd need to format and mount the "data" partition for it to be used. You could also expand to the size of the "rootfs" partition to use all/more of the 256MB NAND. Not sure of the real purpose of fragmenting it, either making it easier to field update, or challenging you to understand how much space you actually need, and if a smaller NAND will suffice. It might also be an issue of where uboot is physically placed in memory, and how large a single image you can TFTP into SDRAM before writing it to NAND. That's an issue when uboot is placed roughly in the middle of a 128MB SDRAM. |
|
| Page 1 of 1 | All times are UTC + 1 hour [ DST ] |
| Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |
|



Forum