2012/8/26 Hauke Mehrtens <[email protected]>:
> On 08/26/2012 02:08 PM, Rafał Miłecki wrote:
>> I'm experimenting with 2nd flash memory in my WNDR4500. It does
>> contain TRX at offset 0x0 (it is possible, because bootloader is
>> placed on 1st flash memory).
>>
>> As you know TRX size is 224B (V1) or 256B (V2) [0]. In case of V1 it
>> means that first partition data start at 224/8 == 0x1C.
>>
>> So during my experiments I've made partitioner driver register mtd
>> partition starting at 0x1C. It exactly matches the place where
>> partition data start. Unfortunately mtd subsystem doesn't like such a
>> partitions:
>>
>> Creating 2 MTD partitions on "NAND 128MiB 3,3V 8-bit":
>> 0x00000000001c-0x00000028a3b4 : "linux"
>> mtd: partition "linux" doesn't start on an erase block boundary --
>> force read-only
>> 0x00000028a3b4-0x000008000000 : "rootfs"
>> mtd: partition "rootfs" doesn't start on an erase block boundary --
>> force read-only
>>
>> I can see we tend to rounding down offset to the eraseblock size. So
>> instead registering mtd partition starting at 0x1C we register it with
>> start at 0x00. This way we get some "garbages" at the beginning of
>> partition, and hope filesystem (squashfs/jffs2) can skip that.
>>
>> I've some doubts if this is a correct behavior. If filesystem can work
>> with real data starting at unaligned offset (like 0x1C), I think mtd
>> should just accept such a offsets. That way I'm sure I register
>> correct range as partition and nothing will touch/break my TRX header.
>>
>> What do you think about this? Can we fix mtd to accept unaligned offsets?
>>
>> [0] http://wiki.openwrt.org/doc/techref/header
>
> When using OpenWrt, it is no problem that these partitions are
> read-only. The kernel is only read by the boot loader and not by the
> system in the later process and rootfs is filled with the read-only
> squashfs. I think the rootfs split patch, which created rootfs_data,
> splits it at the next erase block, I do not know how it is done if the
> hole image uses jffs2.

Ahh, OK. I got 400-rootfs_split.patch applied, but there way different
issue. Now I can see this correctly:

Creating 2 MTD partitions on "NAND 128MiB 3,3V 8-bit":
0x00000000001c-0x00000011a800 : "linux"
mtd: partition "linux" doesn't start on an erase block boundary --
force read-only
0x00000011a800-0x000008000000 : "rootfs"
mtd: partition "rootfs" doesn't start on an erase block boundary --
force read-only
mtd: partition "rootfs" set to be root filesystem
mtd: partition "rootfs_data" created automatically, ofs=2A0000, len=7D60000
0x0000002a0000-0x000008000000 : "rootfs_data"

So OpenWRT managed to split rootfs adding new rootfs_data which maches
erasesize nicely! :)


> For a firmware upgrade we need write access to the hole flash chip,
> including the header at best.

We probably could register some special partition for that.

-- 
Rafał
_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to