FakeRomHeaderにROMバージョン変更オプションを追加。

launcer,secure,sys,user用ビルド時に名前を付加するよう変更。

git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlIPL/trunk@2421 b08762b0-b915-fc4b-9d8c-17b2551a87ff
This commit is contained in:
yosiokat 2008-09-06 04:33:09 +00:00
parent 909f2b93fa
commit a937e91a6a
6 changed files with 26 additions and 8 deletions

View File

@ -21,7 +21,7 @@ include $(TWLSDK_ROOT)/build/buildtools/commondefs
TARGETS = FakeRomHeader.exe
TARGETS = FakeRomHeader$(SUFFIX).exe
SOURCES_C = main.c keys.c
@ -46,14 +46,18 @@ LIBDIGEST = $(ROOT)/build/tools/makerom.TWL/digest/lib/X86/libdigest_x86.a
ifeq ($(KEY_LAUNCHER),TRUE)
MACROS += -DKEY_LAUNCHER
SUFFIX = .launcher
else
ifeq ($(KEY_SECURE),TRUE)
MACROS += -DKEY_SECURE
SUFFIX = .secure
else
ifeq ($(KEY_SYSTEM),TRUE)
MACROS += -DKEY_SYSTEM
SUFFIX = .sys
else
MACROS += -DKEY_USER
SUFFIX = .user
endif
endif
endif

View File

@ -61,7 +61,9 @@ typedef struct _SContext
BOOL bPlatform;
BOOL bSignFlag;
BOOL bDevFlag;
BOOL bVerFlag;
int verNum;
FILE *ifp;
FILE *ofp;
}
@ -97,11 +99,12 @@ void usage()
printf( " input_file : a ROM data file (generated by makerom.TWL).\n" );
printf( " output_file : a destination file.\n" );
printf( "\nOption:\n" );
printf( "-h : print help only.\n" );
printf( "-p : write invalid platform code in a ROM Header.\n" );
printf( "-s : negate flag for the signature in a ROM Header.\n" );
printf( "-d : negate a new developer encrypt flag, and assert an old one.\n" );
printf( "-----------------------------------------------------------------------------\n" );
printf( "-h : print help only.\n" );
printf( "-p : write invalid platform code in a ROM Header.\n" );
printf( "-s : negate flag for the signature in a ROM Header.\n" );
printf( "-d : negate a new developer encrypt flag, and assert an old one.\n" );
printf( "-v NUM: change ROM version in a ROM Header.\n" );
printf( "-----------------------------------------------------------------------------\n" );
}
int main(int argc, char *argv[])
@ -122,7 +125,7 @@ int main(int argc, char *argv[])
memset( &context, 0, sizeof(SContext) );
// オプション
while( (opt = getopt(argc, argv, "hpsd")) >= 0 )
while( (opt = getopt(argc, argv, "hpsdv:")) >= 0 )
{
switch( opt )
{
@ -143,6 +146,11 @@ int main(int argc, char *argv[])
context.bDevFlag = TRUE;
break;
case 'v':
context.bVerFlag = TRUE;
context.verNum = atoi(optarg);
break;
default: // オプション引数が指定されていないときにも実行される
usage();
fprintf( stdout, "error: illegal option\n" );
@ -269,6 +277,12 @@ static BOOL iMain( SContext *pContext )
rh.s.developer_encrypt_old = 0x1;
rh.s.exFlags.developer_encrypt = 0x0;
}
if( pContext->bVerFlag )
{
printf( "ROM version: 0x%02x -> 0x%02x\n", rh.s.rom_version, pContext->verNum );
rh.s.rom_version = pContext->verNum;
}
}
// ヘッダCRC計算

Binary file not shown.

Binary file not shown.

BIN
tools/bin/FakeRomHeader.sys.exe Executable file

Binary file not shown.

BIN
tools/bin/FakeRomHeader.user.exe Executable file

Binary file not shown.