sysupgrade : removed unused code

We want to extract rootfs image from ubi without any
changes, as we are traversing through the rootfs image
for 0xdeadc0de in extract_rootfs_binary() to extract
the image till 0xdeadc0de offset.

Change-Id: Iefeec6db72b65310310d74835b68ec3d22144608
Signed-off-by: Vijay Balaji <quic_vijbal@quicinc.com>
This commit is contained in:
Vijay Balaji 2023-07-21 18:28:18 +05:30 committed by Gerrit - the friendly Code Review server
parent ad1d2f1144
commit 91b4536719

View file

@ -909,21 +909,6 @@ int extract_ubi_volume(char *vol_name, char *if_name, char *of_name)
}
curr_vol_id = be32_to_cpu(ubi_vol->vol_id);
if (curr_vol_id == ret_vol_id) {
if (!strncmp(vol_name, "ubi_rootfs", strlen("ubi_rootfs"))) {
struct ubi_ec_hdr *ubi_ec_next = (struct ubi_ec_hdr *)((uint8_t *)ubi_ec + data_offset + data_size);
int magic = be32_to_cpu(ubi_ec_next->magic);
if(magic != UBI_EC_HDR_MAGIC) {
uint8_t *tmp = (uint8_t *)ubi_ec + data_offset;
int max_limit = data_size;
int byte = 0;
while (byte < max_limit) {
if ((*(tmp+byte) == 0xde) && (*(tmp+byte+1) == 0xad) && (*(tmp+byte+2) == 0xc0) && (*(tmp+byte+3) == 0xde)) {
data_size = byte;
}
byte = byte + 1;
}
}
}
if (write(ofd, (void *)((uint8_t *)ubi_ec + data_offset), data_size) == -1) {
printf("Write error\n");
close(fd);
@ -1018,7 +1003,7 @@ int extract_rootfs_binary(char *filename)
}
int offset = 0,dead_off;
while ( offset < sb.st_size)
while ( offset <= sb.st_size)
{
if ((fp[offset] == 0xde) && (fp[offset+1] == 0xad) && (fp[offset+2] == 0xc0) && (fp[offset+3] == 0xde)) {
dead_off=offset;