#include <errno.h> #include <inttypes.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <arpa/inet.h> uint32_t convert(uint8_t *test, uint64_t loc) { return ntohl((test[loc] << 24) | (test[loc+1] << 16) | (test[loc+2] << 8) | test[loc+3]); } void main(void) { FILE *fileptr; uint8_t *buffer; long filelen; FILE *f; char *filename; uint64_t record; uint64_t record_loc; uint64_t file_loc; uint64_t file_size; fileptr = fopen("aml_upgrade_package.img", "rb"); fseek(fileptr, 0, SEEK_END); filelen = ftell(fileptr); rewind(fileptr); buffer = (uint8_t *)malloc((filelen+1)*sizeof(uint8_t)); fread(buffer, filelen, 1, fileptr); fclose(fileptr); for (record = 0; record < (uint8_t)buffer[0x18]; record = record + 1){ record_loc = 0x40 + (record * 0x240); filename = (malloc(32)); sprintf(filename,"%s.%s",(char *)&buffer[record_loc+0x120], (char *)&buffer[record_loc+0x20]); file_loc = convert(buffer,record_loc+0x10); file_size = convert(buffer,record_loc+0x18); f = fopen(filename, "wb"); if (f == NULL) { printf("ERROR: could not open output\n"); printf("the error was: %s\n",strerror(errno)); free(filename); continue; } fwrite(&(buffer[file_loc]), sizeof(uint8_t), (size_t)file_size, f); fclose(f); free(filename); } free(buffer); }
Announcement
Collapse
No announcement yet.
Announcement
Collapse
No announcement yet.
aml_upgrade_package.img extract
Collapse
X
-
aml_upgrade_package.img extract
Thought this might be useful for someone, I whipped it up tonight so I don't have to use Windows to extract the files anymore.
Code:Tags: None
-
Nice script calc
Here you all can find a full documentation on how to use/compile this c script with linux.
And I think this script should moved by one of the mods to the sub forum Knowledge & Tutorials.
Because here it fades completely next to the seal attraction (ROM).
Notice: Moved topic at your request. Left one week redirect. -RISCy DudeMy contributions to the community
[ ROMs ] Z4 RK3368 - android TV (ATV) | MXQ PRO 4K - p201 - android TV (ATV) | Yundo Y1 S912 - android TV (ATV) not yet released
[ Tutorials ] Bootup logo Amlogic S912 devices | Redefine any Keyboard, Gamepad, Remote Control
Comment
-
Originally posted by calc View PostThought this might be useful for someone, I whipped it up tonight so I don't have to use Windows to extract the files anymore.
What is the license of this code? GPL? BSD? or other?
I ask this because I would like to add it as a package for openSUSE (or inside an existing package). With your nickname/name and link to this page of course! Or a link to a git tree if you have one.
Comment
What's Going On
Collapse
There are currently 2583 users online. 0 members and 2583 guests.
Most users ever online was 37,478 at 04:14 on 26 June 2024.
Comment