From 87090c27b87107c1b2f36e250a671d2eb7eb57eb Mon Sep 17 00:00:00 2001 From: yoshida_teruhisa Date: Tue, 24 Jun 2008 01:31:27 +0000 Subject: [PATCH] =?UTF-8?q?=E3=83=90=E3=83=BC=E3=82=B8=E3=83=A7=E3=83=B3?= =?UTF-8?q?=E6=83=85=E5=A0=B1=E3=81=AE=E3=81=9F=E3=82=81=E3=81=AETAD?= =?UTF-8?q?=E3=83=95=E3=82=A1=E3=82=A4=E3=83=AB=E3=82=92=E7=94=9F=E6=88=90?= =?UTF-8?q?=E3=81=99=E3=82=8B=E4=BB=95=E6=8E=9B=E3=81=91=E3=82=92=E8=BF=BD?= =?UTF-8?q?=E5=8A=A0?= 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@1675 b08762b0-b915-fc4b-9d8c-17b2551a87ff --- build/systemMenu_RED/sysmenuVersion/Makefile | 61 +++++++++++++ .../sysmenuVersion/SysmenuVersion.dat | Bin 0 -> 160 bytes tools/bin/genVersion.plx | 83 ++++++++++++++++++ 3 files changed, 144 insertions(+) create mode 100644 build/systemMenu_RED/sysmenuVersion/Makefile create mode 100644 build/systemMenu_RED/sysmenuVersion/SysmenuVersion.dat create mode 100644 tools/bin/genVersion.plx 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 0000000000000000000000000000000000000000..9a08b5b2757df7aa59385aa14548a6f0929fdb62 GIT binary patch literal 160 zcmdPzu3G!&I%?{@utv{Ht uNoDb0-8pZjUi}sReJNMJ)v8%cyBe!qCTmLgxgXeg_ArAo8wVo;ZU6ulNI}a0 literal 0 HcmV?d00001 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(); +}