diff --git a/build/tests/CustomSystemUpdater/ARM9.TWL/Makefile b/build/tests/CustomSystemUpdater/ARM9.TWL/Makefile index 0475b677..17d05926 100644 --- a/build/tests/CustomSystemUpdater/ARM9.TWL/Makefile +++ b/build/tests/CustomSystemUpdater/ARM9.TWL/Makefile @@ -68,6 +68,11 @@ SRCDIR = src \ #LCFILE = # using default +DATA_ROOT = ../data +ROMSET_FILE = ../romset +ROM_CHECKER = ruby ../romchecker.rb + +SUMAKER = ruby ../sumaker.rb custom #---------------------------------------------------------------------------- include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs @@ -117,13 +122,21 @@ INSTALL_DIR = $(SDK_NMENU_DATADIR) #---------------------------------------------------------------------------- -.PHONY: build_time + +#include $(ROMSET_FILE) + +.PHONY: build_time check_rom sumaker + +check_rom: + $(ROM_CHECKER) $(DATA_ROOT)/$(ROMSET) build_time: echo -n "#define BUILD_TIME \"`date \"+%Y/%m/%d %H:%M:%S\"`\"" > include/build_time.h +sumaker: + $(SUMAKER) $(ROMSET) $(SYSM_REGION) -do-build: build_time $(TARGETS) +do-build: sumaker check_rom build_time $(TARGETS) #include $(TWLSDK_ROOT)/build/buildtools/modulerules include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules diff --git a/build/tests/CustomSystemUpdater/ARM9.TWL/main.rsf b/build/tests/CustomSystemUpdater/ARM9.TWL/main.rsf index 52d00fe5..3802e389 100644 --- a/build/tests/CustomSystemUpdater/ARM9.TWL/main.rsf +++ b/build/tests/CustomSystemUpdater/ARM9.TWL/main.rsf @@ -220,9 +220,9 @@ RomSpec { Offset 0x00000000 Segment ALL - HostRoot ../data/20080822_test/euro + HostRoot ../data/20080822_cls/euro Root /data - File hnap-v0.tad hnbp-v0.tad hnca-v0.tad hnha-v0.tad hnlp-v0.tad TWLFontTable.dat nandfirm_rcplus.nand + File hnap-v0.tad hnbp-v0.tad hnca-v0.tad hnda-v0.tad hnea-v0.tad hnfp-v0.tad hngp-v0.tad hnha-v0.tad hnip-v0.tad hnjp-v0.tad hnkp-v0.tad hnlp-v0.tad TWLFontTable.dat nandfirm_rcplus.nand HostRoot $(PRIVKEY_PATH) Root /key File $(HWINFO_PRIVKEY) $(HWID_PRIVKEY) diff --git a/build/tests/CustomSystemUpdater/ARM9.TWL/src/main.c b/build/tests/CustomSystemUpdater/ARM9.TWL/src/main.c index d1acefac..197e9612 100644 --- a/build/tests/CustomSystemUpdater/ARM9.TWL/src/main.c +++ b/build/tests/CustomSystemUpdater/ARM9.TWL/src/main.c @@ -75,7 +75,14 @@ static const char* ImportTadFileList[] = "rom:/data/hnap-v0.tad", "rom:/data/hnbp-v0.tad", "rom:/data/hnca-v0.tad", + "rom:/data/hnda-v0.tad", + "rom:/data/hnea-v0.tad", + "rom:/data/hnfp-v0.tad", + "rom:/data/hngp-v0.tad", "rom:/data/hnha-v0.tad", + "rom:/data/hnip-v0.tad", + "rom:/data/hnjp-v0.tad", + "rom:/data/hnkp-v0.tad", "rom:/data/hnlp-v0.tad", }; @@ -564,7 +571,7 @@ static void DrawWaitButtonA(void) kamiFontPrintfMain( 5, 3, 8, " System Updater [EUR]"); kamiFontPrintfMain( 4, 5, 8, " --- ver %s %s ---", g_strSDKSvnRevision, g_strIPLSvnRevision ); - kamiFontPrintfMain( 1, 6, 8, " Build time:%s", BUILD_TIME ); + kamiFontPrintfMain( 1, 6, 8, "Build time:%s", BUILD_TIME ); kamiFontPrintfMain( 5, 9, 3, " A Button: Start Update "); kamiFontPrintfMain( 5, 10, 3, " B Button: Cancel Update "); diff --git a/build/tests/CustomSystemUpdater/Makefile b/build/tests/CustomSystemUpdater/Makefile index 6792155e..3d2e5858 100644 --- a/build/tests/CustomSystemUpdater/Makefile +++ b/build/tests/CustomSystemUpdater/Makefile @@ -16,6 +16,10 @@ # $Author$ #---------------------------------------------------------------------------- +override TARGET_PLATFORM = TWL +override TARGET_CODEGEN = THUMB +override TWL_ARCHGEN = LIMITED + TARGET_FIRM = SYSTEMMENU @@ -23,6 +27,42 @@ include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs #---------------------------------------------------------------------------- +#.PHONY: no_rom_set +#no_rom_set: +# echo "Usage: make ROMSET=dirname" +# +#ifeq ($(ROMSET),) +# no_rom_set +#endif +# + +# リージョンが指定されてなかったら全部やる +ifeq ($(REGION),) + +include $(TWLSDK_ROOT)/build/buildtools/commondefs + +do-build: do-something +clean: do-something +clobber: do-something +install: do-something +do-build: MY_GOAL= +clean: MY_GOAL=clean +clobber: MY_GOAL=clobber +install: MY_GOAL=install + +do-something: + +$(REMAKE) TWLSDK_PLATFORM=TWL REGION=JPN ROMSET=$(ROMSET) SKIP_SUBDIR=FALSE $(MY_GOAL) + -rm `find . -name "*autogen*"` + +$(REMAKE) TWLSDK_PLATFORM=TWL REGION=AUS ROMSET=$(ROMSET) SKIP_SUBDIR=FALSE $(MY_GOAL) + -rm `find . -name "*autogen*"` + +$(REMAKE) TWLSDK_PLATFORM=TWL REGION=USA ROMSET=$(ROMSET) SKIP_SUBDIR=FALSE $(MY_GOAL) + -rm `find . -name "*autogen*"` + +$(REMAKE) TWLSDK_PLATFORM=TWL REGION=EUR ROMSET=$(ROMSET) SKIP_SUBDIR=FALSE $(MY_GOAL) + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +else + LAUNCHER_DIR = $(TWL_IPL_RED_ROOT)/build/systemMenu_RED/Launcher MACHINESETTINGS_DIR = $(TWL_IPL_RED_ROOT)/build/systemMenu_RED/MachineSettings WLANFIRM_DIR = $(TWL_IPL_RED_ROOT)/build/systemMenu_RED/wlanfirm @@ -30,10 +70,6 @@ DS_HASH_TABLE = $(TWL_IPL_RED_ROOT)/build/systemMenu_RED/DSHashTable SHARED_FONT_DIR = $(TWL_IPL_RED_ROOT)/build/systemMenu_RED/sharedFont NANDFIRM_DIR = $(TWL_IPL_RED_ROOT)/build/nandfirm/menu-launcher -# リージョンが指定されてなかったら日本 -ifeq ($(REGION),) -REGION = JPN -endif # 既存データを使用する場合はTRUEを指定 @@ -58,6 +94,7 @@ endif # CustomRegion export SYSM_REGION = $(REGION) +export ROMSET := $(ROMSET) # COMPILE SWITCH for build SystemMenu @@ -81,4 +118,6 @@ export SYSM_USE_WLANFIRM_LOCAL_PUBKEY = FALSE include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules +endif + #===== End of Makefile ===== diff --git a/build/tests/CustomSystemUpdater/makecsu.sh b/build/tests/CustomSystemUpdater/makecsu.sh index 42f80d37..c8a17d1f 100755 --- a/build/tests/CustomSystemUpdater/makecsu.sh +++ b/build/tests/CustomSystemUpdater/makecsu.sh @@ -17,8 +17,8 @@ #---------------------------------------------------------------------------- gen_updater(){ -ruby sumaker.rb custom $1 $2 -make REGION=$2 +#ruby sumaker.rb custom $1 $2 +make ROMSET=$1 REGION=$2 rm `find . -name "*autogen*"` } diff --git a/build/tests/CustomSystemUpdater/romchecker.rb b/build/tests/CustomSystemUpdater/romchecker.rb new file mode 100755 index 00000000..ec79aa8f --- /dev/null +++ b/build/tests/CustomSystemUpdater/romchecker.rb @@ -0,0 +1,108 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK +# File: romchecker.rb +# +# 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$ +#---------------------------------------------------------------------------- + +ALL_REGION = [ + "c", "d", "e", "h", +] + +FIX_REGION = [ + "a", "b", "f", "g", "i", "j", "k", "l", +] + +HEADER = "hn" + +REGION_DIRS = { + "aus" => "u", + "euro" => "p", + "jp" => "j", + "usa" => "e", +} + +REG_PATH = /[a-zA-Z0-9\.\-_]+\/[a-zA-Z0-9\.\-_*]+\z/ + +NAND_FIRM = "*.nand" +FONT_DATA = "*.dat" + +# ファイルを検索し、ROM内に含まれるべきかどうかを判定する +# 条件に一致したファイル名の配列の要素数で判定 +# 0 個 ファイルがない +# 1 個 正常っぽい +# 2 個以上 バージョン違いや、リージョン違いが混ざっている +def check_pickuped(path, print_success) + ret = true + files = Dir.glob(path) + p_path = path.slice(REG_PATH) + case + when files.size == 0 + $stdout.printf( "NG:#{p_path} -- #{p_path} is not included ***********\n") + ret = false + when files.size == 1 && print_success + $stdout.printf( "OK:#{files[0].slice(REG_PATH)}\n") + when files.size >= 2 + $stdout.printf("NG:") + files.each{|file| + $stdout.printf( "#{file.slice(REG_PATH)} ") + } + $stdout.printf("-- Too many files are included ***********\n") + ret = false + end + ret +end + + +def check(target_dir) + ret = true + REGION_DIRS.each{|region_dir, region_code| + ALL_REGION.each{|app_code| + # オールリージョンのロムが含まれているかのチェック + search_path = "#{target_dir}/#{region_dir}/#{HEADER}#{app_code}a*.tad" + ret &= check_pickuped(search_path, false) + } + FIX_REGION.each{|app_code| + # 各リージョン固有のロムが含まれているかのチェック + search_path = "#{target_dir}/#{region_dir}/#{HEADER}#{app_code}#{region_code}*.tad" + ret &= check_pickuped(search_path, false) + } + (ALL_REGION + FIX_REGION).each{|app_code| + # HNxy が 各リージョンごと1つだけ存在するかのチェック + # HNxA と HNxU など、aとuが混在していたりするとここでひっかかる + search_path = "#{target_dir}/#{region_dir}/#{HEADER}#{app_code}*.tad" + ret &= check_pickuped(search_path, false) + } + + # nand firm, font のチェック + search_path = "#{target_dir}/#{region_dir}/#{NAND_FIRM}" + ret &= check_pickuped(search_path, false) + search_path = "#{target_dir}/#{region_dir}/#{FONT_DATA}" + ret &= check_pickuped(search_path, false) + + $stdout.printf("\n") + } + ret +end + +# こっからメイン + +if ARGV.size < 1 + p "Usage: #{__FILE__} targetdir" + exit -1 +end + +target = ARGV[0] + +exit (check target) ? 0 : -1 + diff --git a/build/tests/CustomSystemUpdater/sumaker.rb b/build/tests/CustomSystemUpdater/sumaker.rb index 86c5439d..bcb470df 100755 --- a/build/tests/CustomSystemUpdater/sumaker.rb +++ b/build/tests/CustomSystemUpdater/sumaker.rb @@ -61,14 +61,20 @@ def make_default_config end +# ファイル名にスクリプトを置いてあるディレクトリをくっつける +def calc_path(filename) +# File.join(File.dirname(File.expand_path(__FILE__)), filename) +filename +end + # コンフィグファイルを読んで展開 def read_config(filename) - YAML.load(File.read(filename)) + YAML.load(File.read(calc_path(filename))) end # コンフィグのライト def write_config(filename, data) - File.open(filename, "w") {|file| + File.open(calc_path(filename), "w") {|file| file.write data.to_yaml } end @@ -87,7 +93,7 @@ def write_data(filename, data) temp = Tempfile.new("temp") temp.puts data temp.close - FileUtils.cp(temp.path, filename) + FileUtils.cp(temp.path, calc_path(filename)) end # main.rsfの書き換え @@ -154,11 +160,15 @@ when "default" then when "custom" then if ARGV.size < 3 p "Usage: sumaker custom target_dir region" - exit + exit -1 end # カスタム設定で作成 config = "custom_base.yaml" region = ARGV[2] + + # カレントディレクトリ変更 + Dir.chdir(File.dirname(File.expand_path(__FILE__))) + # ベースコンフィグに、dataディレクトリ内のtadとnandを追加 config = read_config(config) @@ -184,5 +194,7 @@ when "custom" then config[:TadFiles] = config[:TadFiles].uniq write_config(CUSTOM_CONFIG, config) make_updater(CUSTOM_CONFIG) + + exit 0 end