- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi!
I'm working with nios2 nommu and I have a 8 MB SDRAM and 8 MB CFI FLASH. For create a filesystem in a flash I create a kernel with a miminal service (without network and webserver) to start and copy all the files in ram to flash, in my rc the configuration is
hostname uClinux
mount -t proc proc /proc -o noexec,nosuid,nodev
mount -t sysfs sysfs /sys -o noexec,nosuid,nodev
mount -t devpts devpts /dev/pts -o noexec,nosuid
mount -t jffs2 /dev/mtdblock0 /mnt
mkdir /mnt/mnt
mkdir /mnt/proc
mkdir /mnt/sys
mkdir /mnt/tmp
mkdir /mnt/var/
mkdir /mnt/var/tmp
mkdir /mnt/var/log
mkdir /mnt/var/run
mkdir /mnt/var/lock
mkdir /mnt/var/empty
cp -a /bin /mnt
cp -a /dev /mnt
cp -a /etc /mnt
cp -a /home /mnt
cp -a /init /mnt
cp -a /lib /mnt
cp -a /sbin /mnt
cp -a /usr /mnt
cp /home/rc /mnt/etc
But when my image is larger then 2 MB (when my romfs is a little bigger) I have problem to write on flash memory, when the kernel try copy the /home to /mnt the RAM "crash" I have a message with stack trace call. Somebody knows a best pratice to write the files system on flash (for production)? There's a way to create a .FLASH or .BIN of a initramfs_data.cpio.gz to write on flash directly by jtag or u-boot? Thank you very much. Caio Pereira Caio Pereira
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I got write the filesystem in my flash , but this method has some problems yet.
1) Download the mtd-utils (for mkfs.jffs2) In my case (Ubuntu) sudo apt-get install mtd-utils 2) Generate a romfs in a uClinux-dist make romfs 3)Generate a device_table (like a romfs_list file in /vendor/Altera/nios) In the romfs_list we have something like this# Device Name mode uid gid type major minor /dev/tty 666 0 0 c 5 0 /dev/kmem 640 0 0 c 1 2 /dev/mtd0 640 0 0 c 90 0 /dev/mtd1 640 0 0 c 90 2 /dev/mtd2 640 0 0 c 90 4 In the device_table we need write in another mode like# <name> <type> <mode> <uid> <gid> <major> <minor> <start> <inc> <count># where name is the file name, type can be one of: # f A regular file# d Directory# c Character special device file# b Block special device file# p Fifo (named pipe) /dev/mem c 640 0 0 1 1 0 0 - /dev/kmem c 640 0 0 1 2 0 0 - /dev/null c 640 0 0 1 3 0 0 - /dev/zero c 640 0 0 1 5 0 0 - /dev/random c 640 0 0 1 8 0 0 - /dev/urandom c 640 0 0 1 9 0 0 - /dev/tty c 666 0 0 5 0 0 0 - You need change this file for your system and save with device_table.txt (this is normal for nios linux with mmu) 4) Creating a file system We would create this file in nios2-linux/uClinux-dist/image mkfs.jffs2 -l -e128KiB -p -d ../romfs -D device_table.txt -o rootfs.jffs2 This file is ready to write by bootloader After this we have a rootfs.jffs2 file , but this process ins't ok, I having problem with erase_block size Node at 0x0020ff20 with length 0x000008b1 would run over the end of the erase bk Perhaps the file system was created with the wrong erase size? jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0020ff24: 0x08b1 id jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0020ff28: 0x4c30 id 5) Burning flash In my case I'm using jtag My CFI flash is partitioned: Creating 2 MTD partitions on "physmap-flash.0": 0x000000200000-0x000000800000 : "romfs/jffs2" 0x000000000000-0x000000200000 : "loader/kernel" For convert binary file to .srec file we need use a bin2flash tool: bin2flash --input=rootfs.jffs2 --location=0x200000 --output=rootfs.flash Now we need write the rootfs.flash in CFI flash using nios2-flash-programmer tool nios2-flash-programmer --base=0x2000000 rootfs.flash After this we boot with a kernel image monting a jffs2 When I get fix my problem with erase_block I return with another reply with the fix
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page