Modernize MakeROM build system + bug fixes (#120)

* Move files around to new directory structure

* Rework libyaml into a stand-alone dep for makerom.

* Rework libpolarssl to be standalone dependency for makerom.

* Update includes.

* Delete makefile

* Add new makefile for makerom.

* Update MakeROM github actions script.

* Fix again.

* Update MakeROM's makefile

* Tweak makerom build script

* Tweak MakeROM build script.

* Fix typo

* Update MakeROM makefiles.

* Tweak CTRTool build script.

* Tweak build script

* Tweak CTRTool build script.

* Tweak CTRTool build script

* Add libmbedtls to makerom deps

* Partially migrate makerom to libmbedtls

* Break out libblz as an external dependency for makerom.

* Tweak makerom build script.

* Move dependencies to the top level.

* Put everything back.

* misc

* Update makerom documentation.

* Link to ctrtool/makerom readmes from the root readme.

* Update root readme again.

* Migrate makerom to modern mbedtls

* Bump makerom version to 0.18.1

* Change signing errors to be warnings when they fail.

* Add error verbosity to errors when generating CIA files.

* Fix bug in RSA code.

* misc.

* Remove polarssl now migration to mbedtls complete.

* Surface more makerom errors.

* [makerom] Tolerate CCI signing errors as a warning.

* Add missing return.

* Import initial data key_x (prod/dev included)

* [makerom] Fix initial data generation.
This commit is contained in:
Jack
2022-04-17 10:49:05 +08:00
committed by GitHub
parent 8a9f9bda55
commit cc707c160f
290 changed files with 115424 additions and 10431 deletions
+55
View File
@@ -0,0 +1,55 @@
#pragma once
typedef struct
{
u64 size;
u8 *buffer;
} buffer_struct;
// Memory
int CopyData(u8 **dest, const u8 *source, u64 size);
void rndset(void *ptr, u64 num);
void clrmem(void *ptr, u64 num);
// MISC
u64 roundup(u64 value, u64 alignment);
u64 align(u64 value, u64 alignment);
u64 min64(u64 a, u64 b);
u64 max64(u64 a, u64 b);
// Strings
void memdump(FILE* fout, const char* prefix, const u8* data, u32 size);
char* replace_filextention(const char *input, const char *extention);
// Base64
bool IsValidB64Char(char chr);
size_t b64_strlen(const char *str);
void b64_strcpy(char *dst, const char *src);
int b64_decode(u8 *dst, const char *src, size_t dst_size);
// Pseudo-Random Number Generator
void initRand(void);
u8 u8GetRand(void);
u16 u16GetRand(void);
u32 u32GetRand(void);
u64 u64GetRand(void);
//Char IO
bool AssertFile(char *filename);
u64 GetFileSize64(char *filename);
int makedir(const char* dir);
int TruncateFile64(char *filename, u64 filelen);
//IO Misc
u8* ImportFile(char *file, u64 size);
void WriteBuffer(const void *buffer, u64 size, u64 offset, FILE *output);
void ReadFile64(void *outbuff, u64 size, u64 offset, FILE *file);
int fseek_64(FILE *fp, u64 file_pos);
//Data Size conversion
u16 u8_to_u16(const u8 *value, u8 endianness);
u32 u8_to_u32(const u8 *value, u8 endianness);
u64 u8_to_u64(const u8 *value, u8 endianness);
int u16_to_u8(u8 *out_value, u16 in_value, u8 endianness);
int u32_to_u8(u8 *out_value, u32 in_value, u8 endianness);
int u64_to_u8(u8 *out_value, u64 in_value, u8 endianness);