diff --git a/build/systemMenu_RED/sysmenuVersion/Makefile b/build/systemMenu_RED/sysmenuVersion/Makefile new file mode 100644 index 00000000..18ea54e3 --- /dev/null +++ b/build/systemMenu_RED/sysmenuVersion/Makefile @@ -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 ===== diff --git a/build/systemMenu_RED/sysmenuVersion/SysmenuVersion.dat b/build/systemMenu_RED/sysmenuVersion/SysmenuVersion.dat new file mode 100644 index 00000000..9a08b5b2 Binary files /dev/null and b/build/systemMenu_RED/sysmenuVersion/SysmenuVersion.dat differ diff --git a/tools/bin/genVersion.plx b/tools/bin/genVersion.plx new file mode 100644 index 00000000..bdf84ebe --- /dev/null +++ b/tools/bin/genVersion.plx @@ -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(); +}