MTD partitioning & firmware installation on Broadcom devices
Rafał Miłecki
zajec5 at gmail.com
Mon Mar 8 17:37:59 GMT 2021
Hi,
I'm trying to implement firmware installation on BCM4908 platform.
It's related to MTD and partitioning.
BCM4908 firmware image consists of:
1. "bootfs" JFFS2 partition with: 94908.dtb, cferam.000 and vmlinux.lz
2. "ubi" UBI partition appended to the "bootfs"
The problem is that when flashing firmware image then cferam.000 file
in the "bootfs" JFFS2 partition has to be renamed. "000" part has to
be changed to the last used number + 1.
Example:
Let's say device is running firmware with "bootfs" JFFS2 partition
containing cferam.007.
After flashing new firmware "bootfs" JFFS2 partition should contain
cferam.008 (instead of cferam.000 as provided in the firmware image).
I'm trying to find a way for handling that.
Solution #1
Renaming cferam.000 before flashing (mtd write) image.
I don't see any clean way of doing that. I could extract bootfs.jffs2
out of firmware image but:
1. There is no tool for modifying JFFS2 images
2. The only tool for extracting JFFS2 image content is Python script.
Python seems too heavy solution for firmware upgrade task.
3. I can't mount boofs.jffs2. I'd need some virtual mtd device. Also a
bit overkill it seems.
Solution #2
Flashing firmware image as is (with cferam.000) and adjusting it.
This should be nicer as mounting JFFS2 MTD partition is simple. The
problem is partitioning.
I'd need to remove MTD partitions and trigger re-partitioning of
"firmware" partition. Only once I have Linux create "bootfs" and "ubi"
partitions again for me I could mount "bootfs" and rename the file.
There is no support for such repartitioning at this point AFAIK.
Can you see any other solution I didn't think about?
Or should I proceed with one of above solutions? Like writing a tool
for modifying JFFS2 images. Or patching MTD to support repartitioning?
--
Rafał
More information about the linux-mtd
mailing list