- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi people
I am having some problems on my custom board. The DOC is really bad when it comes to custom boards and uClinux 1) I have modified the ../drivers/mtd/maps/altera.c file line 78 so it should fit my memory map. Should this be modified here???#else
{
.name = "romfs/jffs2",
.size = 0x100000,
.offset = 0x100000,
},{
.name = "loader/kernel",
.size = 0xFFFFF,
.offset = 0,
}, {
.name = "User configuration",
.size = 0x100000,
.offset = 0x300000,
}, {
.name = "safe configuration",
.size = 0x10000,
.offset = 0x380000,
.mask_flags = MTD_WRITEABLE, /* force read-only */
}# endif
};
2) I have created a filesystem and uploaded it to the flash. 3) I have via the NIOSII IDE configured the kernel to have the root=/romfs/jffs2 (same name as in the altera.c is this correct?) I have copied the console output in here below. <div class='quotetop'>QUOTE </div> --- Quote Start --- uClinux/Nios II Altera Nios II support © 2004 Microtronix Datacom Ltd. Built 1 zonelists Kernel command line: root=/romfs/jffs2 PID hash table entries: 64 (order: 6, 1024 bytes) Dentry cache hash table entries: 2048 (order: 1, 8192 bytes) Inode-cache hash table entries: 1024 (order: 0, 4096 bytes) Memory available: 7004k/8192k RAM, 0k/0k ROM (858k kernel code, 210k data) Mount-cache hash table entries: 512 (order: 0, 4096 bytes) Linux NoNET1.0 for Linux 2.6 Serial: JTAG UART driver $Revision: 1.4 $ ttyJ0 at MMIO 0x804028e0 (irq = 0) is a jtag_uart io scheduler noop registered io scheduler anticipatory registered io scheduler deadline registered io scheduler cfq registered RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize VFS: Cannot open root device "/romfs/jffs2" or unknown-block(0,0) Please append a correct "root=" boot option Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)[/b] --- Quote End --- Hope some of you can help me out with this problem. Best Regards GreatWhite.DK
Link Copied
8 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi GreateWhite,
You probably need to change your 'root' kernel parameter to account for MTD/JFFS e.g.: root=/dev/mtdblock1 And make sure you have a matching block device inode with (major,minor)=(31,1). Regards, --Scott- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi smcutt
I am new at this, and many of the things you mention I have no idea where to find and modify. C:\altera\kits\nios2\bin\eclipse\plugins\com.microtronix.nios2linux.kernel_1.4.0\linux-2.6.x\drivers\mtd\maps in this path I have tried looking in the altera.c, microtronix.c and the nios_romfs.c I have tried modifying the adr used in these files and then rebuild my kernel. altera.c.
.
.# else
{
.name = "romfs/jffs2",
.size = 0x100000,
.offset = 0x100000,
},{
.name = "loader/kernel",
.size = 0xFFFFF,
.offset = 0,
}, {
.name = "User configuration",
.size = 0x100000,
.offset = 0x300000,
}, {
.name = "safe configuration",
.size = 0x10000,
.offset = 0x380000,
.mask_flags = MTD_WRITEABLE, /* force read-only */
}# endif
microtronix.c .
.
.
static struct mtd_partition microtronix_partitions = {
{
.name = "romfs",
.size = 0x100000,
.offset = 0x0,
},{
.name = "loader/kernel",
.size = 0x80000, //0x200000
.offset = 0x300000,
}
};
nios_romfs.c (uses +0x0 instead of 0x200000) .
.
.
int __init microtronix_mtd_init(void)
{
struct mtd_info *mtd;
struct map_info *mapp;
unsigned long addr = na_flash_kernel + 0x0;
mapp = µtronix_ram_map;
.
.
.
After the rebuild the system.map still say(is that ok?) <div class='quotetop'>QUOTE </div> --- Quote Start --- 0010122c A _kernel_footprint 00200000 ? _romfs 00200000 ? _romfs_end 01000000 T __ram_start . . . 0110c000 S _end 0110c000 S end 01800000 ? __ramend 01800000 ? _ramend[/b] --- Quote End --- Hope you can help me out with this. You have any good DOC on how to build a custom kernel? below I have added some of the info on the device I am using. If you have any suggestions on new configs you are most welcome. SYSTEM INFO RAM : 8MByte (0x1000000 -> 0x1800000) FLASH: 4MByte (0x0 -> 0x400000) USER IMAGE defined at 0x300000 SAFE IMAGE defined at 0x380000 Best regards GreatWhite.DK
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hey GreatWhite... there are a couple things to watch out for when using flash on a custom board. The first item is the memory map and I think you're on the right track for that. There's nothing wrong with modifying one of the original memory maps to suit your need.
part one You probably need something closer to:#else
{
.name = "romfs/jffs2",
.size = 0x100000,
.offset = 0x200000,
},{
.name = "loader/kernel",
.size = 0x200000,
.offset = 0x0,
}, {
.name = "User configuration",
.size = 0x80000,
.offset = 0x300000,
}, {
.name = "safe configuration",
.size = 0x80000,
.offset = 0x380000,
.mask_flags = MTD_WRITEABLE, /* force read-only */
}# endif
I've made the portion of flash that holds the kernel to be 2MB and I've setup the ROMFS section to use up all remaining space between the kernel and the user configuration. Now, smcnutt was telling you to change the root commandline argument in your "Default kernel command string" from: root=/romfs/jffs2
to root=/dev/mtdblock0
mtdblock0 corresponds to the first entry in your memory map. That's the easy part... part two From the kernel startup messages, it looks like the flash chip you're using may not be supported by the default distribution. Currently, we support a couple of different AMD flash chips. It's quite possible that the chip you're using isn't support right now. Until the chip is supported, I don't know if you can mount a romdisk on your flash. Why don't you pass me the name of your flash and I'll see what I can do to help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Ken,
On second look, it appears that MTD is not configured ... doesn't it report the result of a scan ... pass or fail? --Scott- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi guys
The Flash is a Spansion 29LV320ABTC-702K053400 I was told that it was a AMD from our HW guys. I have made some extra printk's in the altera.c file since this is the one that's being used. The microtronix.c printk's I have made are not printed in the console so it's safe to say that microtronix.c is not used. Should this be used insted??? I have inserted a new console output here below and futher down I have the altera.c code I have modified.uClinux/Nios II
Altera Nios II support (C) 2004 Microtronix Datacom Ltd.
Built 1 zonelists
Kernel command line: root=/dev/mtdblock0 ro
PID hash table entries: 64 (order: 6, 1024 bytes)
Dentry cache hash table entries: 2048 (order: 1, 8192 bytes)
Inode-cache hash table entries: 1024 (order: 0, 4096 bytes)
Memory available: 6784k/8192k RAM, 0k/0k ROM (1080k kernel code, 215k data)
Mount-cache hash table entries: 512 (order: 0, 4096 bytes)
Linux NoNET1.0 for Linux 2.6
JFFS version 1.0, (C) 1999, 2000 Axis Communications AB
JFFS2 version 2.2. (NAND) (C) 2001-2003 Red Hat, Inc.
JFFS2: default compression mode: priority
Serial: JTAG UART driver $Revision: 1.4 $
ttyJ0 at MMIO 0x804028e0 (irq = 0) is a jtag_uart
io scheduler noop registered
io scheduler anticipatory registered
io scheduler deadline registered
io scheduler cfq registered
RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize
MSE altera.c 1 WINDOW_ADDR 0 WINDOW_SIZE 4194304
MSE __ioremap
MSE Failed to ioremap
MSE altera.c 2 mymtd=0 *type=17849836
MSE altera.c 2 mymtd=0 *type=17851508
MSE altera.c 2(a) mymtd=0 *type=0
MSE altera.c 6
VFS: Cannot open root device "mtdblock0" or unknown-block(0,0)
Please append a correct "root=" boot option
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
altera.c int __init init_alteramap(void)
{
static const char *rom_probe_types = {"cfi_probe", "jedec_probe", 0 };
const char **type;
printk("MSE altera.c 1 WINDOW_ADDR %x WINDOW_SIZE %d\n", WINDOW_ADDR, WINDOW_SIZE);
ndk_amd_map.virt = (unsigned long *)ioremap_nocache(WINDOW_ADDR, WINDOW_SIZE);
if (!ndk_amd_map.virt)
{
printk("MSE Failed to ioremap\n");
}
/*
if (!ndk_amd_map.virt) {
printk("Failed to ioremap\n");
return -EIO;
}
*/
simple_map_init(&ndk_amd_map);
mymtd = 0;
type = rom_probe_types;
for(; !mymtd && *type; type++) {
mymtd = do_map_probe(*type, &ndk_amd_map);
printk("MSE altera.c 2 mymtd=%d *type=%d\n", mymtd, *type);
}
printk("MSE altera.c 2(a) mymtd=%d *type=%d\n", mymtd, *type);
//mymtd = 1;
if (mymtd) {
mymtd->owner = THIS_MODULE;
printk("MSE altera.c 3\n");
# ifdef CONFIG_MTD_PARTITIONS
mtd_parts_nb = parse_mtd_partitions(mymtd, part_probes,
&mtd_parts, 0);
printk("MSE altera.c 4\n");
if (mtd_parts_nb > 0)
{
add_mtd_partitions (mymtd, mtd_parts, mtd_parts_nb);
printk("MSE altera.c 5\n");
return 0;
}
if (NUM_PARTITIONS != 0)
{
printk(KERN_NOTICE
"Using Altera NDK partition definition\n");
add_mtd_partitions (mymtd, alteramap_partitions, NUM_PARTITIONS);
return 0;
}
# endif
printk("MSE altera.c 5\n");
add_mtd_device(mymtd);
return 0;
}
printk("MSE altera.c 6\n");
iounmap((void *)ndk_amd_map.virt);
return -ENXIO;
I use the memory map you proposed Ken. Hope this is enough info, if not please just write for more. And thx for the help and the explanations. Best regards Michael
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Michael,
If you don't want to write/erase flash under linux, my suggestion is to use the nios romfs map, which only detects the flash chip as rom. If you do need write/erase flash ability, you can customize the map in altera.c or microtronix.c to meet your needs. Pay attention to the width of the bus to the chip, which is 8 bit for altera platforms and 16 for Microtronix platforms. You can consult your hardware engineer to get this information, or check the datasheet of that flash chip. Also make sure your kernel config has enabled the CFI probe and/or JEDEC probe. If you still have trouble detecting the chip, and if the chip is JEDEC compliant, you might need to add your chip to jedec_table in file jedec_probe.c.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
in this case, the following code
ndk_amd_map.virt = (unsigned long *)ioremap_nocache(WINDOW_ADDR, WINDOW_SIZE);
if (!ndk_amd_map.virt)
{
printk("MSE Failed to ioremap\n");
}
always prints that message out. This because your flash starts at address 0, and under uClinux ioremap returns the same address being mapped, 0. You can either comment this code out, or as a better solution, avoid using address 0.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
Thx for all your help on this topic. I (thx 2 u) got it working. Regards Michael E
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