1
0
Fork 0
mirror of https://github.com/suchmememanyskill/TegraExplorer.git synced 2024-11-22 11:56:42 +00:00

Partitioning: add 16mb in front

This commit is contained in:
Such Meme, Many Skill 2019-12-04 17:47:13 +01:00
parent 73a6fc460b
commit b0094f133c
2 changed files with 12 additions and 6 deletions

View file

@ -6134,13 +6134,14 @@ FRESULT f_fdisk (
sz_part = (DWORD)sz_cyl * p_cyl;
if (i == 0) { /* Exclude first track of cylinder 0 */
s_hd = 1;
s_part += 63; sz_part -= 63;
s_part += 32831; sz_part -= 32831;
} else {
s_hd = 0;
}
e_cyl = b_cyl + p_cyl - 1; /* End cylinder */
if (e_cyl >= tot_cyl) LEAVE_MKFS(FR_INVALID_PARAMETER);
/* Set partition table */
p[1] = s_hd; /* Start head */
p[2] = (BYTE)(((b_cyl >> 2) & 0xC0) | 1); /* Start sector */
@ -6151,7 +6152,6 @@ FRESULT f_fdisk (
p[7] = (BYTE)e_cyl; /* End cylinder */
st_dword(p + 8, s_part); /* Start sector in LBA */
st_dword(p + 12, sz_part); /* Number of sectors */
/* Next partition */
b_cyl += p_cyl;
}

View file

@ -6,6 +6,7 @@
#include "../soc/gpio.h"
#include "../utils/util.h"
#include "../utils/types.h"
#include "../libs/fatfs/diskio.h"
extern bool sd_mount();
extern void sd_unmount();
@ -14,7 +15,7 @@ void displayinfo(){
clearscreen();
FATFS *fs;
DWORD fre_clust, fre_sect, tot_sect, temp_sect;
DWORD fre_clust, fre_sect, tot_sect, temp_sect, sz_disk;
int res;
gfx_printf("Getting storage info: please wait...");
@ -30,7 +31,12 @@ void displayinfo(){
temp_sect = tot_sect;
temp_sect -= 61145088;
gfx_printf("\n1st part: %d\n2nd part: 61145088", temp_sect);
gfx_printf("\n1st part: %d\n2nd part: 61145088\n\n", temp_sect);
disk_initialize(0);
disk_ioctl(0, GET_SECTOR_COUNT, &sz_disk);
gfx_printf("total sectors: %d", sz_disk);
btn_wait();
}
@ -74,14 +80,14 @@ void format(){
gfx_printf("Getting free cluster info from 1st partition");
if (res = f_getfree("sd:", &fre_clust, &fs))
gfx_printf("%kGetfree failed! errcode %d", COLOR_RED, res);
gfx_printf("%kGetfree failed! errcode %d", COLOR_ORANGE, res);
else {
tot_sect = (fs->n_fatent - 2) * fs->csize;
temp_sect = tot_sect;
temp_sect -= 61145089;
gfx_printf("Total sectors: %d\nFree after emummc: %d\n\n", tot_sect, temp_sect);
if (temp_sect < 0)
gfx_printf("%kNot enough space free!\n", COLOR_RED);
gfx_printf("%kNot enough space free!\n", COLOR_ORANGE);
else {
gfx_printf("Partitioning sd...\nPartition1 size: %d\nPartition2 size: %d\n", plist[0], plist[1]);
plist[0] = temp_sect;