diff --git a/build/systemMenu_RED/sharedFont/Makefile b/build/systemMenu_RED/sharedFont/Makefile new file mode 100644 index 00000000..e0afe028 --- /dev/null +++ b/build/systemMenu_RED/sharedFont/Makefile @@ -0,0 +1,48 @@ +#! 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: +#---------------------------------------------------------------------------- + +TARGET_FIRM = SYSTEMMENU + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +FONT_DIR = WW +FONTS = TWL_BF00_l.NFTR \ + TWL_BF00_m.NFTR \ + TWL_BF00_s.NFTR +FONT_RSC = $(addprefix $(FONT_DIR)/, $(FONTS)) + +FONT_TABLE = TWLFontTable.dat +GEN_FONT_TABLE = $(SYSMENU_TOOLSDIR)/bin/genFontTable.plx + +#---------------------------------------------------------------------------- +#INSTALL_TARGETS = $(FONT_TABLE) +#INSTALL_DIR = $(FONT_TABLE)/build/tools/TwlNMenu/data + +LDIRT_CLEAN = $(FONT_TABLE) + +#---------------------------------------------------------------------------- + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +do-build : $(FONT_TABLE) + +$(FONT_TABLE): $(FONT_RSC) + $(GEN_FONT_TABLE) $(FONT_RSC) + cp $(FONT_RSC) ./ + +#===== End of Makefile ===== diff --git a/build/systemMenu_RED/sharedFont/WW/TWL_BF00_l.NFTR b/build/systemMenu_RED/sharedFont/WW/TWL_BF00_l.NFTR new file mode 100644 index 00000000..c2632a97 Binary files /dev/null and b/build/systemMenu_RED/sharedFont/WW/TWL_BF00_l.NFTR differ diff --git a/build/systemMenu_RED/sharedFont/WW/TWL_BF00_m.NFTR b/build/systemMenu_RED/sharedFont/WW/TWL_BF00_m.NFTR new file mode 100644 index 00000000..b995c13b Binary files /dev/null and b/build/systemMenu_RED/sharedFont/WW/TWL_BF00_m.NFTR differ diff --git a/build/systemMenu_RED/sharedFont/WW/TWL_BF00_s.NFTR b/build/systemMenu_RED/sharedFont/WW/TWL_BF00_s.NFTR new file mode 100644 index 00000000..bb500018 Binary files /dev/null and b/build/systemMenu_RED/sharedFont/WW/TWL_BF00_s.NFTR differ diff --git a/build/systemMenu_RED/sharedFont/WW/verInfo.txt b/build/systemMenu_RED/sharedFont/WW/verInfo.txt new file mode 100644 index 00000000..d2fcf9bf --- /dev/null +++ b/build/systemMenu_RED/sharedFont/WW/verInfo.txt @@ -0,0 +1 @@ +20080417 diff --git a/tools/bin/genFontTable.plx b/tools/bin/genFontTable.plx new file mode 100644 index 00000000..7271b80c --- /dev/null +++ b/tools/bin/genFontTable.plx @@ -0,0 +1,119 @@ +#!/usr/bin/perl + +###################################################################### +# genFontTable.pl +# +# attach signature to firmware file +# +# [[ HEADER FORMAT ]] +# Header +# TimeStamp ( 4 bytes) : number of file sections +# number ( 2 bytes) : number of font files +# padding ( 26 bytes) : +# +# security code (128 bytes) : RSA signature of Header +# +# section information ( 48 bytes * number) +# fileName ( 24 bytes) : font file name +# length ( 4 bytes) : length of file (bytes) +# digest ( 20 bytes) : WLAN FW=2 DATAPATCH=5 signature = 128 +# +# note: each section image is aligned to 48 bytes. +# +###################################################################### + +use POSIX 'strftime'; +use File::Basename; + +if ($#ARGV < 1) { + printf STDOUT ("Usage: %s [genFontTable] [Target font files...]\n", $0); + exit(-1); +} + +my $outFile = "TWLFontTable.dat"; +my $headerFile = "header.bin"; +my $digestFile = "sha1.bin"; +my $signFile = "sign.bin"; + +# 後始末 +sub deleteTemp { + system ("rm -f $headerFile"); + system ("rm -f $digestFile"); + system ("rm -f $signFile"); +} + +# ヘッダの出力 +{ + + open HEADER, ">$headerFile" or die; + binmode HEADER; + + # タイムスタンプの出力 + my $date = strftime "%y%m%d%H", localtime; + syswrite( HEADER, pack( "H8", $date ) ); + + # 要素数の出力 + my $num = 0; + foreach ( @ARGV ) { + $num++; + } + syswrite( HEADER, pack( "S", $num ) ); + + # パディングの出力 + syswrite( HEADER, pack( "x26") ); + + foreach ( @ARGV ) { + # ファイルネームの出力 + my $fileNameMax = 0x18; + if( !( -e $_ ) ) { + close( HEADER ); + deleteTemp(); + die "file not exist. : $_\n"; + } + my $name = basename( $_ ); + if( length $name >= $fileNameMax ) { + close( HEADER ); + deleteTemp(); + die "file name length must be smaller than $fileNameMax. : $_\n"; + } + my $data = pack( "a$fileNameMax", $name ); + syswrite( HEADER, $data, $fileNameMax ); + + # ファイル長の出力 + $data = pack( "L", -s $_ ); + syswrite( HEADER, $data, 4 ); + + # ファイルのSHA1ハッシュの出力 + { + my $sha1Len = 20; + my $digest; + system ("openssl dgst -sha1 -binary -out $digestFile $_"); + open DIGEST, $digestFile or die; + binmode DIGEST; + sysread( DIGEST, $digest, $sha1Len ); + close DIGEST; + syswrite( HEADER, $digest, $sha1Len ); + } + } + close HEADER; +} + +# 環境変数サーチ +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 dgst -sha1 -binary -out $digestFile $headerFile" ); + system ( "openssl rsautl -sign -in $digestFile -inkey $KEYROOT/keys/rsa/private9_1.der -keyform DER -out $signFile" ); + system ( "cat $signFile $headerFile >$outFile" ); + deleteTemp(); +} +