Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int dump_sunxi1()
- {
- int ret;
- int result = 0;
- u32 offset = 0;
- fel_version_t ver = { 0 };
- ret = fel_init();
- if (ret)
- {
- printf("Error %d calling fel_init()\n", ret);
- return ret;
- }
- ret = fel_connect(0, NULL);
- if (ret)
- {
- printf("Error %d calling fel_connect()\n", ret);
- fel_exit();
- return ret;
- }
- printf("Writing 0 to is_inited flag\r\n");
- u8 nullbuf[4] = { 0x00,0x00,0x00,0x00 };
- ret = fel_cmd_poke(0x40000, &nullbuf, 4);
- if (ret < 0)
- {
- printf("Error writing nulls to is_inited flag!");
- exit(0);
- }
- FILE* fp = fopen("sunxi_package_test.bin", "r+b");
- //int start_sector = 0;
- //int start_sector = 0x1DBF55; // REDUMP THIS LATER FROM OTHER BOARD!!! FUCKED UP!!
- int start_sector = 0x8020;
- printf("Updating sector in memory to %i...\r\n", start_sector);
- ret = fel_cmd_poke(0x40004, &start_sector, 4);
- if (ret < 0)
- {
- printf("Error writing sector to 0");
- exit(0);
- }
- printf("Uploading payload\r\n");
- ret = upload_file_to_memory("dump_emmc_payload.bin", 0x27000);
- if (ret < 0)
- {
- printf("Error while uploading file to memory!\r\n");
- }
- printf("Starting read sector loop\r\n");
- ret = fel_cmd_execute(0x27000);
- if (ret < 0)
- {
- printf("Error while executing payload!\r\n");
- }
- u8 data_read[512];
- ret = fel_cmd_peek(data_read, 0x20000, 512);
- if (ret < 0)
- {
- printf("Peeking the read data failed!\r\n");
- }
- fwrite(data_read, 512, 1, fp);
- fflush(fp);
- printf("Reading last sector read value..\r\n");
- int last_sector = 0;
- ret = fel_cmd_peek(&last_sector, 0x40004, 4);
- if (ret < 0)
- {
- printf("Error getting last sector read!\r\n");
- }
- printf("Last sector read: %i\r\n", last_sector);
- fclose(fp);
- }
Add Comment
Please, Sign In to add comment