From cd848873b63b750cc7dc8846756626e545fffbb2 Mon Sep 17 00:00:00 2001 From: yutaka Date: Mon, 3 Mar 2008 04:45:21 +0000 Subject: [PATCH] =?UTF-8?q?aes=5Fprivate=E3=81=8C=E7=84=A1=E3=81=8F?= =?UTF-8?q?=E3=81=AA=E3=81=A3=E3=81=9F=E3=81=AE=E3=81=A7=E3=80=81menu=5Fla?= =?UTF-8?q?uncher2=E3=81=AF=E5=86=8D=E3=81=B3=E5=B0=81=E5=8D=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlIPL/trunk@781 b08762b0-b915-fc4b-9d8c-17b2551a87ff --- build/libraries/fs/ARM9/Makefile | 2 +- build/libraries/fs/ARM9/src/fs_loader2.c | 412 ------------------ build/nandfirm/Makefile | 5 +- build/nandfirm/menu-launcher2/ARM7/Makefile | 49 --- build/nandfirm/menu-launcher2/ARM7/main.c | 317 -------------- build/nandfirm/menu-launcher2/ARM9/Makefile | 59 --- build/nandfirm/menu-launcher2/ARM9/main.c | 353 --------------- build/nandfirm/menu-launcher2/Makefile | 48 -- build/nandfirm/menu-launcher2/nandfirm.nandsf | 24 - .../menu-launcher2/wram_regs/Makefile | 57 --- .../menu-launcher2/wram_regs/wram_regs.c | 91 ---- 11 files changed, 3 insertions(+), 1414 deletions(-) delete mode 100644 build/libraries/fs/ARM9/src/fs_loader2.c delete mode 100644 build/nandfirm/menu-launcher2/ARM7/Makefile delete mode 100644 build/nandfirm/menu-launcher2/ARM7/main.c delete mode 100644 build/nandfirm/menu-launcher2/ARM9/Makefile delete mode 100644 build/nandfirm/menu-launcher2/ARM9/main.c delete mode 100644 build/nandfirm/menu-launcher2/Makefile delete mode 100644 build/nandfirm/menu-launcher2/nandfirm.nandsf delete mode 100644 build/nandfirm/menu-launcher2/wram_regs/Makefile delete mode 100644 build/nandfirm/menu-launcher2/wram_regs/wram_regs.c diff --git a/build/libraries/fs/ARM9/Makefile b/build/libraries/fs/ARM9/Makefile index 4f7cd66a..5a6beaac 100644 --- a/build/libraries/fs/ARM9/Makefile +++ b/build/libraries/fs/ARM9/Makefile @@ -24,7 +24,7 @@ SUBMAKES = LINCLUDES = $(ES_ROOT)/twl/include -SRCS = fs_firm.c fs_loader.c fs_loader2.c +SRCS = fs_firm.c fs_loader.c TARGET_LIB = libfs$(FIRM_LIBSUFFIX).a diff --git a/build/libraries/fs/ARM9/src/fs_loader2.c b/build/libraries/fs/ARM9/src/fs_loader2.c deleted file mode 100644 index c8f7ae6b..00000000 --- a/build/libraries/fs/ARM9/src/fs_loader2.c +++ /dev/null @@ -1,412 +0,0 @@ -/*---------------------------------------------------------------------------* - Project: TwlIPL - libraries - fs - File: fs_loader.c - - Copyright 2007 Nintendo. All rights reserved. - - These coded instructions, statements, and computer programs contain - proprietary information of Nintendo of America Inc. and/or Nintendo - Company Ltd., and are protected by Federal copyright law. They may - not be disclosed to third parties or copied or duplicated in any form, - in whole or in part, without the prior written consent of Nintendo. - - $Date:: $ - $Rev$ - $Author$ - *---------------------------------------------------------------------------*/ - -#include -#include -#include -#include -#include - -#define FS_HEADER_AUTH_SIZE 0xe00 - -#define MODULE_ALIGNMENT 0x10 // 16バイト単位で読み込む -//#define MODULE_ALIGNMENT 0x200 // 512バイト単位で読み込む -#define RoundUpModuleSize(value) (((value) + MODULE_ALIGNMENT - 1) & -MODULE_ALIGNMENT) - -#define HASH_UNIT 0x1000 - -static ROM_Header* const rh = (ROM_Header*)HW_TWL_ROM_HEADER_BUF; - -static u8 currentKey[ SVC_SHA1_BLOCK_SIZE ]; - -static const u8 defaultKey[ SVC_SHA1_BLOCK_SIZE ] = -{ - 0x21, 0x06, 0xc0, 0xde, - 0xba, 0x98, 0xce, 0x3f, - 0xa6, 0x92, 0xe3, 0x9d, - 0x46, 0xf2, 0xed, 0x01, - - 0x76, 0xe3, 0xcc, 0x08, - 0x56, 0x23, 0x63, 0xfa, - 0xca, 0xd4, 0xec, 0xdf, - 0x9a, 0x62, 0x78, 0x34, - - 0x8f, 0x6d, 0x63, 0x3c, - 0xfe, 0x22, 0xca, 0x92, - 0x20, 0x88, 0x97, 0x23, - 0xd2, 0xcf, 0xae, 0xc2, - - 0x32, 0x67, 0x8d, 0xfe, - 0xca, 0x83, 0x64, 0x98, - 0xac, 0xfd, 0x3e, 0x37, - 0x87, 0x46, 0x58, 0x24, -}; - -static BOOL aesFlag; -static AESCounter aesCounter; -static u8* const aesBuffer = (u8*)HW_FIRM_FS_AES_BUFFER; // 0x2ff3800 - - -/*---------------------------------------------------------------------------* - Name: FS2_SetDigestKey - - Description: set specified key or default key for HMAC-SHA-1 - - Arguments: digestKey pointer to key - if NULL, use default key - - Returns: TRUE if success - *---------------------------------------------------------------------------*/ -static inline void FS2_SetDigestKey( const u8* digestKey ) -{ - if ( digestKey ) - { - MI_CpuCopy8(digestKey, currentKey, SVC_SHA1_BLOCK_SIZE); - } - else - { - MI_CpuCopy8(defaultKey, currentKey, SVC_SHA1_BLOCK_SIZE); - } -} - -static inline BOOL CheckDigest( u8* a, u8* b, BOOL aClr, BOOL bClr ) -{ - BOOL result = TRUE; - int i; - for ( i = 0; i < SVC_SHA1_DIGEST_SIZE; i++ ) - { - if ( a[i] != b[i] ) - { - result = FALSE; - } - } - if ( aClr ) MI_CpuClear8(a, SVC_SHA1_DIGEST_SIZE); - if ( bClr ) MI_CpuClear8(b, SVC_SHA1_DIGEST_SIZE); - return result; -} -#ifdef SUPPORT_CERTIFICATION -/*---------------------------------------------------------------------------* - Name: CheckRomCertificate - - Description: check the certification in the ROM - - ROMヘッダに付加された証明書のチェックを行います。 - makerom.TWL内のコードに依存します。 - - Arguments: pool pointer to the SVCSignHeapContext - pCert pointer to the certification - pCAPubKey pointer to the public key for the certification - gameCode initial code - - Returns: TRUE if success - *---------------------------------------------------------------------------*/ -static BOOL CheckRomCertificate( SVCSignHeapContext* pool, const RomCertificate *pCert, const void* pCAPubKey, u32 gameCode ) -{ - u8 digest[SVC_SHA1_DIGEST_SIZE]; - u8 md[SVC_SHA1_DIGEST_SIZE]; - - // 証明書ヘッダのマジックナンバーチェック - if( pCert->header.magicNumber != TWL_ROM_CERT_MAGIC_NUMBER || - // 証明書ヘッダとROMヘッダのゲームコード一致チェック - pCert->header.gameCode != gameCode ) - { - return FALSE; - } - // 証明書署名チェック - SVC_DecryptSign( pool, &digest, pCert->sign, pCAPubKey ); - - // ダイジェストの計算 - SVC_CalcSHA1( md, pCert, ROM_CERT_SIGN_OFFSET ); - - // 比較 - return CheckDigest(md, digest, TRUE, TRUE); -} -#endif -static void AesCallback(AESResult result, void* arg) -{ - volatile BOOL *pBusy = (BOOL*)arg; - *pBusy = FALSE; - if (result != AES_RESULT_SUCCESS) - { - OS_TPrintf("Failed to decrypt by AES (%d)\n", result); - } -} - -static void CopyWithAes( const void* src, void* dest, u32 size ) -{ - volatile BOOL aesBusy = TRUE; - - AES_SetKeySlot( AES_KEY_SLOT_A ); - aesBusy = TRUE; - if ( AES_RESULT_SUCCESS == AES_Ctr( &aesCounter, src, size, dest, AesCallback, (void*)&aesBusy ) ) - { - while ( aesBusy ) - { - } - } - AES_AddToCounter( &aesCounter, size / AES_BLOCK_SIZE ); -} - -static void EnableAes( u32 offset ) -{ - aesFlag = TRUE; - MI_CpuCopy8( rh->s.main_static_digest, &aesCounter, AES_BLOCK_SIZE ); - AES_AddToCounter( &aesCounter, (offset - rh->s.aes_target_rom_offset) / AES_BLOCK_SIZE ); -} -static void DisableAes( void ) -{ - aesFlag = FALSE; -} - -/*---------------------------------------------------------------------------* - Name: GetTransferSize - - Description: get size to transfer once - - 一度に受信するサイズを返します。 - - 転送範囲がAES領域をまたぐ場合は、境界までのサイズ (引数より - 小さなサイズ) を返します。 - makerom.TWLまたはIPLの使用に依存します。 - - Arguments: offset offset of region from head of ROM_Header - size size of region - - Returns: size to transfer once - *---------------------------------------------------------------------------*/ -static u32 GetTransferSize( u32 offset, u32 size ) -{ - if ( rh->s.enable_aes ) - { - u32 end = offset + RoundUpModuleSize(size); - u32 aes_offset = rh->s.aes_target_rom_offset; - u32 aes_end = aes_offset + RoundUpModuleSize(rh->s.aes_target_size); - u32 aes_offset2 = rh->s.aes_target2_rom_offset; - u32 aes_end2 = aes_offset2 + RoundUpModuleSize(rh->s.aes_target2_size); - if ( offset >= aes_offset && offset < aes_end ) - { - if ( end > aes_end ) - { - size = aes_end - offset; - } - if ( size > HW_FIRM_FS_AES_BUFFER_SIZE ) - { - size = HW_FIRM_FS_AES_BUFFER_SIZE; - } - EnableAes( offset ); - } - else if ( offset >= aes_offset2 && offset < aes_end2 ) - { - if ( end > aes_end2 ) - { - size = aes_end2 - offset; - } - if ( size > HW_FIRM_FS_AES_BUFFER_SIZE ) - { - size = HW_FIRM_FS_AES_BUFFER_SIZE; - } - EnableAes( offset ); - } - else - { - if ( offset < aes_offset && offset + size > aes_offset ) - { - size = aes_offset - offset; - } - DisableAes(); - } - } - else - { - DisableAes(); - } - return size; -} - -/*---------------------------------------------------------------------------* - Name: FS2_LoadModule - - Description: receive data from ARM7 via WRAM-B and store in destination address - in view of AES settings in the ROM header at HW_TWL_ROM_HEADER_BUF, - then verify the digest - - Arguments: pFile pointer to FSFile streucture - dest destination address to read - offset file offset to start to read in bytes - size total length to read in bytes - digest digest to verify - - Returns: TRUE if success - *---------------------------------------------------------------------------*/ -BOOL FS2_LoadModule( FSFile *pFile, u8* dest, u32 offset, u32 size, const u8 digest[SVC_SHA1_DIGEST_SIZE] ) -{ - u8 md[SVC_SHA1_DIGEST_SIZE]; - u8* hmacDest = dest; - u32 hmacSize = size; - - if ( !FS_SeekFile( pFile, (s32)offset, FS_SEEK_SET ) ) - { - return FALSE; - } - size = RoundUpModuleSize( size ); - while ( size > 0 ) - { - u32 unit = GetTransferSize( offset, size ); - if ( aesFlag ) - { - if ( !FS_ReadFile( pFile, aesBuffer, (s32)unit ) ) - { - return FALSE; - } - DC_FlushRange( aesBuffer, unit ); - CopyWithAes( aesBuffer, dest, unit ); - } - else - { - if ( !FS_ReadFile( pFile, dest, (s32)unit ) ) - { - return FALSE; - } - } - dest += unit; - offset += unit; - size -= unit; - } - SVC_CalcHMACSHA1( md, hmacDest, hmacSize, currentKey, SVC_SHA1_BLOCK_SIZE ); - return CheckDigest(md, (u8*)digest, TRUE, FALSE); -} - -/*---------------------------------------------------------------------------* - Name: FS2_OpenSrl - - Description: open srl file named at HW_TWL_FS_BOOT_SRL_PATH_BUF - - Arguments: pFile pointer to FSFile streucture - - Returns: TRUE if success - *---------------------------------------------------------------------------*/ -BOOL FS2_OpenSrl( FSFile *pFile ) -{ - return FS_OpenFileEx( pFile, (char*)HW_TWL_FS_BOOT_SRL_PATH_BUF, FS_FILEMODE_R ); -} - -/*---------------------------------------------------------------------------* - Name: FS2_LoadHeader - - Description: load ROM header to HW_TWL_ROM_HEADER_BUF using normal FS, - and verify signature - - Arguments: pFile pointer to FSFile streucture - pool heap context to call SVC_DecryptSign - rsa_key1 public key to verify the signature - rsa_key2 public key to verify the signature - for system applications - - Returns: TRUE if success - *---------------------------------------------------------------------------*/ -BOOL FS2_LoadHeader( FSFile *pFile, SVCSignHeapContext* pool, const void* rsa_key1, const void* rsa_key2 ) -{ - const void* rsa_key; - u8 md[SVC_SHA1_DIGEST_SIZE]; - SignatureData sd; - - if ( !FS_SeekFile( pFile, 0, FS_SEEK_SET ) ) - { - return FALSE; - } - if ( !FS_ReadFile( pFile, rh, HW_TWL_ROM_HEADER_BUF_SIZE ) ) - { - return FALSE; - } - SVC_CalcSHA1( md, rh, FS_HEADER_AUTH_SIZE ); - - // 鍵の確定 - rsa_key = (rh->s.titleID_Hi & 0x1) ? rsa_key2 : rsa_key1; -#ifdef SUPPORT_CERTIFICATION - // コンテンツ証明書 - if ( CheckRomCertificate( pool, &rh->certificate, rsa_key, *(u32*)rh->s.game_code ) ) - { - rsa_key = rh->certificate.pubKeyMod; // ヘッダ用の鍵の取り出し - } - else - { - // とりあえずコンテンツ証明書用の鍵がそのまま使えると仮定 - } -#endif - // ヘッダ署名チェック - SVC_DecryptSign( pool, &sd, rh->signature, rsa_key ); - - if ( !CheckDigest( md, sd.digest, TRUE, FALSE ) ) - { - MI_CpuClear8( &sd, sizeof(sd) ); // 残り削除 (他に必要なものはない?) - return FALSE; - } - - // ダイジェスト以外のデータのチェックが必要!! - - MI_CpuClear8( &sd, sizeof(sd) ); // 残り削除 (他に必要なものはない?) - - // ROMヘッダのコピー - MI_CpuCopyFast( rh, (void*)HW_ROM_HEADER_BUF, HW_ROM_HEADER_BUF_END-HW_ROM_HEADER_BUF ); - return TRUE; -} - -/*---------------------------------------------------------------------------* - Name: FS2_LoadStatic - - Description: receive static regions from ARM6 via WRAM-B and store them - specified by ROM header at HW_TWL_ROM_HEADER_BUF - - Arguments: pFile pointer to FSFile streucture - digestKey pointer to key for HMAC-SHA1 - if NULL, use default key - - Returns: TRUE if success - *---------------------------------------------------------------------------*/ -BOOL FS2_LoadStatic( FSFile *pFile, const u8* digestKey ) -{ - FS2_SetDigestKey( digestKey ); - if ( rh->s.main_size > 0 ) - { - if ( !FS2_LoadModule( pFile, rh->s.main_ram_address, rh->s.main_rom_offset, rh->s.main_size, rh->s.main_static_digest ) ) - { - return FALSE; - } - } - if ( rh->s.sub_size > 0 ) - { - if ( !FS2_LoadModule( pFile, rh->s.sub_ram_address, rh->s.sub_rom_offset, rh->s.sub_size, rh->s.sub_static_digest ) ) - { - return FALSE; - } - } - if ( rh->s.main_ltd_size > 0 ) - { - if ( !FS2_LoadModule( pFile, rh->s.main_ltd_ram_address, rh->s.main_ltd_rom_offset, rh->s.main_ltd_size, rh->s.main_ltd_static_digest ) ) - { - return FALSE; - } - } - if ( rh->s.sub_ltd_size > 0 ) - { - if ( !FS2_LoadModule( pFile, rh->s.sub_ltd_ram_address, rh->s.sub_ltd_rom_offset, rh->s.sub_ltd_size, rh->s.sub_ltd_static_digest ) ) - { - return FALSE; - } - } - return TRUE; -} diff --git a/build/nandfirm/Makefile b/build/nandfirm/Makefile index c7621800..dcf55520 100644 --- a/build/nandfirm/Makefile +++ b/build/nandfirm/Makefile @@ -12,8 +12,8 @@ # in whole or in part, without the prior written consent of Nintendo. # # $Date:: $ -# $Rev:$ -# $Author:$ +# $Rev$ +# $Author$ #---------------------------------------------------------------------------- include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs @@ -25,7 +25,6 @@ SUBDIRS_P = \ nandfirm-print \ sdmc-launcher \ menu-launcher \ - menu-launcher2 \ #---------------------------------------------------------------------------- diff --git a/build/nandfirm/menu-launcher2/ARM7/Makefile b/build/nandfirm/menu-launcher2/ARM7/Makefile deleted file mode 100644 index 9ffe2fba..00000000 --- a/build/nandfirm/menu-launcher2/ARM7/Makefile +++ /dev/null @@ -1,49 +0,0 @@ -#! make -f -#---------------------------------------------------------------------------- -# Project: TwlFirm - tools - menu-launcher2 -# File: Makefile -# -# Copyright 2007 Nintendo. All rights reserved. -# -# These coded instructions, statements, and computer programs contain -# proprietary information of Nintendo of America Inc. and/or Nintendo -# Company Ltd., and are protected by Federal copyright law. They may -# not be disclosed to third parties or copied or duplicated in any form, -# in whole or in part, without the prior written consent of Nintendo. -# -# $Date:: $ -# $Rev$ -# $Author$ -#---------------------------------------------------------------------------- - -TWL_PROC = ARM7 - -SUBDIRS = - -LINCLUDES = - -#---------------------------------------------------------------------------- - -TARGET_BIN = menu_launcher2_7.tef - -SRCS = main.c - -CRT0_O = crt0_firm.o - -#LCFILE_TEMPLATE = $(FIRM_SPECDIR)/$(TWL_PROC)-$(TWL_PLATFORM)-PARTNER.lcf.template - -#SRCDIR = # using default -#LCFILE = # using default - -include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs - -MAKELCF_FLAGS += -DADDRESS_LTDWRAM='0x037c0000' - -#---------------------------------------------------------------------------- - -do-build: $(TARGETS) - - -include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules - -#===== End of Makefile ===== diff --git a/build/nandfirm/menu-launcher2/ARM7/main.c b/build/nandfirm/menu-launcher2/ARM7/main.c deleted file mode 100644 index b09b5b57..00000000 --- a/build/nandfirm/menu-launcher2/ARM7/main.c +++ /dev/null @@ -1,317 +0,0 @@ -/*---------------------------------------------------------------------------* - Project: TwlFirm - nandfirm - menu-launcher2 - File: main.c - - Copyright 2007 Nintendo. All rights reserved. - - These coded instructions, statements, and computer programs contain - proprietary information of Nintendo of America Inc. and/or Nintendo - Company Ltd., and are protected by Federal copyright law. They may - not be disclosed to third parties or copied or duplicated in any form, - in whole or in part, without the prior written consent of Nintendo. - - $Date:: $ - $Rev$ - $Author$ - *---------------------------------------------------------------------------*/ -#include -#include -#include - -/* - PROFILE_ENABLE を定義するとある程度のパフォーマンスチェックができます。 - 利用するためには、main.cかどこかに、u32 profile[256]; u32 pf_cnt = 0; を - 定義する必要があります。 -*/ -#define PROFILE_ENABLE - -/* - デバッグLEDをFINALROMとは別にOn/Offできます。 -*/ -#define USE_DEBUG_LED - -/* - PRINT_MEMORY_ADDR を定義すると、そのアドレスからSPrintfを行います(このファイルのみ) - FINALROM版でもコードが残るので注意してください。 -*/ -#define PRINT_MEMORY_ADDR 0x02FFC800 - - -#ifdef PROFILE_ENABLE -#define PROFILE_MAX 16 -u32 profile[PROFILE_MAX]; -u32 pf_cnt = 0; -#define PUSH_PROFILE() (profile[pf_cnt++] = (u32)OS_TicksToMicroSeconds(OS_GetTick())) -#else -#define PUSH_PROFILE() ((void)0) -#endif - -#ifdef USE_DEBUG_LED -static u8 step = 0x80; -#define InitDebugLED() I2Ci_WriteRegister(I2C_SLAVE_DEBUG_LED, 0x03, 0x00) -#define SetDebugLED(pattern) I2Ci_WriteRegister(I2C_SLAVE_DEBUG_LED, 0x01, (pattern)); -#else -#define InitDebugLED() ((void)0) -#define SetDebugLED(pattern) ((void)0) -#endif - -#ifdef PRINT_MEMORY_ADDR -static char* debugPtr = (char*)PRINT_MEMORY_ADDR; -#undef OS_TPrintf -//#define OS_TPrintf(...) (debugPtr = (char*)((u32)(debugPtr + STD_TSPrintf(debugPtr, __VA_ARGS__) + 0xf) & ~0xf)) -#define OS_TPrintf(...) (debugPtr += STD_TSPrintf(debugPtr, __VA_ARGS__)) -#endif - -#define THREAD_PRIO_FATFS 8 -#define DMA_FATFS_1 0 -#define DMA_FATFS_2 1 - -extern void* SDNandContext; /* NAND初期化パラメータ */ - -static ROM_Header* const rh= (ROM_Header*)HW_TWL_ROM_HEADER_BUF; - -static OSThread idleThread; -static u64 idleStack[32]; -static void IdleThread(void* arg) -{ -#pragma unused(arg) - OS_EnableInterrupts(); - while (1) - { - OS_Halt(); - } -} -static void CreateIdleThread(void) -{ - OS_CreateThread(&idleThread, IdleThread, NULL, &idleStack[32], sizeof(idleStack), OS_THREAD_PRIORITY_MAX); - OS_WakeupThreadDirect(&idleThread); -} - -// MCU旧バージョン対策 -#if SDK_TS_VERSION <= 200 -static u8 version = 0; -#define IS_OLD_MCU (version ? (version < 0x20) : ((version=MCUi_ReadRegister( MCU_REG_VER_INFO_ADDR )) < 0x20)) -#else -#define IS_OLD_MCU FALSE -#define MCU_OLD_REG_TEMP_ADDR MCU_REG_TEMP_ADDR // avoid compiler error -#endif - -/*************************************************************** - PreInit - - FromBootの対応&メインメモリの初期化 - OS_Init前なので注意 (ARM9によるメインメモリ初期化で消されないように注意) -***************************************************************/ -static void PreInit(void) -{ - /* - バッテリー残量チェック - */ - if ( !IS_OLD_MCU ) // MCU旧バージョン対策 - { - if ( (MCUi_ReadRegister( MCU_REG_POWER_INFO_ADDR ) & MCU_REG_POWER_INFO_LEVEL_MASK) == 0 ) - { -#ifndef SDK_FINALROM - OS_TPanic("Battery is empty.\n"); -#else - PM_Shutdown(); -#endif - } - } - /* - FromBrom関連 - */ - if ( !OSi_FromBromToMenu() ) - { - OS_Terminate(); - } - /* - リセットパラメータ(1バイト)を共有領域(1バイト)にコピー - */ -#define HOTSTART_FLAG_ENABLE 0x80 - if ( IS_OLD_MCU ) // MCU旧バージョン対策 - { - *(u8 *)HW_NAND_FIRM_HOTSTART_FLAG = (u8)(MCUi_ReadRegister( (u16)(MCU_OLD_REG_TEMP_ADDR + OS_MCU_RESET_VALUE_OFS) ) | HOTSTART_FLAG_ENABLE); - } - else - { - *(u8 *)HW_NAND_FIRM_HOTSTART_FLAG = (u8)(MCUi_ReadRegister( (u16)(MCU_REG_TEMP_ADDR + OS_MCU_RESET_VALUE_OFS) ) | HOTSTART_FLAG_ENABLE); - } -} - -/*************************************************************** - PostInit - - 各種初期化 -***************************************************************/ -static void PostInit(void) -{ - // PMICの設定 for old version - PM_InitFIRM(); - // AESの初期化 - AES_Init(); // for encrypted NAND - // アイドルスレッドの作成 - CreateIdleThread(); - /* - バッテリー残量チェック - */ - if ( !IS_OLD_MCU ) // MCU旧バージョン対策 - { - if ( (MCUi_ReadRegister( MCU_REG_POWER_INFO_ADDR ) & MCU_REG_POWER_INFO_LEVEL_MASK) == 0 ) - { -#ifndef SDK_FINALROM - OS_TPanic("Battery is empty.\n"); -#else - PM_Shutdown(); -#endif - } - } -} - -/*************************************************************** - EraseAll - - 不正終了しました - いろいろ消してください - DSモードにして終わるのがよいか? -***************************************************************/ -static void EraseAll(void) -{ - AESi_ResetAesKey(); - MI_CpuClearFast( OSi_GetFromFirmAddr(), sizeof(OSFromFirmBuf) ); -#ifdef SDK_FINALROM - MI_CpuClearFast( (void*)HW_TWL_ROM_HEADER_BUF, HW_TWL_ROM_HEADER_BUF_SIZE ); - OS_BootFromFIRM(); -#endif -} - -void TwlSpMain( void ) -{ -#ifdef PROFILE_ENABLE - // 0: bootrom - profile[pf_cnt++] = OS_TicksToMicroSecondsBROM32(OS_GetTick()); -#endif - InitDebugLED(); - SetDebugLED(++step); // 0x81 - - PreInit(); -#ifdef PROFILE_ENABLE - // 1: after PreInit - profile[pf_cnt++] = OS_TicksToMicroSecondsBROM32(OS_GetTick()); -#endif - SetDebugLED(++step); // 0x82 - - OS_InitFIRM(); - OS_EnableIrq(); - OS_EnableInterrupts(); - // 2: after PXI - PUSH_PROFILE(); - SetDebugLED(++step); // 0x83 - - PostInit(); - // 3: after PostInit - PUSH_PROFILE(); - SetDebugLED(++step); // 0x84 - -// PM_BackLightOn( FALSE ); - - SDNandContext = &OSi_GetFromFirmAddr()->SDNandContext; - if ( !FATFS_Init( DMA_FATFS_1, DMA_FATFS_2, THREAD_PRIO_FATFS ) ) - { - OS_TPrintf("Failed to call FATFS_Init().\n"); - goto end; - } - // 4: after FATFS_Init - PUSH_PROFILE(); - SetDebugLED(++step); // 0x85 - -// PM_BackLightOn( FALSE ); - // 5: - PUSH_PROFILE(); - SetDebugLED(++step); // 0x86 - - //PM_BackLightOn( FALSE ); - // 6: - PUSH_PROFILE(); - SetDebugLED(++step); // 0x87 - - //PM_BackLightOn( FALSE ); - // 7: - PUSH_PROFILE(); - SetDebugLED(++step); // 0x88 - - //PM_BackLightOn( FALSE ); - - if ( PXI_RecvID() != FIRM_PXI_ID_DONE_HEADER ) - { - OS_TPrintf("PXI_RecvID() was received invalid value (!=FIRM_PXI_ID_DONE_HEADER).\n"); - goto end; - } - // 8: after PXI - PUSH_PROFILE(); - SetDebugLED(++step); // 0x89 - -// PM_BackLightOn( FALSE ); - - AESi_InitKeysFIRM(); - AESi_InitSeed(); - // 9: after AESi_InitSeed - PUSH_PROFILE(); - SetDebugLED(++step); // 0x8a - -// PM_BackLightOn( FALSE ); - // 10: - PUSH_PROFILE(); - SetDebugLED(++step); // 0x8b - - //PM_BackLightOn( FALSE ); - - if ( PXI_RecvID() != FIRM_PXI_ID_DONE_STATIC ) - { - OS_TPrintf("PXI_RecvID() was received invalid value (!=FIRM_PXI_ID_DONE_STATIC).\n"); - goto end; - } - // 11: after PXI - PUSH_PROFILE(); - -#ifdef PROFILE_ENABLE - { - int i; - PXI_RecvID(); - OS_TPrintf("\n[ARM7] Begin\n"); - for (i = 0; i < PROFILE_MAX; i++) - { -// OS_TPrintf("0x%08X\n", profile[i]); - if ( !profile[i] ) break; - OS_TPrintf("%2d: %7d usec", i, profile[i]); - if (i) - { - OS_TPrintf(" ( %7d usec )\n", profile[i]-profile[i-1]); - } - else - { - OS_TPrintf("\n"); - } - } - OS_TPrintf("\n[ARM7] End\n"); - } -#endif - SetDebugLED( 0 ); - -// PM_BackLightOn( TRUE ); // last chance - - OS_BootFromFIRM(); - -end: - SetDebugLED( (u8)(0xF0 | step)); - - EraseAll(); - - // failed - PXI_NotifyID( FIRM_PXI_ID_ERR ); - PXI_NotifyID( FIRM_PXI_ID_ERR ); - PXI_NotifyID( FIRM_PXI_ID_ERR ); - PXI_NotifyID( FIRM_PXI_ID_ERR ); - OS_Terminate(); -} - diff --git a/build/nandfirm/menu-launcher2/ARM9/Makefile b/build/nandfirm/menu-launcher2/ARM9/Makefile deleted file mode 100644 index 2e402305..00000000 --- a/build/nandfirm/menu-launcher2/ARM9/Makefile +++ /dev/null @@ -1,59 +0,0 @@ -#! make -f -#---------------------------------------------------------------------------- -# Project: TwlFirm - nandfirm - menu-launcher2 -# File: Makefile -# -# Copyright 2007 Nintendo. All rights reserved. -# -# These coded instructions, statements, and computer programs contain -# proprietary information of Nintendo of America Inc. and/or Nintendo -# Company Ltd., and are protected by Federal copyright law. They may -# not be disclosed to third parties or copied or duplicated in any form, -# in whole or in part, without the prior written consent of Nintendo. -# -# $Date:: $ -# $Rev$ -# $Author$ -#---------------------------------------------------------------------------- - -SUBDIRS = - -LINCLUDES = - -#---------------------------------------------------------------------------- - -TARGET_BIN = menu_launcher2_9.srl - -SRCS = main.c - -CRT0_O = crt0_firm.o - -MAKEROM_ARM7 = ../ARM7/bin/$(TWL_BUILDTYPE_ARM7)/menu_launcher2_7.tef -MAKEROM_ARM7_BASE = $(basename $(MAKEROM_ARM7)) - -#LCFILE_TEMPLATE = $(FIRM_SPECDIR)/$(TWL_PROC)-$(TWL_PLATFORM)-PARTNER.lcf.template - -#SRCDIR = # using default -#LCFILE = # using default - - -include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs - -# no thumb version, no final rom version -ifeq ($(TARGET_FINALROM),) -LLIBRARIES += libes.TWL$(ARCHGEN_TYPE).a libboc.TWL$(ARCHGEN_TYPE).a -else -LLIBRARIES += ../Release/libes.TWL$(ARCHGEN_TYPE).a ../Release/libboc.TWL$(ARCHGEN_TYPE).a -endif -LLIBRARIES += liblcfg$(TWL_LIBSUFFIX).a \ - libaes_private$(TWL_LIBSUFFIX).a - -#---------------------------------------------------------------------------- - -do-build: $(TARGETS) - - -include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules - - -#===== End of Makefile ===== diff --git a/build/nandfirm/menu-launcher2/ARM9/main.c b/build/nandfirm/menu-launcher2/ARM9/main.c deleted file mode 100644 index 5bc4d9de..00000000 --- a/build/nandfirm/menu-launcher2/ARM9/main.c +++ /dev/null @@ -1,353 +0,0 @@ -/*---------------------------------------------------------------------------* - Project: TwlFirm - nandfirm - menu-launcher2 - File: main.c - - Copyright 2007 Nintendo. All rights reserved. - - These coded instructions, statements, and computer programs contain - proprietary information of Nintendo of America Inc. and/or Nintendo - Company Ltd., and are protected by Federal copyright law. They may - not be disclosed to third parties or copied or duplicated in any form, - in whole or in part, without the prior written consent of Nintendo. - - $Date:: $ - $Rev$ - $Author$ - *---------------------------------------------------------------------------*/ -#include -#include -#include - -#ifndef FIRM_USE_TWLSDK_KEYS -#define RSA_KEY_ADDR OSi_GetFromFirmAddr()->rsa_pubkey[0] // 鍵管理.xls参照 -#else -#define RSA_KEY_ADDR rsa_key -static const u8 rsa_key[128] = -{ - 0xe9, 0x9e, 0xa7, 0x9f, 0x59, 0x4d, 0xf4, 0xa7, 0x60, 0x04, 0xbd, 0x47, 0xf2, 0xb3, 0x64, 0xcd, - 0x16, 0x79, 0xc1, 0x47, 0x39, 0xf6, 0xa9, 0xf8, 0xee, 0x1a, 0xd0, 0x72, 0xcf, 0x43, 0x97, 0x0c, - 0x93, 0xa1, 0x38, 0x4e, 0x13, 0x40, 0x6c, 0x10, 0x59, 0x43, 0xe2, 0x71, 0x29, 0x54, 0x14, 0x2c, - 0xc5, 0xda, 0x59, 0x4d, 0xb4, 0x6a, 0xef, 0x85, 0x61, 0x6f, 0x7f, 0x1c, 0x59, 0x34, 0x2c, 0xc6, - 0x24, 0xf3, 0x7b, 0xc3, 0xb7, 0x40, 0xd1, 0x46, 0xf8, 0x90, 0xb7, 0xc2, 0x98, 0x50, 0xaf, 0x95, - 0x52, 0x42, 0xdb, 0xac, 0xd6, 0x7e, 0xa9, 0xc3, 0x3d, 0x1b, 0x51, 0x56, 0x07, 0x06, 0xd0, 0x0b, - 0x01, 0xbb, 0x58, 0x93, 0xea, 0xa0, 0x2c, 0xc7, 0x7d, 0x6a, 0x31, 0x7e, 0xc9, 0xe2, 0xda, 0xfe, - 0x1f, 0x2e, 0x9d, 0xa7, 0x54, 0x84, 0xdc, 0x28, 0xb9, 0x18, 0xea, 0x16, 0xf2, 0x95, 0x55, 0x6d, -}; -#endif - -#define RSA_HEAP_SIZE (4*1024) // RSA用ヒープサイズ (サイズ調整必要) - -static u8 acHeap[RSA_HEAP_SIZE] __attribute__ ((aligned (32))); -static SVCSignHeapContext acPool; - -#define MENU_TITLE_ID_HI 0x00030007ULL -#define MENU_TITLE_ID_LO 0x4c4e4352ULL -#define MENU_TITLE_ID (MENU_TITLE_ID_HI << 32 | MENU_TITLE_ID_LO) - -/* - PROFILE_ENABLE を定義するとある程度のパフォーマンスチェックができます。 - 利用するためには、main.cかどこかに、u32 profile[256]; u32 pf_cnt = 0; を - 定義する必要があります。 -*/ -#define PROFILE_ENABLE - -/* - PRINT_MEMORY_ADDR を定義すると、そのアドレスからSPrintfを行います(このファイルのみ) - FINALROM版でもコードが残るので注意してください。 -*/ -#define PRINT_MEMORY_ADDR 0x02FFC200 - -//#ifdef SDK_FINALROM // FINALROMで無効化 -//#undef PROFILE_ENABLE -//#endif - -#ifdef PROFILE_ENABLE -#define PROFILE_MAX 16 -u32 profile[PROFILE_MAX]; -u32 pf_cnt = 0; -#define PUSH_PROFILE() (profile[pf_cnt++] = (u32)OS_TicksToMicroSeconds(OS_GetTick())) -#else -#define PUSH_PROFILE() ((void)0) -#endif - -#ifdef PRINT_MEMORY_ADDR -static char* debugPtr = (char*)PRINT_MEMORY_ADDR; -#undef OS_TPrintf -//#define OS_TPrintf(...) (debugPtr = (char*)((u32)(debugPtr + STD_TSPrintf(debugPtr, __VA_ARGS__) + 0xf) & ~0xf)) -#define OS_TPrintf(...) (debugPtr += STD_TSPrintf(debugPtr, __VA_ARGS__)) -#endif - -/*************************************************************** - PreInit - - FromBootの対応&OS_Init前に必要なメインメモリの初期化 -***************************************************************/ -static void PreInit(void) -{ - static const OSMountInfo firmSettings[] = - { - { 'F', OS_MOUNT_DEVICE_NAND, OS_MOUNT_TGT_ROOT, 0, OS_MOUNT_RSC_WRAM, (OS_MOUNT_USR_R|OS_MOUNT_USR_W), 0, 0, "nand", "/" }, - { 0 } - }; - /* - メインメモリ関連 - */ - // SHARED領域はスタートアップ時でクリア - - // FS_MOUNT領域の初期化 - MI_CpuCopy8(firmSettings, (char*)HW_TWL_FS_MOUNT_INFO_BUF, sizeof(firmSettings)); - - /* - FromBrom関連 - */ - if ( !OSi_FromBromToMenu() ) - { - OS_Terminate(); - } - - // ブートタイプの変更 - ( (OSBootInfo *)OS_GetBootInfo() )->boot_type = OS_BOOTTYPE_NAND; -} - -/*************************************************************** - PostInit - - 各種初期化 -***************************************************************/ -static void PostInit(void) -{ - AES_Init(); - // RSA用ヒープ設定 - SVC_InitSignHeap( &acPool, acHeap, sizeof(acHeap) ); - // FS/FATFS初期化 - FS_InitFIRM(); -} - -/*************************************************************** - TryResolveSrl - - NANDに格納された情報からランチャーSRLを解決する -***************************************************************/ -static BOOL TryResolveSrl(void) -{ - OSTitleId titleId = MENU_TITLE_ID_HI << 32; - if ( !LCFG_ReadHWSecureInfo() ) - { - OS_TPrintf("Failed to load HWSecureInfo.\n"); - return FALSE; - } - LCFG_THW_GetLauncherTitleID_Lo( (u8*)&titleId ); - // 4: after LCFG_ReadHWSecureInfo - PUSH_PROFILE(); - - if ( !FS_ResolveSrl( titleId ) ) - { - OS_TPrintf("Failed to call FS_ResolveSrl( 0x%016llx ).\n", titleId); - return FALSE; - } - OS_TPrintf("Launcher Title ID: 0x%016llx\n", titleId); - return TRUE; -} -/*************************************************************** - RetryResolveSrl - - デフォルト設定からランチャーSRLを解決する -***************************************************************/ -static BOOL RetryResolveSrl(void) -{ - if ( !FS_ResolveSrl( MENU_TITLE_ID ) ) - { - OS_TPrintf("Failed to call FS_ResolveSrl( 0x%016llx ).\n", MENU_TITLE_ID); - return FALSE; - } - OS_TPrintf("Launcher Title ID: 0x%016llx\n", MENU_TITLE_ID); - return TRUE; -} - -/*************************************************************** - CheckHeader - - ヘッダがシステムメニューとして問題ないかチェック -***************************************************************/ -static BOOL CheckHeader(void) -{ - static ROM_Header_Short* const rhs = (ROM_Header_Short*)HW_TWL_ROM_HEADER_BUF; - // イニシャルコードなど - OS_TPrintf("Initial Code : %08X (%.4s)\n", *(u32*)rhs->game_code, rhs->game_code); - OS_TPrintf("Platform Code : %02X\n", rhs->platform_code); - OS_TPrintf("Codec Mode : %s\n", rhs->codec_mode ? "TWL" : "NITRO"); - OS_TPrintf("Sigunature : %s\n", rhs->enable_signature ? "AVAILABLE" : "NOT AVAILABLE"); - OS_TPrintf("AES Encryption : %s\n", rhs->enable_aes ? "AVAILABLE" : "NOT AVAILABLE"); - if ( rhs->enable_aes ) - { - OS_TPrintf("AES Key Type : %s\n", rhs->developer_encrypt ? "FOR DEVELOPMENT" : "FOR PRODUCT"); - } - // エントリポイント - OS_TPrintf("ARM9 Entry point : %08X\n", rhs->main_entry_address); - OS_TPrintf("ARM7 Entry point : %08X\n", rhs->sub_entry_address); - // ロード範囲 - OS_TPrintf("ARM9 ROM address : %08X\n", rhs->main_rom_offset); - OS_TPrintf("ARM9 RAM address : %08X\n", rhs->main_ram_address); - OS_TPrintf("ARM9 size : %08X\n", rhs->main_size); - OS_TPrintf("ARM7 ROM address : %08X\n", rhs->sub_rom_offset); - OS_TPrintf("ARM7 RAM address : %08X\n", rhs->sub_ram_address); - OS_TPrintf("ARM7 size : %08X\n", rhs->sub_size); - OS_TPrintf("ARM9 LTD ROM address: %08X\n", rhs->main_ltd_rom_offset); - OS_TPrintf("ARM9 LTD RAM address: %08X\n", rhs->main_ltd_ram_address); - OS_TPrintf("ARM9 LTD size : %08X\n", rhs->main_ltd_size); - OS_TPrintf("ARM7 LTD ROM address: %08X\n", rhs->sub_ltd_rom_offset); - OS_TPrintf("ARM7 LTD RAM address: %08X\n", rhs->sub_ltd_ram_address); - OS_TPrintf("ARM7 LTD size : %08X\n", rhs->sub_ltd_size); - // 順序ほぼ最適化済み - if ( rhs->platform_code != PLATFORM_CODE_TWL_LIMITED || // TWL Limited only - !rhs->codec_mode || // TWL mode only - !rhs->enable_signature || // Should be use ROM header signature - (rhs->titleID_Hi & 0x0005) != 0x0005 || // check only NAND/SYSTEM bits (need?) - // should be in main memory - HW_TWL_MAIN_MEM > (u32)rhs->main_ram_address || - HW_TWL_MAIN_MEM > (u32)rhs->sub_ram_address || - HW_TWL_MAIN_MEM > (u32)rhs->main_ltd_ram_address || - HW_TWL_MAIN_MEM > (u32)rhs->sub_ltd_ram_address || - // should be in static area without Limited region - (u32)rhs->main_ram_address > (u32)rhs->main_entry_address || - (u32)rhs->sub_ram_address > (u32)rhs->sub_entry_address || - // should be in main memory (end address) - HW_FIRM_FS_AES_BUFFER <= (u32)rhs->main_ram_address + rhs->main_size || - HW_FIRM_FS_AES_BUFFER <= (u32)rhs->sub_ram_address + rhs->sub_size || - HW_FIRM_FS_AES_BUFFER <= (u32)rhs->main_ltd_ram_address + rhs->main_ltd_size || - HW_FIRM_FS_AES_BUFFER <= (u32)rhs->sub_ltd_ram_address + rhs->sub_ltd_size || - // should be in static area without Limited region (end address) - (u32)rhs->main_ram_address + rhs->main_size <= (u32)rhs->main_entry_address || - (u32)rhs->sub_ram_address + rhs->sub_size <= (u32)rhs->sub_entry_address || - 0 ) - { - OS_TPrintf("Invalid ROM header for MENU Launcher!\n"); - return FALSE; - } - return TRUE; -} - -/*************************************************************** - EraseAll - - 不正終了しました - いろいろ消してください - DSモードにして終わるのがよいか? -***************************************************************/ -static void EraseAll(void) -{ - MI_CpuClearFast( OSi_GetFromFirmAddr(), sizeof(OSFromFirmBuf) ); -#ifdef SDK_FINALROM - MI_CpuClearFast( (void*)HW_TWL_ROM_HEADER_BUF, HW_TWL_ROM_HEADER_BUF_SIZE ); - MI_CpuClearFast( (void*)HW_ROM_HEADER_BUF, HW_ROM_HEADER_BUF_END-HW_ROM_HEADER_BUF ); - OS_BootFromFIRM(); -#endif -} - -void TwlMain( void ) -{ - FSFile file; - -#ifdef PROFILE_ENABLE - // 0: bootrom - profile[pf_cnt++] = OS_TicksToMicroSecondsBROM32(OS_GetTick()); -#endif - - PreInit(); -#ifdef PROFILE_ENABLE - // 1: before OS_InitFIRM - profile[pf_cnt++] = OS_TicksToMicroSecondsBROM32(OS_GetTick()); -#endif - - OS_InitFIRM(); - OS_EnableIrq(); - OS_EnableInterrupts(); -#ifdef PROFILE_ENABLE - // 2: before OS_InitTick - profile[pf_cnt++] = OS_TicksToMicroSecondsBROM32(OS_GetTick()); - - OS_InitTick(); -#endif - - PostInit(); - // 3: after PostInit - PUSH_PROFILE(); - - if ( !TryResolveSrl() && !RetryResolveSrl() ) - { - goto end; - } - // 5: after FS_ResolveSrl - PUSH_PROFILE(); - - if ( !FS2_OpenSrl( &file ) ) - { - OS_TPrintf("Failed to call FS_OpenSrl().\n"); - goto end; - } - // 6: after FS_OpenSrl - PUSH_PROFILE(); - - if ( !FS2_LoadHeader( &file, &acPool, NULL, RSA_KEY_ADDR ) || !CheckHeader() ) - { - OS_TPrintf("Failed to call FS2_LoadHeader() and/or CheckHeader().\n"); - goto end; - } - // 7: after FS2_LoadHeader - PUSH_PROFILE(); - - PXI_NotifyID( FIRM_PXI_ID_DONE_HEADER ); - // 8: after PXI - PUSH_PROFILE(); - - if ( !FS2_LoadStatic( &file, NULL ) ) - { - OS_TPrintf("Failed to call FS2_LoadStatic().\n"); - goto end; - } - // 9: after FS2_LoadStatic - PUSH_PROFILE(); - - PXI_NotifyID( FIRM_PXI_ID_DONE_STATIC ); - // 10: after PXI - PUSH_PROFILE(); - -#ifdef PROFILE_ENABLE - { - int i; - OS_TPrintf("\n[ARM9] Begin\n"); - for (i = 0; i < PROFILE_MAX; i++) - { -// OS_TPrintf("0x%08X\n", profile[i]); - if ( !profile[i] ) break; - OS_TPrintf("%2d: %7d usec", i, profile[i]); - if (i) - { - OS_TPrintf(" ( %7d usec )\n", profile[i]-profile[i-1]); - } - else - { - OS_TPrintf("\n"); - } - } - OS_TPrintf("\n[ARM9] End\n"); - PXI_NotifyID( FIRM_PXI_ID_NULL ); - reg_OS_TM3CNT_H = 0; - reg_OS_TM3CNT_L = 0; - reg_OS_TM3CNT_H = (u16)(REG_OS_TM0CNT_H_E_MASK | OS_TIMER_PRESCALER_1024); - } -#endif - - OS_BootFromFIRM(); - -end: - EraseAll(); - - // failed - PXI_NotifyID( FIRM_PXI_ID_ERR ); - PXI_NotifyID( FIRM_PXI_ID_ERR ); - PXI_NotifyID( FIRM_PXI_ID_ERR ); - PXI_NotifyID( FIRM_PXI_ID_ERR ); - OS_Terminate(); -} - diff --git a/build/nandfirm/menu-launcher2/Makefile b/build/nandfirm/menu-launcher2/Makefile deleted file mode 100644 index 3ecb4e21..00000000 --- a/build/nandfirm/menu-launcher2/Makefile +++ /dev/null @@ -1,48 +0,0 @@ -#! make -f -#---------------------------------------------------------------------------- -# Project: TwlIPL - nandfirm - menu-launcher2 -# File: Makefile -# -# Copyright 2007 Nintendo. All rights reserved. -# -# These coded instructions, statements, and computer programs contain -# proprietary information of Nintendo of America Inc. and/or Nintendo -# Company Ltd., and are protected by Federal copyright law. They may -# not be disclosed to third parties or copied or duplicated in any form, -# in whole or in part, without the prior written consent of Nintendo. -# -# $Date:: $ -# $Rev$ -# $Author$ -#---------------------------------------------------------------------------- - - -#---------------------------------------------------------------------------- - -SUBDIRS = \ - wram_regs \ - ARM7 \ - ARM9 \ - -TARGET_FIRM_BIN = menu_launcher2-$(TWL_BUILD_TYPE)$(CODEGEN_ARCH).nand -BINDIR = . -MAKEFIRM_ARM9 = ARM9/bin/$(TWL_BUILDTYPE_ARM9)/menu_launcher2_9.tef -MAKEFIRM_ARM7 = ARM7/bin/$(TWL_BUILDTYPE_ARM7)/menu_launcher2_7.tef -MAKEFIRM_RSA_PRVKEY = $(TWL_KEYSDIR)/rsa/private_nand.der -LDEPENDS_BIN += wram_regs/wram_regs.rbin - -MAKEFIRM_FLAGS += -p -FIRM_SPEC = nandfirm.nandsf - -LDIRT_CLEAN += $(wildcard *.nand) \ - rsa_public.sbin \ - -include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs - -#---------------------------------------------------------------------------- - -do-build: $(TARGET_BIN) - -include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules - -#===== End of Makefile ===== diff --git a/build/nandfirm/menu-launcher2/nandfirm.nandsf b/build/nandfirm/menu-launcher2/nandfirm.nandsf deleted file mode 100644 index 8b8df994..00000000 --- a/build/nandfirm/menu-launcher2/nandfirm.nandsf +++ /dev/null @@ -1,24 +0,0 @@ -#NANDSF --- Nandfirm Spec File - -VERSION : GENERATE - -RSA_KEY : $(MAKEFIRM_RSA_PRVKEY) -OUT_KEY : rsa_public.sbin - -WRAM_RBIN: ./wram_regs/wram_regs.rbin - -MIRROR_OFS: 0x100000 - -DECOMP_PROC : ARM9 # ARM9 or ARM7 - -ARM9_COMP : FALSE # TRUE or FALSE, should be before ARM9_SBIN -ARM9_SBIN : $(MAKEFIRM_ARM9).TWL.FLX.sbin -ARM9_ELF : $(MAKEFIRM_ARM9).tef - -ARM7_COMP : FALSE # TRUE or FALSE, should be before ARM7_SBIN -ARM7_SBIN : $(MAKEFIRM_ARM7).TWL.FLX.sbin -ARM7_ELF : $(MAKEFIRM_ARM7).tef - -ARM9_X2 : TRUE # TRUE or FALSE - -NCD_ROMOFS : 0x1fe00 diff --git a/build/nandfirm/menu-launcher2/wram_regs/Makefile b/build/nandfirm/menu-launcher2/wram_regs/Makefile deleted file mode 100644 index 06eb4960..00000000 --- a/build/nandfirm/menu-launcher2/wram_regs/Makefile +++ /dev/null @@ -1,57 +0,0 @@ -#! make -f -#---------------------------------------------------------------------------- -# Project: TwlFirm - nandfirm - menu-launcher2 -# File: Makefile -# -# Copyright 2007 Nintendo. All rights reserved. -# -# These coded instructions, statements, and computer programs contain -# proprietary information of Nintendo of America Inc. and/or Nintendo -# Company Ltd., and are protected by Federal copyright law. They may -# not be disclosed to third parties or copied or duplicated in any form, -# in whole or in part, without the prior written consent of Nintendo. -# -# $Date:: $ -# $Rev$ -# $Author$ -#---------------------------------------------------------------------------- - -override TARGET_PLATFORM := TWL -override TARGET_CODEGEN := ARM -override TWL_ARCHGEN := LIMITED - -override TARGET_FINALROM := TRUE -override TARGET_RELEASE := -override TARGET_DEBUG := - -SUBDIRS = - -LINCLUDES = - - -#---------------------------------------------------------------------------- - -TARGET_BIN = wram_regs.rbin - -SRCS = \ - wram_regs.c \ - -#SRCDIR = # using default -#LCFILE = # using default - - -include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs - -INSTALL_DIR = . -INSTALL_TARGETS = $(BINDIR)/$(TARGET_BIN) - - -#---------------------------------------------------------------------------- - -do-build: $(TARGETS) - - -include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules - - -#===== End of Makefile ===== diff --git a/build/nandfirm/menu-launcher2/wram_regs/wram_regs.c b/build/nandfirm/menu-launcher2/wram_regs/wram_regs.c deleted file mode 100644 index 2454b302..00000000 --- a/build/nandfirm/menu-launcher2/wram_regs/wram_regs.c +++ /dev/null @@ -1,91 +0,0 @@ -/*---------------------------------------------------------------------------* - Project: TwlFirm - tools - nandfirm - File: wram_regs.c - - Copyright 2007 Nintendo. All rights reserved. - - These coded instructions, statements, and computer programs contain - proprietary information of Nintendo of America Inc. and/or Nintendo - Company Ltd., and are protected by Federal copyright law. They may - not be disclosed to third parties or copied or duplicated in any form, - in whole or in part, without the prior written consent of Nintendo. - - $Date:: $ - $Rev$ - $Author$ - *---------------------------------------------------------------------------*/ -#include -#include - -MIHeader_WramRegs wram_regs_init = -{ - // ARM9 - { - REG_MI_MBK_A0_FIELD( 1, MI_WRAM_A_OFFSET_0KB , MI_WRAM_ARM9 ), - REG_MI_MBK_A1_FIELD( 1, MI_WRAM_A_OFFSET_64KB , MI_WRAM_ARM9 ), - REG_MI_MBK_A2_FIELD( 1, MI_WRAM_A_OFFSET_128KB, MI_WRAM_ARM9 ), - REG_MI_MBK_A3_FIELD( 1, MI_WRAM_A_OFFSET_192KB, MI_WRAM_ARM9 ), - }, - { - REG_MI_MBK_B0_FIELD( 1, MI_WRAM_BC_OFFSET_0KB , MI_WRAM_ARM7 ), - REG_MI_MBK_B1_FIELD( 1, MI_WRAM_BC_OFFSET_32KB , MI_WRAM_ARM7 ), - REG_MI_MBK_B2_FIELD( 1, MI_WRAM_BC_OFFSET_64KB , MI_WRAM_ARM7 ), - REG_MI_MBK_B3_FIELD( 1, MI_WRAM_BC_OFFSET_96KB , MI_WRAM_ARM7 ), - REG_MI_MBK_B4_FIELD( 1, MI_WRAM_BC_OFFSET_128KB, MI_WRAM_ARM7 ), - REG_MI_MBK_B5_FIELD( 1, MI_WRAM_BC_OFFSET_160KB, MI_WRAM_ARM7 ), - REG_MI_MBK_B6_FIELD( 1, MI_WRAM_BC_OFFSET_192KB, MI_WRAM_ARM7 ), - REG_MI_MBK_B7_FIELD( 1, MI_WRAM_BC_OFFSET_224KB, MI_WRAM_ARM7 ), - }, - { - REG_MI_MBK_C0_FIELD( 1, MI_WRAM_BC_OFFSET_0KB , MI_WRAM_ARM7 ), - REG_MI_MBK_C1_FIELD( 1, MI_WRAM_BC_OFFSET_32KB , MI_WRAM_ARM7 ), - REG_MI_MBK_C2_FIELD( 1, MI_WRAM_BC_OFFSET_64KB , MI_WRAM_ARM7 ), - REG_MI_MBK_C3_FIELD( 1, MI_WRAM_BC_OFFSET_96KB , MI_WRAM_ARM7 ), - REG_MI_MBK_C4_FIELD( 1, MI_WRAM_BC_OFFSET_128KB, MI_WRAM_ARM7 ), - REG_MI_MBK_C5_FIELD( 1, MI_WRAM_BC_OFFSET_160KB, MI_WRAM_ARM7 ), - REG_MI_MBK_C6_FIELD( 1, MI_WRAM_BC_OFFSET_192KB, MI_WRAM_ARM7 ), - REG_MI_MBK_C7_FIELD( 1, MI_WRAM_BC_OFFSET_224KB, MI_WRAM_ARM7 ), - }, - REG_MI_MBK6_FIELD( REG_WRAM_MAP_CONV_ADDR( 6, A, EADDR, HW_WRAM_AREA_HALF ), - MI_WRAM_IMAGE_256KB, - REG_WRAM_MAP_CONV_ADDR( 6, A, SADDR, HW_WRAM_AREA_HALF - HW_WRAM_A_SIZE ) - ), - REG_MI_MBK7_FIELD( REG_WRAM_MAP_CONV_ADDR( 7, B, EADDR, HW_WRAM_AREA + HW_WRAM_B_SIZE ), - MI_WRAM_IMAGE_256KB, - REG_WRAM_MAP_CONV_ADDR( 7, B, SADDR, HW_WRAM_AREA ) - ), - REG_MI_MBK8_FIELD( REG_WRAM_MAP_CONV_ADDR( 8, C, EADDR, MI_WRAM_MAP_NULL ), - MI_WRAM_IMAGE_256KB, - REG_WRAM_MAP_CONV_ADDR( 8, C, SADDR, MI_WRAM_MAP_NULL ) - ), - - // ARM7 - REG_MI_MBK6_FIELD( REG_WRAM_MAP_CONV_ADDR( 6, A, EADDR, MI_WRAM_MAP_NULL ), - MI_WRAM_IMAGE_256KB, - REG_WRAM_MAP_CONV_ADDR( 6, A, SADDR, MI_WRAM_MAP_NULL ) - ), - REG_MI_MBK7_FIELD( REG_WRAM_MAP_CONV_ADDR( 7, B, EADDR, HW_WRAM_AREA + HW_WRAM_B_SIZE ), - MI_WRAM_IMAGE_256KB, - REG_WRAM_MAP_CONV_ADDR( 7, B, SADDR, HW_WRAM_AREA ) - ), - REG_MI_MBK8_FIELD( REG_WRAM_MAP_CONV_ADDR( 8, C, EADDR, HW_WRAM_AREA_HALF - HW_WRAM_SIZE ), - MI_WRAM_IMAGE_256KB, - REG_WRAM_MAP_CONV_ADDR( 8, C, SADDR, HW_WRAM_AREA_HALF - HW_WRAM_SIZE - HW_WRAM_C_SIZE ) - ), - - // WRAM Lock - { - 0, - 0, - 0, - }, - - // WRAM-0/1 - 3, - - // VRAM-C - 7, - // VRAM-D - 7, -}; -