mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2024-11-24 02:34:06 +02:00
package/mtd: fix automatic partition size detection in fis_remap
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@20537 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
b7a78cb18e
commit
a24b24783c
@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
|
|||||||
include $(INCLUDE_DIR)/kernel.mk
|
include $(INCLUDE_DIR)/kernel.mk
|
||||||
|
|
||||||
PKG_NAME:=mtd
|
PKG_NAME:=mtd
|
||||||
PKG_RELEASE:=11
|
PKG_RELEASE:=12
|
||||||
|
|
||||||
PKG_BUILD_DIR := $(KERNEL_BUILD_DIR)/$(PKG_NAME)
|
PKG_BUILD_DIR := $(KERNEL_BUILD_DIR)/$(PKG_NAME)
|
||||||
STAMP_PREPARED := $(STAMP_PREPARED)_$(call confvar,CONFIG_MTD_REDBOOT_PARTS)
|
STAMP_PREPARED := $(STAMP_PREPARED)_$(call confvar,CONFIG_MTD_REDBOOT_PARTS)
|
||||||
|
@ -146,7 +146,7 @@ fis_remap(struct fis_part *old, int n_old, struct fis_part *new, int n_new)
|
|||||||
struct fis_image_desc *desc;
|
struct fis_image_desc *desc;
|
||||||
struct fis_part *part;
|
struct fis_part *part;
|
||||||
uint32_t offset = 0, size = 0;
|
uint32_t offset = 0, size = 0;
|
||||||
char *end, *tmp;
|
char *start, *end, *tmp;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
desc = fis_open();
|
desc = fis_open();
|
||||||
@ -156,6 +156,7 @@ fis_remap(struct fis_part *old, int n_old, struct fis_part *new, int n_new)
|
|||||||
if (!quiet)
|
if (!quiet)
|
||||||
fprintf(stderr, "Updating FIS table... \n");
|
fprintf(stderr, "Updating FIS table... \n");
|
||||||
|
|
||||||
|
start = (char *) desc;
|
||||||
end = (char *) desc + fis_erasesize;
|
end = (char *) desc + fis_erasesize;
|
||||||
while ((char *) desc < end) {
|
while ((char *) desc < end) {
|
||||||
if (!desc->hdr.name[0] || (desc->hdr.name[0] == 0xff))
|
if (!desc->hdr.name[0] || (desc->hdr.name[0] == 0xff))
|
||||||
@ -167,9 +168,12 @@ fis_remap(struct fis_part *old, int n_old, struct fis_part *new, int n_new)
|
|||||||
if (!strcmp((char *) desc->hdr.name, "RedBoot"))
|
if (!strcmp((char *) desc->hdr.name, "RedBoot"))
|
||||||
redboot = desc;
|
redboot = desc;
|
||||||
|
|
||||||
|
/* update max offset */
|
||||||
|
if (offset < desc->hdr.flash_base)
|
||||||
|
offset = desc->hdr.flash_base;
|
||||||
|
|
||||||
for (i = 0; i < n_old; i++) {
|
for (i = 0; i < n_old; i++) {
|
||||||
if (!strncmp((char *) desc->hdr.name, (char *) old[i].name, sizeof(desc->hdr.name))) {
|
if (!strncmp((char *) desc->hdr.name, (char *) old[i].name, sizeof(desc->hdr.name))) {
|
||||||
size += desc->hdr.size;
|
|
||||||
last = desc;
|
last = desc;
|
||||||
if (!first)
|
if (!first)
|
||||||
first = desc;
|
first = desc;
|
||||||
@ -180,13 +184,21 @@ fis_remap(struct fis_part *old, int n_old, struct fis_part *new, int n_new)
|
|||||||
}
|
}
|
||||||
desc--;
|
desc--;
|
||||||
|
|
||||||
if (desc == last) {
|
/* determine size of available space */
|
||||||
desc = fisdir;
|
desc = (struct fis_image_desc *) start;
|
||||||
}
|
while ((char *) desc < end) {
|
||||||
|
if (!desc->hdr.name[0] || (desc->hdr.name[0] == 0xff))
|
||||||
|
break;
|
||||||
|
|
||||||
/* size fixup */
|
if (desc->hdr.flash_base > last->hdr.flash_base &&
|
||||||
if (desc && (last->hdr.flash_base < desc->hdr.flash_base - last->hdr.size))
|
desc->hdr.flash_base < offset)
|
||||||
size += (desc->hdr.flash_base - last->hdr.flash_base) - last->hdr.size;
|
offset = desc->hdr.flash_base;
|
||||||
|
|
||||||
|
desc++;
|
||||||
|
}
|
||||||
|
desc--;
|
||||||
|
|
||||||
|
size = offset - first->hdr.flash_base;
|
||||||
|
|
||||||
#ifdef notyet
|
#ifdef notyet
|
||||||
desc = first - 1;
|
desc = first - 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user