Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++

JFFS2 kernel support

Altera_Forum
Honored Contributor II
2,522 Views

Hello all 

I'm trying to add jffs2 support to a kernel (3c120 dev board) and I'm facing an strange problem. 

If I checked in jffs2 support in menuconfig, _after_ compiling the kernel core and  

_while compiling_ the apps , the compile process barfs 

 

|| ( touch mtd-utils/.sgbuilt_user && make -C mtd-utils ) || exit $? make: se ingresa al directorio `/home/eugenio/uCLinux-MMU/nios2-linux/uClinux-dist/user/mtd-utils' unset CC CFLAGS CPPFLAGS CROSS LDFLAGS; make -C 606f38a2221648ca5c5fa292c9f71d2ddd59fa66/ WITHOUT_XATTR=1 SUBDIRS= BUILDDIR=$PWD/build-606f38a2221648ca5c5fa292c9f71d2ddd59fa66-host/ TARGETS=" mkfs.jffs2" make: se ingresa al directorio `/home/eugenio/uCLinux-MMU/nios2-linux/uClinux-dist/user/mtd-utils/606f38a2221648ca5c5fa292c9f71d2ddd59fa66' mkdir -p /home/eugenio/uCLinux-MMU/nios2-linux/uClinux-dist/user/mtd-utils/build-606f38a2221648ca5c5fa292c9f71d2ddd59fa66-host/ gcc -I./include -DWITHOUT_XATTR -D_FILE_OFFSET_BITS=64 -O2 -g -Wall -Wextra -Wwrite-strings -Wno-sign-compare -c -o /home/eugenio/uCLinux-MMU/nios2-linux/uClinux-dist/user/mtd-utils/build-606f38a2221648ca5c5fa292c9f71d2ddd59fa66-host/compr_lzo.o compr_lzo.c -g -Wp,-MD,/home/eugenio/uCLinux-MMU/nios2-linux/uClinux-dist/user/mtd-utils/build-606f38a2221648ca5c5fa292c9f71d2ddd59fa66-host/.compr_lzo.c.dep compr_lzo.c:29:23: error: lzo/lzo1x.h: No existe el fichero o el directorio compr_lzo.c: In function ‘jffs2_lzo_cmpr’: compr_lzo.c:51: error: ‘lzo_uint’ undeclared (first use in this function) compr_lzo.c:51: error: (Each undeclared identifier is reported only once compr_lzo.c:51: error: for each function it appears in.) compr_lzo.c:51: error: expected ‘;’ before ‘compress_size’ compr_lzo.c:54: warning: implicit declaration of function ‘lzo1x_999_compress’ compr_lzo.c:54: error: ‘compress_size’ undeclared (first use in this function) compr_lzo.c:56: error: ‘LZO_E_OK’ undeclared (first use in this function) The strange thing is that it tries to compile mkfs.jffs2 using my x86 gcc compiler 

:confused: 

If I try to disable mtd-utils, it doesn't mind; same error while compiling mkfs.jffs2 in mtd-utils which I have previously disabled.... 

Adding kernel support for MTD and user apps. support for mtd-utils works fine.  

No errors. It only happens when adding jffs2 kernel support and while compiling mkfs.jffs2 (mtd-utils enabled or not) 

Any hints? 

TIA
0 Kudos
22 Replies
Altera_Forum
Honored Contributor II
838 Views

Hello eyguacel !!!! 

 

i have the same problem.....:(  

do you solve it ????? 

 

tks
0 Kudos
Altera_Forum
Honored Contributor II
838 Views

The solution is here: 

http://www.alterawiki.com/wiki/jffs2_for_linux 

 

So you have to install these mentioned package on your linux desktop system. 

 

Urmel
0 Kudos
Altera_Forum
Honored Contributor II
838 Views

Thanks very much Urmel !!!!!!! \o/ 

 

i have success compiling the kernel .......... 

 

i add this file system in config.c => mtd_partition nios2_partitions[]  

 

.name = "fpga", 

.size = 0x0200000,  

.offset = 0x0, 

}, 

.name = "nios_baremetal", 

.size = 0x0200000,  

.offset = 0x01C00000, 

}, 

.name = "uImage1", 

.size = 0x00400000, 

.offset = 0x02000000, 

}, 

.name = "romfs", 

.size = 0x01400000,  

.offset = 0x04400000, 

 

 

but in uClinux booting i have this problem  

 

physmap platform flash device: 04000000 at 0c000000 

 

physmap-flash physmap-flash.0: map_probe failed 

 

 

do you have any ideia ???????? 

 

 

 

thank you so much !!!!!
0 Kudos
Altera_Forum
Honored Contributor II
838 Views

Hi Franz, 

 

you are welcome. 

 

Can you also post the complete boot message concerning the implementation of the jffs2? For example the block size (16 or 8 bit) could be a reason. 

But for simplicity I would just add only one or two partitions so it is easier to look for a possible error in flash size and offset. 

 

Urmel
0 Kudos
Altera_Forum
Honored Contributor II
838 Views

Hello Urmel!!!! hw r u??? 

 

i have success mounting the filesystem .......  

when linux booting from a ram i have this result take a look 

 

/> Uncompressing Linux... Ok, booting the kernel. Linux version 2.6.30 (franz@franz-desktop) (gcc version 3.4.6)# 754 PREEMPT Mon May 2 09:37:56 BRT 2011 uClinux/Nios II Built 1 zonelists in Zone order, mobility grouping off. Total pages: 32512 Kernel command line: root=/dev/mtdblock2 rw rootfstype=jffs2 NR_IRQS:32 PID hash table entries: 512 (order: 9, 2048 bytes) Dentry cache hash table entries: 16384 (order: 4, 65536 bytes) Inode-cache hash table entries: 8192 (order: 3, 32768 bytes) Memory available: 128108k/1825k RAM, 0k/0k ROM (1554k kernel code, 270k data) Calibrating delay loop... 31.02 BogoMIPS (lpj=155136) Mount-cache hash table entries: 512 net_namespace: 264 bytes NET: Registered protocol family 16 init_BSP(): registering device resources bio: create slab <bio-0> at 0 NET: Registered protocol family 2 IP route cache hash table entries: 1024 (order: 0, 4096 bytes) TCP established hash table entries: 4096 (order: 3, 32768 bytes) TCP bind hash table entries: 4096 (order: 2, 16384 bytes) TCP: Hash tables configured (established 4096 bind 4096) TCP reno registered NET: Registered protocol family 1 JFFS2 version 2.2. (NAND) © 2001-2006 Red Hat, Inc. io scheduler noop registered io scheduler deadline registered (default) Device /dev/lcd16207 registered ttyS0 at MMIO 0x8002140 (irq = 2) is a Altera UART console enabled eth0: Open Ethernet Core Version 1.0 oeth_probe: 62500 Khz Nios: 16 RX, 16 TX buffs NO Custom HW ALIGN. CONFIG_NIOS2_HW_MULX NOT defined. CONFIG_NIOS2_HW_MUL_OFF NOT defined. BMCR = ffffh. physmap platform flash device: 04000000 at 0c000000 physmap-flash.0: Found 1 x16 devices at 0x0 in 16-bit bank Amd/Fujitsu Extended Query Table at 0x0040 physmap-flash.0: 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 physmap partition information Creating 9 MTD partitions on "physmap-flash.0": 0x000000000000-0x000002800000 : "userspace" 0x000002800000-0x000002900000 : "U-Boot" 0x000002900000-0x000002d00000 : "uImage1" 0x000002d00000-0x000003100000 : "uImage2" 0x000003100000-0x000003500000 : "uImage3" 0x000003500000-0x000003880000 : "DEFAULT_MMU" 0x000003880000-0x000003c00000 : "MAXIMUM_MMU" 0x000003c00000-0x000003f80000 : "USER_IMAGE" 0x000003f80000-0x000003fa0000 : "options-bits" TCP cubic registered NET: Registered protocol family 17 Empty flash at 0x0000fffc ends at 0x00010000 CLEANMARKER node found at 0x00010000, not first node in block (0x00000000) CLEANMARKER node found at 0x00030000, not first node in block (0x00020000) CLEANMARKER node found at 0x00050000, not first node in block (0x00040000) CLEANMARKER node found at 0x00070000, not first node in block (0x00060000) CLEANMARKER node found at 0x00090000, not first node in block (0x00080000) Empty flash at 0x000afffc ends at 0x000b0000 CLEANMARKER node found at 0x000b0000, not first node in block (0x000a0000) Empty flash at 0x000cfffc ends at 0x000d0000 CLEANMARKER node found at 0x000d0000, not first node in block (0x000c0000) VFS: Mounted root (jffs2 filesystem) on device 31:2. Freeing unused kernel memory: 56k freed (0x1ba000 - 0x1c7000) Shell invoked to run file: /etc/rc Command: hostname uClinux Command: mount -t proc proc /proc -o noexec,nosuid,nodev Command: mount -t sysfs sysfs /sys -o rw Command: mount -t devpts devpts /dev/pts -o noexec,nosuid Command: mkdir /var/tmp /var/tmp: File exists Command: mkdir /var/log /var/log: File exists Command: mkdir /var/run /var/run: File exists Command: mkdir /var/lock /var/lock: File exists Command: mkdir /var/empty /var/empty: File exists Command: ifconfig lo 127.0.0.1 Command: route add -net 127.0.0.0 netmask 255.0.0.0 lo Command: ifconfig eth0 192.168.100.137 netmask 255.255.255.0 oeth_phymac_synch:eth0 MR1: 0x0000FFFF Jabber Remote Fault Autoneg'd Link OK: MODER: 0x0000A040 FullD 100BASE-TX Command: boa & Command: cat /etc/motd Welcome to ____ _ _ / __| ||_| _ _| | | | _ ____ _ _ _ _ | | | | | | || | _ \| | | |\ \/ / | |_| | |__| || | | | | |_| |/ | ___\____|_||_|_| |_|\____|\_/\_/ | | |_| For further information check: http://www.uclinux.org/ Command: Execution Finished, Exiting Sash command shell (version 1.1.1) /> boa: server version Boa/0.94.14rc21 boa: server built Apr 29 2011 at 14:45:45. boa: starting server pid=25, port 80 

 

 

but i have problem when i try booting from a flash ........ i have this error 

 

Uncompressing Linux... ERROR invalid compressed format (err=2) -- System halted 

 

i don´t know what cause this........... 

 

my flash is at 0x0c000000 to 0x0fffffff in sopc builder 

 

my linux cpu reset vector offset is 0x02000000 (start at 0x0e000000) 

 

in make menuconfig i put 0x02000000 offset 

 

i will post the commands i use to program the flash ok!!! 

 

 

do you know what can i do to fix this???? 

 

 

thank you very much  

 

 

Franz Wagner
0 Kudos
Altera_Forum
Honored Contributor II
838 Views

Hello all !!!! good news!!!!!!!! 

 

now i have success booting from the flash ....!!!! \o/ 

 

i use this commands 

 

elf2flash --base=0x0c000000 --end=0x10000000 --reset=0xe000000 --boot=~/altera/10.1/nios2eds/components/altera_nios2/boot_loader_cfi.srec --input=zImage --output=zImage.flash --verbose 

 

and 

 

nios2-flash-programmer --base=0xc000000 zImage.flash --instance=0 -g 

 

and it works !!!!! 

 

 

and now another problem....... 

my system is a multicore system ........ i have 2 cpus in my project 

 

i one cpu i running the uClinux... and another cpu i running nios2 with the an374 from altera...... 

 

its everything works fine ..... 

 

but now i have to writing in flash the nios2 software........... 

 

 

another cpu have a reset vector with offset 0x1c00000 

 

how can i write the software without loose linux software...????? 

 

 

 

thank you very much .... 

 

 

Franz Wagner
0 Kudos
Altera_Forum
Honored Contributor II
838 Views

Are you suggesting that the other CPU does not use an OS at all ?  

 

If the CPUs don't share any resources this should work. Of course here the second CPU needs its own dedicated address spaces on the Avalon bus and accordingly a different reset vector.  

 

If the CPUs are supposed to share any addresses (and thus be able to communicate), things will get more complicated and you should start a new forum thread on this.  

 

-Michael
0 Kudos
Altera_Forum
Honored Contributor II
837 Views

Hi Michael !!!! thanks for reply....!!! 

 

well the 2 cpus share many things but this is work fine !!!! 

 

i have success doing the uclinux boot from the flash but now i  

tying to download to flash a software of another cpu where run the an374.... 

 

i do that but now the uclinux cant start......... the an374 starts but another cpu show this... 

 

 

Uncompressing Linux.... ERROR crc error --System halted 

 

I think it might be the mapping memory in config.c...... 

 

what do you think??? 

 

 

i use the default parameters.... 

{ .name = "userspace", .size = 0x02800000, /* 40Mb */ .offset = 0x00000000, }, { .name = "U-Boot", .size = 0x00100000, .offset = 0x02800000, }, { .name = "uImage1", .size = 0x00400000, .offset = 0x02900000, }, { .name = "uImage2", .size = 0x00400000, .offset = 0x02d00000, }, { .name = "uImage3", .size = 0x00400000, .offset = 0x03100000, }, { .name = "DEFAULT_MMU", .size = 0x00380000, .offset = 0x03500000, }, { .name = "MAXIMUM_MMU", .size = 0x00380000, .offset = 0x03880000, }, { .name = "USER_IMAGE", .size = 0x00380000, .offset = 0x03c00000, }, { .name = "options-bits", .size = 0x00020000, .offset = 0x03f80000, } 

 

 

thank you very much!!!!!! 

 

sorry for my poor english....... 

 

 

Franz Wagner
0 Kudos
Altera_Forum
Honored Contributor II
838 Views

If both CPUs try to start Linux, things are going very wrong. This can't work as the NIOS Linux is not SMP enabled and will not be in forseeable future, as the NIOS CPU lacks many features necessary for SMP support.  

 

There might be some threads on multiple CPUs here, you might want to read them.  

 

And for questions you should start a thread with an appropriate subject line. 

 

-Michael
0 Kudos
Altera_Forum
Honored Contributor II
838 Views

Hi Michael!!! thanks to reply........ 

 

do you have a cyclone iii developer board??? if yes i will send to you the .sof zImage and .elf of project to you see how that is working.......... 

 

i will post a new thead 

 

 

thank you  

 

Franz Wagner
0 Kudos
Altera_Forum
Honored Contributor II
838 Views

I do have a NEEK, but I am not actively using it right now, as our interests have moved to different targets. So I can only help with some knowledge I collected when I was investigating NIOS and I am still lurking here - just in case. But I can't do any practical tests.  

 

-Michael
0 Kudos
Altera_Forum
Honored Contributor II
838 Views

Hi all!!!!!! 

 

good news!!!!!! \o/ i have successfully booting 2 cpus !!! 

 

the problem was both starting at the same time!!!! 

 

i add a cpu_resetrequest on my linux_cpu and a pio in another cpu..... 

 

the linux cpu starts at reset and an374 starts normally 

 

after an374 starts i set on nios a pio to starts uclinux cpu.....and voila!!!! 

 

now i have the an374 with web browser management......with eth grafics!!! booting from a flash and using only one ethernet port :) 

 

now i want to put a snmp agent on it 

 

 

thanks very much all!!!!! 

 

 

Franz Wagner
0 Kudos
Altera_Forum
Honored Contributor II
838 Views

Sounds good :). 

-Michael 

(what exactly is an374, what does the second CPU do ?)
0 Kudos
Altera_Forum
Honored Contributor II
838 Views

Hello Michael !!! thank for you assistence... 

 

an374 is a Altera Video Over IP Reference Design, i port to cycloneiii dev board, but i need a webserver and snmp ....so I decided to put another cpu with uclinux...very good....thank you again 

 

if someone needs help I'll be glad to help...... 

 

cheers  

 

Franz Wagner
0 Kudos
Altera_Forum
Honored Contributor II
838 Views

How do you manage the concurrent accesses to the Ethernet "hardware" ? 

 

-Michael
0 Kudos
Altera_Forum
Honored Contributor II
838 Views

Hi michael ....... 

was very funny and little hardo to do that....... 

 

the linux cpu manage the phy chip ... mdc and mdio....... 

an374 wait linux configure a phy....... 

 

in eth rx i do a verilog block that does a filtering of packets ..by mac (linux mac and an374 mac) 

 

in eth tx i do a verilog block that always send a an374 udp flow , if the linux cpu want to send a packet the block wait a interpacket gap send the packet and back send an374 flow .......... 

 

i do that usin two dualport ram.....and a monostable.......... 

 

i did tests and had very good results..... doesnt lose packets............:) 

 

regards 

 

Franz wagner
0 Kudos
Altera_Forum
Honored Contributor II
838 Views

So when sending, you did a hardware block without the Linux driver even knowing about this. Nice ! 

 

Does the an374 unit not receive any Ethernet blocks ?  

 

-Michael
0 Kudos
Altera_Forum
Honored Contributor II
838 Views

hi Michael !!  

 

yes... i cheated the two phy controlers....... for any one another doesnt exist........ 

 

 

in receive i copy the packets in a dual port ram and distributed according to the mac address......broadcast and multicast are duplicaded.... 

 

under tests an374 dont loose packets in RX an TX...... because it has priority over uclinux packets........ 

 

try do it :) is very interesting ....... if you want i post the code...... 

 

cheers  

 

 

Franz wagner
0 Kudos
Altera_Forum
Honored Contributor II
838 Views

 

--- Quote Start ---  

Hello Michael !!! thank for you assistence... 

 

an374 is a Altera Video Over IP Reference Design, i port to cycloneiii dev board, but i need a webserver and snmp ....so I decided to put another cpu with uclinux...very good....thank you again 

 

if someone needs help I'll be glad to help...... 

 

cheers  

 

Franz Wagner 

--- Quote End ---  

 

 

 

Hi Franz, 

I am looking into porting the an374 to the The NEEK, Cyclone III Edition (consists of the Cyclone III Starter Kit and an LCD/VGA high-speed mezzanine card (HSMC).) It sounds like you were successful in porting the design to one of the Cyclone III boards, was it the same Starter Kit I am looking at? Also, can you tell me what version of Quartus II you were using?  

 

Thank you, 

Tracee
0 Kudos
Altera_Forum
Honored Contributor II
745 Views

hi Tracee.......... 

 

my board is Cyclone iii development board ......  

 

..........I do not know if Neek will have enough memory for the project but you can try ..... 

 

i use quartus 10.0 

 

cheers  

 

Franz Wagner
0 Kudos
Reply