- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hi all:
I want to update some files( for example: rework the prime IP setting in `etc/inittab) when the nios2 uclinux is running. Then reset the DVB, the uclinux will confing the system bases the updated inittab file. I think to I can use these function :file_open, file_read, file_write to rework the file of I want to rework. But the nios2 uclinux is ramfs,so the file just a allude file. The fact file is stored in flash. Can I rework the fact file ? If can, how can I do? Who can give me some advice? Thanks a lot.Link Copied
12 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
you may try jffs2 on cfi flash or epcs.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- originally posted by hippo@Jul 27 2006, 09:57 AM you may try jffs2 on cfi flash or epcs.
<div align='right'><{post_snapback}> (index.php?act=findpost&pid=17195)
--- quote end ---
--- Quote End --- Thanks reply. Can you give me some hint to help me try jffs2 on cfi flash? I want to use the kernel version is 2.6.x .I can't open the web Check the very nice guide from Jdhar, http://via.dynalias.org/svn/uclinux/doc/trunk/epcs-ug.pdf (http://via.dynalias.org/svn/uclinux/doc/trunk/epcs-ug.pdf) who can post the pdf to me use email ? Thanks a lot.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- originally posted by alex824+jul 28 2006, 11:21 am--><div class='quotetop'>quote (alex824 @ jul 28 2006, 11:21 am)</div>
--- quote start ---
<!--quotebegin-hippo@Jul 27 2006, 09:57 AM you may try jffs2 on cfi flash or epcs.
<div align='right'><{post_snapback}> (index.php?act=findpost&pid=17195)
--- quote end ---
--- Quote End --- Thanks reply. Can you give me some hint to help me try jffs2 on cfi flash? I want to use the kernel version is 2.6.x .I can't open the web Check the very nice guide from Jdhar, http://via.dynalias.org/svn/uclinux/doc/trunk/epcs-ug.pdf (http://via.dynalias.org/svn/uclinux/doc/trunk/epcs-ug.pdf) who can post the pdf to me use email ? Thanks a lot. <div align='right'><{post_snapback}> (index.php?act=findpost&pid=17209)</div> [/b] --- Quote End --- updated link, http://www.fps-tech.net/ (http://www.fps-tech.net/)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote End --- updated link, http://www.fps-tech.net/ (http://www.fps-tech.net/) <div align='right'><{post_snapback}> (index.php?act=findpost&pid=17210)</div> --- Quote End --- Thanks I got it. I following guide : +++++++++++++++++++++++++++++++++++++++++++++++++++++ Or if you use cfi flash, in kernel menuconfig, Memory Technology Devices (MTD) --> <*> Memory Technology Device (MTD) support [*] MTD partitioning support <*> Direct char device access to MTD devices <*> Caching block device access to MTD devices RAM/ROM/Flash chip drivers --> [*] Detect flash chips by Common Flash Interface (CFI) probe [*] Detect non-CFI AMD/JEDEC-compatible flash chips [*] Support for AMD/Fujitsu flash chips (3) Retry failed commands (erase/program) Mapping drivers for chip access --> [*] Maps for Altera Nios Development Kit File systems --> Miscellaneous filesystems --> <*> Journalling Flash File System v2 (JFFS2) support Then rebuild the kernel, and boot nios2 uclinux. It should display jffs2 support and detect mtd partitions. +++++++++++++++++++++++++++++++++++++++++++++++++++++ Then I rebuild zImage and use nios2-download -g zImage to download my DVB, I did not program the zImage to dvb flash. When nios2-download is complete , display boot information: +++++++++++++++++++++++++++++++++++++++++++++++++++++ Altera Nios II support © 2004 Microtronix Datacom Ltd. setup_arch: No persistant network settings signature at 007F0000 Built 1 zonelists Kernel command line: PID hash table entries: 128 (order: 7, 2048 bytes) Dentry cache hash table entries: 4096 (order: 2, 16384 bytes) Inode-cache hash table entries: 2048 (order: 1, 8192 bytes) Memory available: 13824k/16384k RAM, 0k/0k ROM (1329k kernel code, 1039k data) Mount-cache hash table entries: 512 (order: 0, 4096 bytes) NET: Registered protocol family 16 JFFS2 version 2.2. © 2001-2003 Red Hat, Inc. NIOS serial driver version 0.0 ttyS0 (irq = 2) is a builtin NIOS UART ttyS1 (irq = 5) is a builtin NIOS UART ttyS2 (irq = 6) is a builtin NIOS UART io scheduler noop registered io scheduler deadline registered smc_probe: 50000 Khz Nios SMSC LAN91C111 Driver (v2.1), (Linux Kernel 2.6) eth0: SMC91C11xFD(rev:1) at 0x80800300 IRQ:3 MEMSIZE:8192b NOWAIT:0 ADDR: 00:07:ed:00:00:00 smc_probe: 50000 Khz Nios Altera NDK flash (AMD): Found 1 x8 devices at 0x0 in 8-bit bank Amd/Fujitsu Extended Query Table at 0x0040 Altera NDK flash (AMD): CFI does not contain boot bank location. Assuming top. number of CFI chips: 1 cfi_cmdset_0002: Disabling erase-suspend-program due to code brokenness. cmdlinepart partition parsing not available RedBoot partition parsing not available Using Altera NDK partition definition Creating 4 MTD partitions on "Altera NDK flash (AMD)": 0x00200000-0x00600000 : "romfs/jffs2" 0x00000000-0x00200000 : "loader/kernel" 0x00600000-0x00700000 : "User configuration" 0x00700000-0x00800000 : "safe configuration" NET: Registered protocol family 2 IP: routing cache hash table of 512 buckets, 4Kbytes TCP established hash table entries: 1024 (order: 1, 8192 bytes) TCP bind hash table entries: 1024 (order: 0, 4096 bytes) TCP: Hash tables configured (established 1024 bind 1024) NET: Registered protocol family 1 NET: Registered protocol family 17 Freeing unused kernel memory: 928k freed (0x115a000 - 0x1241000) init started: BusyBox v1.1.1-pre0 (2006.05.18-03:02+0000) multi-call binary eth0:PHY 100BaseT eth0:PHY Full Duplex BusyBox v1.1.1-pre0 (2006.05.18-03:02+0000) Built-in shell (msh) Enter 'help' for a list of built-in commands. # +++++++++++++++++++++++++++++++++++++++++++++++++++++ Then I use mount cmd: +++++++++++++++++++++++++++++++++++++++++++++++++++++# mount -t jffs2 /dev/mtdblock0 /mnt Eep. No valid nodes for ino# 1# +++++++++++++++++++++++++++++++++++++++++++++++++++++ I mount faile. Why? How can I solve it? Thanks a lot!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
first, erase the flash with nios2-flash-programmer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- originally posted by hippo@Jul 28 2006, 12:15 AM first, erase the flash with nios2-flash-programmer.
<div align='right'><{post_snapback}> (index.php?act=findpost&pid=17214)
--- quote end ---
--- Quote End --- I erase the flash completd . but still mount failed. # mount -t jffs2 /dev/mtdblock0 /mnt Eep. No valid nodes for ino# 1# I did not Config kernel command string "root=/dev/mtdblock0 rw rootfstype=jffs2" and not use mkfs.jffs2 to build the rootfs image. Is it the mount fail reson? how can I do? Thanks a lot!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
you should not set root=/dev/mtdblock0 at this time. you need to let jffs2 work first.
check if the drivers/mtd/maps/altera.c have the correct map for your board. check the info of mtd from /sys/block . try write and read from the mtd device, eg use "dd" . if the mtd is erased, jffs2 will format it. or you can make jffs2 image .- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Why I did not find the /sys/block in kernel 2.6.x dir?
Where is it?- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- originally posted by alex824@Jul 29 2006, 02:45 PM why i did not find the /sys/block in kernel 2.6.x dir?
where is it?
<div align='right'><{post_snapback}> (index.php?act=findpost&pid=17244)
--- quote end ---
--- Quote End --- /sys is a runtime info in the nios2 linux, just like /proc. it is not in the source tree. Jdhar's site is updated, http://www.fps-tech.net/ (http://www.fps-tech.net/) what do you mean you can not save to mtd? mtd block can be used as any other block dev. try, dd count=8 if=some_source_file of=/dev/mtdblock0 sync power off, and reboot, dd count=8 if=/dev/mtdblock0 of=out_file but I think most problem should be at the mtd map file. then check the content of out_file with the source_file.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks hippo, I can r/w file on mtdblock0 and save it.
follow is my example: 1) crate a blank text file In ~/rootfs/etc . Rename the file to you wanted. 2)rebuild the zImage and reboot. 3)dd count=1 if=some_source_file of=/dev/mtdblock0 You have crated a jffs2 file after this step. Then you can add c code as following demo code to your APP. So you can r/w and save your jffs2 file. In jffs2 file you can save IP address, informaion,......... # include <fcntl.h> int main(void) { int ret; int fd; chdir("/"); char buffer[10] ={'H','e','l','l','o','j','f','f','s','2'}; ret = system("dd count=1 if=/dev/mtdblock0 of=test_config"); if((fd = open("test_config", O_WRONLY)) == -1) { printf("cannot open file. \n"); exit(1); } if(write(fd,buffer,10) != 10) { printf("write error"); } fclose(fd); ret = system("dd count=1 if=test_config of=/dev/mtdblock0"); return 0; }- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
good.
the mtd block is working. now you can try erase again and mount jffs2 on it.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- originally posted by hippo@Jul 31 2006, 09:00 AM good.
the mtd block is working.
now you can try erase again and mount jffs2 on it.
<div align='right'><{post_snapback}> (index.php?act=findpost&pid=17286)
--- quote end ---
--- Quote End --- I use "# mount -t jffs2 /dev/mtdblock0 /mnt" but the erro information is: +++++++++++++++++++++++++++++++++++++++++++++++++++++# mount -t jffs2 /dev/mtdblock0 /mnt jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00000000: 0x6548 in stead jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00000004: 0x6a6f in stead jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00000008: 0x3273 in stead jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0000000c: 0x7473 in stead jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00000010: 0x6c69 in stead jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00000014: 0x3a0a in stead jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00000018: 0x6e69 in stead jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0000001c: 0x0a68 in stead jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00000020: 0x6d65 in stead jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00000024: 0x783a in stead Further such events for this erase block will not be printed Eep. No valid nodes for ino# 1# +++++++++++++++++++++++++++++++++++++++++++++++++++++ why?

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