-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
modularise, wip nand_extract (unfinished)
- Loading branch information
1 parent
7d35711
commit c76807d
Showing
23 changed files
with
1,237 additions
and
318 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#include <stdint.h> | ||
#include <stdbool.h> | ||
|
||
bool cb_is_decrypted(uint8_t *cb_data); | ||
void cb_print_info(uint8_t *cb_data); | ||
void cb_decrypt(uint8_t *cb_data, uint8_t *cba_or_1bl_key); | ||
void cb_b_decrypt(uint8_t *cb_b_data, uint8_t *cb_a_data, uint8_t *cpu_key); | ||
void cb_calculate_rotsum(uint8_t *cb_data, uint8_t *sha_out); | ||
bool cb_verify_signature(uint8_t *cb_data); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#include <stdint.h> | ||
#include <stdbool.h> | ||
|
||
bool cd_is_decrypted(uint8_t *cd_data); | ||
void cd_print_info(uint8_t *cd_data); | ||
void cd_decrypt(uint8_t *cd_data, uint8_t *cbb_key, uint8_t *cpu_key); | ||
void cd_calculate_rotsum(uint8_t *cd_data, uint8_t *sha_out); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
int do_decompress_command(int argc, char **argv); | ||
int do_nand_extract_command(int argc, char **argv); | ||
int do_xboxupd_command(int argc, char **argv); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
// Reference: https://free60.org/System-Software/NAND_File_System/ | ||
// these all need checking before i want to rely on using them for anything | ||
#include <stdint.h> | ||
|
||
// ECC spare data used on 1st gen NAND controllers | ||
typedef struct _ecc_data_v1 { | ||
// uint16_t block_id : 12; | ||
uint8_t block_id_1; | ||
uint8_t block_id_0 : 4; | ||
|
||
uint8_t fs_unused : 4; | ||
uint8_t fs_sequence_0; | ||
uint8_t fs_sequence_1; | ||
uint8_t fs_sequence_2; | ||
uint8_t bad_block; | ||
uint8_t fs_sequence_3; | ||
|
||
// uint16_t fs_size; | ||
uint8_t fs_size_1; | ||
uint8_t fs_size_0; | ||
|
||
uint8_t fs_page_count; | ||
uint8_t fs_unused_2[2]; | ||
uint8_t fs_block_type : 6; | ||
|
||
// 14-bit ECC data | ||
uint8_t ecc3 : 2; | ||
uint8_t ecc2; | ||
uint8_t ecc1; | ||
uint8_t ecc0; | ||
} ecc_data_v1; | ||
|
||
// ECC spare data used on 2nd gen NAND controllers (16/64MB) | ||
typedef struct _ecc_data_v2_sb { | ||
uint8_t fs_sequence_0; | ||
|
||
// uint16_t block_id : 12; | ||
uint8_t block_id_1; | ||
uint8_t block_id_0 : 4; | ||
|
||
uint8_t fs_unused : 4; | ||
uint8_t fs_sequence_1; | ||
uint8_t fs_sequence_2; | ||
uint8_t bad_block; | ||
uint8_t fs_sequence_3; | ||
|
||
// uint16_t fs_size; | ||
uint8_t fs_size_1; | ||
uint8_t fs_size_0; | ||
|
||
uint8_t fs_page_count; | ||
uint8_t fs_unused_2[2]; | ||
uint8_t fs_block_type : 6; | ||
|
||
// 14-bit ECC data | ||
uint8_t ecc3 : 2; | ||
uint8_t ecc2; | ||
uint8_t ecc1; | ||
uint8_t ecc0; | ||
} ecc_data_v2_sb; | ||
|
||
// ECC spare data used on 2nd gen NAND controllers (256/512MB) | ||
typedef struct _ecc_data_v2_bb { | ||
uint8_t bad_block; | ||
|
||
// uint16_t block_id : 12; | ||
uint8_t block_id_1; | ||
uint8_t block_id_0 : 4; | ||
|
||
uint8_t fs_unused : 4; | ||
uint8_t fs_sequence_2; | ||
uint8_t fs_sequence_1; | ||
uint8_t fs_sequence_0; | ||
uint8_t fs_unused_2; | ||
|
||
// uint16_t fs_size; | ||
uint8_t fs_size_1; | ||
uint8_t fs_size_0; | ||
|
||
uint8_t fs_page_count; | ||
uint8_t fs_unused_3[2]; | ||
uint8_t fs_block_type : 6; | ||
|
||
// 14-bit ECC data | ||
uint8_t ecc3 : 2; | ||
uint8_t ecc2; | ||
uint8_t ecc1; | ||
uint8_t ecc0; | ||
} ecc_data_v2_bb; | ||
|
||
void calculate_nand_ecc(uint8_t page[0x200], uint8_t spare[0x10], uint8_t ecc[0x4]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.