mirror of
https://github.com/rvtr/TwlIPL.git
synced 2025-10-31 06:01:12 -04:00
バージョン情報のためのTADファイルを生成する仕掛けを追加
git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlIPL/trunk@1675 b08762b0-b915-fc4b-9d8c-17b2551a87ff
This commit is contained in:
parent
c543dd90dc
commit
87090c27b8
61
build/systemMenu_RED/sysmenuVersion/Makefile
Normal file
61
build/systemMenu_RED/sysmenuVersion/Makefile
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
#! make -f
|
||||||
|
#----------------------------------------------------------------------------
|
||||||
|
# Project: TwlIPL
|
||||||
|
# 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:
|
||||||
|
#----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# バージョンファイルとTADを生成する
|
||||||
|
# WL_IPL_RED_PRIVATE_ROOTが設定されていない場合は
|
||||||
|
# 既存のバージョンファイルからTADのみ生成する
|
||||||
|
|
||||||
|
TARGET_FIRM = SYSTEMMENU
|
||||||
|
|
||||||
|
include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs
|
||||||
|
|
||||||
|
VER_TIMESTAMP = 08062300
|
||||||
|
|
||||||
|
VERSION_NUM = 1
|
||||||
|
|
||||||
|
VERSION_FILE = SysmenuVersion.dat
|
||||||
|
|
||||||
|
GEN_VERSION_FILE = $(SYSMENU_TOOLSDIR)/bin/genVersion.plx
|
||||||
|
|
||||||
|
VERSION_MAKETAD_OPTION += -s -d 0003000F484E5641 3031 0 SYSM_VERSION -v 0 -p
|
||||||
|
|
||||||
|
VERSION_TAD = HNVA.tad
|
||||||
|
|
||||||
|
ifneq ($(TWL_IPL_RED_PRIVATE_ROOT),)
|
||||||
|
VERSION_DAT = $(VERSION_FILE)
|
||||||
|
endif
|
||||||
|
|
||||||
|
TARGETS += $(VERSION_TAD)
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
LDIRT_CLEAN = $(VERSION_DAT) $(VERSION_TAD) properties
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules
|
||||||
|
|
||||||
|
do-build : $(VERSION_TAD)
|
||||||
|
|
||||||
|
$(VERSION_DAT):
|
||||||
|
$(GEN_VERSION_FILE) $(VER_TIMESTAMP) $(VERSION_NUM)
|
||||||
|
|
||||||
|
$(VERSION_TAD) : $(VERSION_FILE)
|
||||||
|
$(MAKETAD) $(call empath,$<) $(VERSION_MAKETAD_OPTION) -o $@
|
||||||
|
|
||||||
|
#===== End of Makefile =====
|
||||||
BIN
build/systemMenu_RED/sysmenuVersion/SysmenuVersion.dat
Normal file
BIN
build/systemMenu_RED/sysmenuVersion/SysmenuVersion.dat
Normal file
Binary file not shown.
83
tools/bin/genVersion.plx
Normal file
83
tools/bin/genVersion.plx
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
#!/usr/bin/perl
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
# genVersion.pl
|
||||||
|
#
|
||||||
|
# generate SystemMenu Version Data
|
||||||
|
#
|
||||||
|
# [[ FILE FORMAT ]]
|
||||||
|
# security code (128 bytes) : RSA signature of Version Data
|
||||||
|
#
|
||||||
|
# Version Data ( 32 bytes)
|
||||||
|
# TimeStamp ( 4 bytes) : date %y%m%d%H
|
||||||
|
# Version ( 4 bytes) : 0 ~
|
||||||
|
# padding ( 24 bytes) :
|
||||||
|
#
|
||||||
|
# note: each section image is aligned to 32 bytes.
|
||||||
|
#
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
use POSIX 'strftime';
|
||||||
|
use File::Basename;
|
||||||
|
|
||||||
|
if ($#ARGV < 1) {
|
||||||
|
printf STDOUT ("Usage: %s [genVersion] timestamp version\n", $0);
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
my $outFile = "SysmenuVersion.dat";
|
||||||
|
my $versionFile = "version.bin";
|
||||||
|
my $signFile = "sign.bin";
|
||||||
|
|
||||||
|
# 後始末
|
||||||
|
sub deleteTemp {
|
||||||
|
system ("rm -f $versionFile");
|
||||||
|
system ("rm -f $signFile");
|
||||||
|
}
|
||||||
|
|
||||||
|
my $signSize = 0x80;
|
||||||
|
my $versionSize = 0x20;
|
||||||
|
my @files;
|
||||||
|
|
||||||
|
# バージョン情報の出力
|
||||||
|
{
|
||||||
|
# timestampLen = 0x08;
|
||||||
|
# elementNumLen = 0x02;
|
||||||
|
my $padLen = 0x18;
|
||||||
|
|
||||||
|
open VERSION, ">$versionFile" or die "File Open Error.\n";
|
||||||
|
binmode VERSION;
|
||||||
|
|
||||||
|
# タイムスタンプの出力
|
||||||
|
# my $timestamp = strftime "%y%m%d%H", localtime;
|
||||||
|
my $timestamp = $ARGV[ 0 ];
|
||||||
|
my $ver = $ARGV[ 1 ];
|
||||||
|
printf "timestamp = %s\n", $timestamp;
|
||||||
|
syswrite( VERSION, pack( "N", unpack( "L", pack( "H8", $timestamp ) ) ) );
|
||||||
|
|
||||||
|
# バージョンの出力
|
||||||
|
syswrite( VERSION, pack( "L", $ver ) );
|
||||||
|
|
||||||
|
# パディングの出力
|
||||||
|
syswrite( VERSION, pack( "x$padLen") );
|
||||||
|
|
||||||
|
close VERSION;
|
||||||
|
}
|
||||||
|
|
||||||
|
# 環境変数サーチ
|
||||||
|
foreach ( sort keys ( %ENV ) ){
|
||||||
|
if ($_ =~ m/TWL_IPL_RED_PRIVATE_ROOT/s) {
|
||||||
|
$KEYROOT = $ENV{$_};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!$KEYROOT) {
|
||||||
|
deleteTemp();
|
||||||
|
die "No TWL_IPL_RED_PRIVATE_ROOT is found.\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
# バージョン情報に署名付加
|
||||||
|
{
|
||||||
|
system ( "openssl rsautl -sign -in $versionFile -inkey $KEYROOT/keys/rsa/private_sharedFont.der -keyform DER -out $signFile" );
|
||||||
|
system ( "cat $signFile $versionFile >$outFile" );
|
||||||
|
deleteTemp();
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user