4 Sep 2006 14:24
Re: Can I change 'RedBoot Config' using MTD driver. ?
Gary Thomas <gary <at> mlbassoc.com>
2006-09-04 12:24:38 GMT
2006-09-04 12:24:38 GMT
Amitesh Singh wrote: > Hi all > My Task is to set "Boot script" (RedBoot config) value via a linux > command. > > As on RedBoot prompt,we set configurations using 'fconfig',is there any > Linux tool which does the same ? > > i tried to do it in my way. > > # cat /proc/mtd > dev: size erasesize name > mtd0: 00040000 00020000 "RedBoot" > mtd1: 00f80000 00020000 "unallocated" > mtd2: 00001000 00020000 "RedBoot config" > mtd3: 00020000 00020000 "FIS directory" > > > First i copied 'mtd2' using 'dd' and then changed the binary using > 'hexedit' > (just changed Boot script). > Before booting,I unlocked RedBoot partitions. > +++++++++++++++++++++++++++++++++++++++++++++++++++++++ > RedBoot> fis list > Name FLASH addr Mem addr Length Entry point > RedBoot 0x50000000 0x50000000 0x00040000 0x00000000 > RedBoot config 0x50FC0000 0x50FC0000 0x00001000 0x00000000 > FIS directory 0x50FE0000 0x50FE0000 0x00020000 0x00000000 > RedBoot> fis unlock RedBoot > ... Unlock from 0x50000000-0x50040000: .. > RedBoot> fis unlock "RedBoot config" > ... Unlock from 0x50fc0000-0x50fc1000: . > RedBoot> fis unlock "FIS directory" > ... Unlock from 0x50fe0000-0x51000000: . > +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > > I am able to read/write other partitions (including FIS directory > (have n't > checked for RedBoot :P) ) except "RedBoot config". > Any suggestions ??? > > Best Regards > > Amitesh Singh > http://www.amitesh.info > > > > > RedBoot> fis init > About to initialize [format] FLASH image system - continue (y/n)? y > *** Initialize FLASH Image System > Warning: device contents not erased, some blocks may not be usable > ... Unlock from 0x50fe0000-0x51000000: . > ... Erase from 0x50fe0000-0x51000000: . > ... Program from 0x01fdf000-0x01fff000 at 0x50fe0000: . > ... Lock from 0x50fe0000-0x51000000: . > RedBoot> fis list > Name FLASH addr Mem addr Length Entry point > RedBoot 0x50000000 0x50000000 0x00040000 0x00000000 > RedBoot config 0x50FC0000 0x50FC0000 0x00001000 0x00000000 > FIS directory 0x50FE0000 0x50FE0000 0x00020000 0x00000000 > RedBoot> fis unlock RedBoot > ... Unlock from 0x50000000-0x50040000: .. > RedBoot> fis unlock "RedBoot config" > ... Unlock from 0x50fc0000-0x50fc1000: . > RedBoot> fis unlock "FIS directory" > ... Unlock from 0x50fe0000-0x51000000: . > RedBoot> load -r -v -b 0x01600000 zImage > Using default protocol (TFTP) > - > Raw file loaded 0x01600000-0x016ea9b7, assumed entry at 0x01600000 > RedBoot> load -r -v -b 0x00800000 ramdisk.gz > Using default protocol (TFTP) > - > Raw file loaded 0x00800000-0x00b400ef, assumed entry at 0x00800000 > RedBoot> go -n 0x01600000 > Uncompressing > Linux..................................................................... > > done, booting the kernel. > Linux version 2.6.12-uc0 (root <at> buildsys.***********.com) (gcc version > 3.3.2) > #103 Fri Sep 1 20:02:51 IST 2006 > CPU: XScale-IXP4xx [690541f1] revision 1 (ARMv5TE) > CPU0: D VIVT undefined 5 cache > CPU0: I cache: 32768 bytes, associativity 32, 32 byte lines, 32 sets > CPU0: D cache: 32768 bytes, associativity 32, 32 byte lines, 32 sets > Machine: ADI Engineering Coyote > converttags > Warning: bad configuration page, trying to continue > default tags > Memory policy: ECC disabled, Data cache writeback > Built 1 zonelists > Kernel command line: console=ttyS0,115200 root=/dev/ram0 > initrd=0x00800000,8M mem=64M <at> 0x00000000 apic=off > PID hash table entries: 512 (order: 9, 8192 bytes) > Console: colour dummy device 80x30 > Dentry cache hash table entries: 16384 (order: 4, 65536 bytes) > Inode-cache hash table entries: 8192 (order: 3, 32768 bytes) > Memory: 64MB = 64MB total > Memory: 54400KB available (1735K code, 375K data, 108K init) > Mount-cache hash table entries: 512 > CPU: Testing write buffer coherency: ok > checking if image is initramfs...it isn't (no cpio magic); looks like an > initrd > Freeing initrd memory: 8192K > NET: Registered protocol family 16 > PCI: IXP4xx is host > PCI: IXP4xx Using direct access for memory space > PCI: bus0: Fast back to back transfers disabled > dmabounce: registered device 0000:00:02.0 on pci bus > NetWinder Floating Point Emulator V0.97 (double precision) > Serial: 8250/16550 driver $Revision: 1.90 $ 4 ports, IRQ sharing disabled > ttyS0 at MMIO 0xc8001000 (irq = 13) is a XScale > io scheduler noop registered > io scheduler cfq registered > RAMDISK driver initialized: 16 RAM disks of 8192K size 1024 blocksize > loop: loaded (max 8 devices) > Uniform Multi-Platform E-IDE driver Revision: 7.00alpha2 > ide: Assuming 33MHz system bus speed for PIO modes; override with > idebus=xx > physmap flash device: 1000000 at 50000000 > phys_mapped_flash: Found 1 x16 devices at 0x0 in 16-bit bank > Intel/Sharp Extended Query Table at 0x0031 > Using buffer write method > cfi_cmdset_0001: Erase suspend on write enabled > cmdlinepart partition parsing not available > Searching for RedBoot partition table in phys_mapped_flash at offset > 0xfe0000 > 4 RedBoot partitions found on MTD device phys_mapped_flash > Creating 4 MTD partitions on "phys_mapped_flash": > 0x00000000-0x00040000 : "RedBoot" > 0x00040000-0x00fc0000 : "unallocated" > 0x00fc0000-0x00fc1000 : "RedBoot config" > mtd: partition "RedBoot config" doesn't end on an erase block -- force > read-only > 0x00fe0000-0x01000000 : "FIS directory" > No recognised DiskOnChip devices found > blkmtd: version $Revision: 1.24 $ > blkmtd: error: missing `device' name > > block2mtd: version $Revision: 1.23 $ > mice: PS/2 mouse device common for all mice > NET: Registered protocol family 2 > IP: routing cache hash table of 512 buckets, 4Kbytes > 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) > NET: Registered protocol family 1 > NET: Registered protocol family 17 > RAMDISK: Compressed image found at block 0 > VFS: Mounted root (ext2 filesystem) readonly. > Freeing init memory: 108K > mount: /etc/mtab: Read-only file system > ixp400: module license 'unspecified' taints kernel. > ixp400_eth: Initializing IXP400 NPE Ethernet driver software v. 1.4A > Warning : log_level == 2 and TRACE is disabled > ixp400_eth: CPU clock speed (approx) = 266 MHz > ixp400_eth: Initialising Queue Manager... > [warning] Warning: the NPE A component you specified does not exist > [error] ixEthMiiPhyScan : unexpected Mii PHY ID 0022561b > [error] ixEthMiiPhyScan : unexpected Mii PHY ID 0022561b > ixp400_eth: Found PHY 0 at address 2 > ixp400_eth: Found PHY 1 at address 4 > ixp400_eth: Configuring PHY 0 > ixp400_eth: Speed 100 Duplex FULL Autonegotiation ON > ixp400_eth: Configuring PHY 1 > ixp400_eth: Speed 100 Duplex FULL Autonegotiation ON > ixp400_eth: ixp0 is using NPEB and the PHY at address 2 > ixp400_eth: ixp1 is using NPEC and the PHY at address 4 > ixp400_eth: Use default MAC address 00:02:b3:01:01:01 for port 0 > ixp400_eth: Use default MAC address 00:02:b3:02:02:02 for port 1 > ixp400_eth: port_enable() > port_enable(eth1) > Welcome to > > S N A P G E A R L I N U X > > For further information check: > http://www.snapgear.org/ > > /etc/rc: groupadd: command not found > /etc/rc: groupadd: command not found > /etc/rc: groupadd: command not found > /etc/rc: useradd: command not found > init: Booting to single user mode > # cat /proc/mtd > dev: size erasesize name > mtd0: 00040000 00020000 "RedBoot" > mtd1: 00f80000 00020000 "unallocated" > mtd2: 00001000 00020000 "RedBoot config" > mtd3: 00020000 00020000 "FIS directory" > # ls -l /dev/mtd* > crw-r--r-- 1 0 0 90, 0 /dev/mtd0 > crw-r--r-- 1 0 0 90, 2 /dev/mtd1 > crw-r--r-- 1 0 0 90, 4 /dev/mtd2 > crw-r--r-- 1 0 0 90, 6 /dev/mtd3 > brw-r--r-- 1 0 0 31, 0 /dev/mtdblock0 > brw-r--r-- 1 0 0 31, 1 /dev/mtdblock1 > brw-r--r-- 1 0 0 31, 2 /dev/mtdblock2 > brw-r--r-- 1 0 0 31, 3 /dev/mtdblock3 > crw-r--r-- 1 0 0 90, 1 /dev/mtdr0 > crw-r--r-- 1 0 0 90, 3 /dev/mtdr1 > crw-r--r-- 1 0 0 90, 5 /dev/mtdr2 > crw-r--r-- 1 0 0 90, 7 /dev/mtdr3 > # eraseall /dev/mtd2 //Not able to write on > "RedBoot > config" :P > eraseall: /dev/mtd2: Permission denied > # eraseall /dev/mtd3 //can write on "FIS dir" > Erased 128 Kibyte <at> 0 -- 100% complete. > # reboot > > The system is going down NOW !! > Sending SIGTERM to all processes. > Sending SIGKILL to all processes. > # > # > # Restarting system. > > Testing 32MByte SDRAM... OK + > Panther Rev 1.2 > Redboot Release 1.1 > Ethernet eth0: MAC address 00:01:01:01:02:02 > IP: 2.2.2.2/255.255.255.0, Gateway: 2.2.2.2 > Default server: 2.2.2.1, DNS server IP: 2.2.2.2 > > RedBoot(tm) bootstrap and debug environment [ROM] > Red Hat certified release, version 1.92 - built 12:28:20, Jul 31 2006 > > Platform: Intel Generic Residential Gateway (XScale) > Copyright (C) 2000, 2001, 2002, Red Hat, Inc. > > RAM: 0x00000000-0x02000000, 0x0001c1d0-0x01fd1000 available > FLASH: 0x50000000 - 0x51000000, 128 blocks of 0x00020000 bytes each. > == Executing boot script in 2.000 seconds - enter ^C to abort > ^C > RedBoot> ^C > RedBoot> ^C > RedBoot> ^C > RedBoot> fis list > Name FLASH addr Mem addr Length Entry point > RedBoot> fis init > About to initialize [format] FLASH image system - continue (y/n)? y > *** Initialize FLASH Image System > Warning: device contents not erased, some blocks may not be usable > ... Unlock from 0x50fe0000-0x51000000: . > ... Erase from 0x50fe0000-0x51000000: . > ... Program from 0x01fdf000-0x01fff000 at 0x50fe0000: . > ... Lock from 0x50fe0000-0x51000000: . > RedBoot> fis list > Name FLASH addr Mem addr Length Entry point > RedBoot 0x50000000 0x50000000 0x00040000 0x00000000 > RedBoot config 0x50FC0000 0x50FC0000 0x00001000 0x00000000 > FIS directory 0x50FE0000 0x50FE0000 0x00020000 0x00000000 > > ================================================================================ > > The easiest way to fix this is to separate the FIS directory from the FCONFIG database - basically into two separate FLASH sectors. Then Linux will let you write to them. Rebuild RedBoot with CYGSEM_REDBOOT_FLASH_COMBINED_FIS_AND_CONFIG false -- ------------------------------------------------------------ Gary Thomas | Consulting for the MLB Associates | Embedded world ------------------------------------------------------------ -- -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
RSS Feed