Forum Discussion
Altera_Forum
Honored Contributor
16 years agoLinux, U-Boot, and Root File Systems
I'm working with a Nios II design with an MMU, on a Nios II Development Kit, Cyclone II Edition board (EP2C35).
I'm trying to figure out how to get to a system that boots with some sort of root filesystem stored in flash. With help from hippo's wiki page (http://www.nioswiki.com/linux) (http://www.nioswiki.com/linux%29), I can now:- Build a kernel
- Download it with nios2-download
- Connect with nios2-terminal
- Get a Linux Command Prompt
13 Replies
- Altera_Forum
Honored Contributor
The hardware is a standard Altera Development Kit, http://www.altera.com/products/devkits/altera/kit-nios-2c35.html
The Quartus design is probably a slightly tweaked version of the standard design that comes with that board. I directed the hardware team to the Linux for Nios II Wiki page, section "Create a Nios II design with MMU", and asked them to modify the design accordingly. I don't think I will be able to post the FPGA design. I'll check tomorrow. Is there any more specific information I could provide to help figure this out? Or, do you have any recommendations on where I should be looking? Or what questions I should be asking the hardware team? Something that looked weird to me: As you had recommended, I copied images/rootfs.jffs2 to the flash, at the start of the area I allocated to jffs2, 0x00200000. I'm concerned that Linux is mucking around with lower addresses (The "CLEANMARKER" references in the output), where I have stored U-Boot and the kernel. Is this ok? - Altera_Forum
Honored Contributor
It seems I'm not done with silly mistakes.
The flash device is 16 bit, but it is being used in 8-bit mode. Switching to ".width = 1" solves the problem of detecting two devices and twice as much flash. It also eliminated the CLEANMARKER error. Now, I think I am down to flash driver problems. The Spansion part is slightly different from the original AMD part. Specifically, the erase commands need to be written to specific offsets in the flash. For the original part, it was sufficient to write the commands to the start address of the flash. The older sector erase sequence (for flash starting at address 0x0, and sector to erase at SA) was: Address Data --------------------- 0x0 0xAA 0x0 0x55 0x0 0x80 0x0 0xAA 0x0 0x55 SA 0x30 New Sector Erase Sequence: Address Data --------------------- 0xAAA 0xAA 0x555 0x55 0xAAA 0x80 0xAAA 0xAA 0x555 0x55 SA 0x30 Here is the new boot log output. It does eventually get to a command prompt, but it keeps generating errors about erase and write errors. Am I on the right track here?Linux version 2.6.30-00494-g84a224b-dirty ([email protected]) (gcc version 4.1.2)# 47 Tue Oct 6 14:08:55 EDT 2009 console enabled Early printk initialized Linux/Nios II-MMU init_bootmem_node(?,0x6391, 0x6000, 0x8000) free_bootmem(0x6391000, 0x1c6f000) reserve_bootmem(0x6391000, 0x400) Built 1 zonelists in Zone order, mobility grouping on. Total pages: 8128 Kernel command line: NR_IRQS:32 PID hash table entries: 128 (order: 7, 512 bytes) Dentry cache hash table entries: 4096 (order: 2, 16384 bytes) Inode-cache hash table entries: 2048 (order: 1, 8192 bytes) We have 32768 pages of RAM Memory available: 28824k/3648k RAM, 0k/0k ROM (2119k kernel code, 1528k data) Calibrating delay loop... 41.98 BogoMIPS (lpj=209920) Mount-cache hash table entries: 512 net_namespace: 492 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: 1024 (order: 1, 8192 bytes) TCP bind hash table entries: 1024 (order: 0, 4096 bytes) TCP: Hash tables configured (established 1024 bind 1024) TCP reno registered NET: Registered protocol family 1 JFFS2 version 2.2. (NAND) © 2001-2006 Red Hat, Inc. JFFS2: default compression mode: priority msgmni has been set to 56 io scheduler noop registered io scheduler anticipatory registered io scheduler deadline registered io scheduler cfq registered (default) ttyJ0 at MMIO 0x21208b0 (irq = 1) is a Altera JTAG UART ttyS0 at MMIO 0x2120840 (irq = 4) is a Altera UART console handover: boot -> real ttyS1 at MMIO 0x2120b00 (irq = 8) is a Altera UART smc91x.c: v1.1, sep 22 2004 by Nicolas Pitre <[email protected]> eth0: SMC91C11xFD (rev 2) at e2110300 IRQ 6 eth0: Ethernet addr: 00:07:ed:0f:0a:53 physmap platform flash device: 01000000 at 00000000 Physmap Width: 1 physmap-flash.0: Found 1 x16 devices at 0x0 in 8-bit bank in cfi_chip_setup 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 3 MTD partitions on "physmap-flash.0": 0x000000000000-0x000000060000 : "U-Boot" 0x000000060000-0x000000200000 : "uImage" 0x000000200000-0x000001000000 : "romfs/jffs2" TCP cubic registered NET: Registered protocol family 10 NET: Registered protocol family 17 RPC: Registered udp transport module. RPC: Registered tcp transport module. /home/pinta/projects/micropump/nios_linux/nios2-linux/linux-2.6/drivers/rtc/hctosys.c: unable to open rtc device (rtc0) eth0: link down ADDRCONF(NETDEV_UP): eth0: link is not ready IP-Config: Unable to set interface netmask (-22). eth0: link up, 100Mbps, full-duplex, lpa 0x45E1 jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00120000: 0x55ff instead JFFS2: Erase block at 0x00120000 is not formatted. It will be erased jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x002b0000: 0x55ff instead JFFS2: Erase block at 0x002b0000 is not formatted. It will be erased jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00440000: 0x55ff instead JFFS2: Erase block at 0x00440000 is not formatted. It will be erased jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x005d0000: 0x55ff instead JFFS2: Erase block at 0x005d0000 is not formatted. It will be erased jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00760000: 0x55ff instead JFFS2: Erase block at 0x00760000 is not formatted. It will be erased jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x008f0000: 0x55ff instead JFFS2: Erase block at 0x008f0000 is not formatted. It will be erased jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00a00010: 0xd76a instead jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00a00014: 0x5000 instead jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00a00018: 0x6a00 instead jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00a0001c: 0x0040 instead jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00a00020: 0x0068 instead jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00a00024: 0x40ff instead jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00a00028: 0x6880 instead Empty flash at 0x00a0002c ends at 0x00a0004c jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00a0004c: 0x0400 instead jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00a00050: 0x0404 instead jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00a00054: 0x0704 instead Further such events for this erase block will not be printed - Altera_Forum
Honored Contributor
OK.... so those errors were just initialization stuff. They went away once the partition was formatted, I guess.
I accidentally blew away my FPGA image, but I have that back now. And, I think I've adjusted my partitions so that doesn't happen again. Hippo, you are a genius (or at least very helpful).