1#!/usr/bin/env omake 2#---------------------------------------------------------------------------- 3# Project: Horizon 4# File: testutil.om 5# 6# Copyright 2007-2009 Nintendo. All rights reserved. 7# 8# These coded instructions, statements, and computer programs contain 9# proprietary information of Nintendo of America Inc. and/or Nintendo 10# Company Ltd., and are protected by Federal copyright law. They may 11# not be disclosed to third parties or copied or duplicated in any form, 12# in whole or in part, without the prior written consent of Nintendo. 13# 14# $Date:: 2010-08-20#$ 15# $Rev: 24283 $ 16# $Author: takiguchi_shinichi $ 17#---------------------------------------------------------------------------- 18 19LOADRUN = $(absname $(ROOT_TOOLS)$(DIRSEP)CommandLineTools$(DIRSEP)ctr_loadrunf32.exe) 20DEFAULT_RUN_TIMEOUT = 60 21DEFAULT_EXIT_PATTERN= $"CU_TEST_EXIT|KernelPanic|nn::svc::Break\(" 22 23# UNIQUE_ID ���w�肵�� cia �����܂��B 24public.MakeCiaByID(filename, id, sources, rsf) = 25 depends = 26 CTR_APPTYPE = NAND 27 objects[] = 28 target_program = $(filename) 29 UNIQUE_ID = 0x$(id) 30 MAKEROMFLAGS += -DUNIQUE_ID=$(UNIQUE_ID) 31 TITLE = $(filename) 32 ROM_SPEC_FILE = $(rsf) 33 34 if $(not $(defined DESCRIPTOR)) 35 DESCRIPTOR = $(HORIZON_ROOT)/resources/specfiles/Application.desc 36 export 37 38 section 39 if $(defined TESTCIA_ROMFS_ROOT) 40 ROMFS_ROOT = $(TESTCIA_ROMFS_ROOT) 41 export ROMFS_ROOT 42 else 43 ROMFS_ROOT = 44 export ROMFS_ROOT 45 46 foreach(target, $(BUILDER.getTargets $(SUPPORTED_TARGETS))) 47 if $(defined UserRunProcess) 48 depends += $(UserRunProcess $(target), $(target_program), $(sources) $(objects)) 49 export depends 50 else 51 depends += $(UserProcess $(target), $(target_program), $(sources) $(objects)) 52 export depends 53 export depends 54 export depends 55 56 return $(filter %$(EXT_CIA), $(depends)) 57 58# UNIQUE_ID �͈̔͂��w�肵�� cia �����܂��B 59public.MakeCiaByIDRange(id_s, id_e, sources, rsf) = 60 depends = 61 id_s_denary = $(int 0x$(id_s)) 62 id_e_denary = $(int 0x$(id_e)) 63 idx = $(id_s_denary) 64 while $(lt $(idx), $(add $(id_e_denary), 1)) 65 id_hex = $(sprintf $"%05X", $(idx)) 66 depends += $(MakeCiaByID $(id_hex), $(id_hex), $(sources), $(rsf)) 67 idx = $(add $(idx), 1) 68 return $(depends) 69 70# cfa ���쐬���܂��B�i�o�͐�w��t�j 71public.FileArchiveWithOutdir(srcdir, outdir, rsf) = 72 name = $(basename $(srcdir)) 73 SOURCES_BASE_ROOT = $(dirname $(srcdir)) 74 CFAFile = $(makeDirectory $(outdir))$(DIRSEP)$(name)$(EXT_CFA) 75 76 if $(not $(defined ARCHIVE_DEPENDENCIES)) 77 ARCHIVE_DEPENDENCIES = $(ls -R, $(dir $(srcdir))) 78 export 79 ARCHIVE_DEPENDENCIES += $(rsf) 80 81 $(CFAFile): $(makeDirectory $(dirname $(CFAFile))) 82 $(CFAFile): $(srcdir) $(MAKEROM) $(rsf) $(ARCHIVE_DEPENDENCIES) 83 $(MAKEROM) -o $@ -DROMFS_ROOT=$(srcdir) $(MAKEROMFLAGS) -f data -rsf $(rsf) 84 85 return $(CFAFile) 86 87# �R���e���c���܂� cia �����܂��B 88public.MakeCiaWithContents(filename, contents, rsf) = 89 depends = 90 CTR_APPTYPE = NAND 91 title_contents[] = 92 target_title = $(filename) 93 TITLE = $(filename) 94 UNIQUE_ID = 0xFE000 95 MAKEROMFLAGS += -DUNIQUE_ID=$(UNIQUE_ID) 96 ROM_SPEC_FILE = $(rsf) 97 98 idx = 0 99 foreach(content, $(contents)) 100 title_contents += $(idx)>$(content) 101 idx = $(add $(idx), 1) 102 export 103 104 if $(defined Title) 105 foreach(target, $(BUILDER.getTargets $(SUPPORTED_TARGETS))) 106 depends += $(Title $(target), $(target_title), $(title_contents)) 107 export depends 108 export depends 109 110 return $(depends) 111 112# �}�j���A�����܂� cia �����܂��B 113public.MakeCiaWithManual(filename, id, sources, rsf, manualdir) = 114 section 115 MANUAL_DIR = $(manualdir) 116 return $(MakeCiaByID $(filename), $(id), $(sources), $(rsf)) 117 118# �C�ӂ̑傫���̃t�@�C�������܂��B 119public.MakeSpecifiedSizeFile(datafile, filesize) = 120 filedir = $(dirname $(datafile)) 121 $(datafile): $(makeDirectory $(filedir)) 122 section 123 rm -f $(filedir)/* 124 f = $(fopen $@, w) 125 try 126 lseek($(f), $(sub $(filesize), 3), SEEK_SET) 127 fprint($(f), end) 128 catch RuntimeException(e) 129 idx = 0 130 while $(lt $(idx), $(filesize)) 131 fprint($(f), A) 132 idx = $(add $(idx), 1) 133 close($(f)) 134 return $(datafile) 135 136# romfs �ɔC�ӂ̑傫���̃t�@�C�������� cia �����܂��B 137public.MakeCiaWithRomfs(filename, id, filesize, sources, rsf) = 138 section 139 TESTCIA_ROMFS_ROOT = $(getOutputBaseDirectory)/$(SUBDIR_OBJECTS)/$(getModuleSubDirectory)/files_$(id) 140 datafile = $(TESTCIA_ROMFS_ROOT)/data.txt 141 ROMFS_DEPENDENCIES = $(MakeSpecifiedSizeFile $(datafile), $(filesize)) 142 return $(MakeCiaByID $(filename), $(id), $(sources), $(rsf)) 143 144# �t�@�C���� romfs_dir �փR�s�[���܂��B 145public.CopyIntoRomfsroot(romfs_dir, srces) = 146 copiedfiles = 147 148 foreach(TARGET, $(BUILDER.getTargets $(SUPPORTED_TARGETS))) 149 foreach(src, $(srces)) 150 filename = $(basename $(src)) 151 romfsroot = $(TARGET.getImageDirectory false)/$(romfs_dir) 152 copiedfile = $(romfsroot)/$(filename) 153 copiedfiles += $(copiedfile) 154 $(copiedfile): $(src) $(makeDirectory $(romfsroot)) 155 cp $(src) $(copiedfile) 156 export copiedfiles 157 export copiedfiles 158 159 return $(copiedfiles) 160 161# �^�[�Q�b�g�ʂɐ�������Ă���t�@�C���� romfs_dir �փR�s�[���܂��B 162public.CopyIntoRomfsrootFilteredByTarget(romfs_dir, srces) = 163 copiedfiles = 164 165 foreach(TARGET, $(BUILDER.getTargets $(SUPPORTED_TARGETS))) 166 target_srces = 167 foreach(src, $(srces)) 168 dirs = $(split /, $(split \\, $(src))) 169 if $(and $(mem $(TARGET.getFullnameWithSystem Process), $(dirs)), $(mem $(TARGET.buildtype), $(dirs))) 170 target_srces += $(src) 171 export target_srces 172 export target_srces 173 174 foreach(src, $(target_srces)) 175 filename = $(basename $(src)) 176 romfsroot = $(TARGET.getImageDirectory false)/$(romfs_dir) 177 copiedfile = $(romfsroot)/$(filename) 178 copiedfiles += $(copiedfile) 179 $(copiedfile): $(src) $(makeDirectory $(romfsroot)) 180 cp $(src) $(copiedfile) 181 export copiedfiles 182 export copiedfiles 183 184 return $(copiedfiles) 185 186# �t�@�C�����J���A��s���ǂݍ��݂܂��B 187public.ReadFileLine(filename) = 188 f = $(fopen $(filename), r) 189 result = 190 while true 191 try 192 result += $(input-line $(f)) 193 export result 194 catch RuntimeException(e) 195 break() 196 export result 197 close($(f)) 198 return $(result) 199 200GetARM11Kernel(config) = 201 kernel = $(config.getSuitableKernelFilename) 202 kernel_arm11 = $(gsub $(kernel),Kernel\.ARM946ES\.,Kernel.MPCore.) 203 return $(kernel_arm11) 204 205GetProcessList(config) = 206 return $(dirname $(GetARM11Kernel $(config)))$(DIRSEP)process.list 207 208GetARM9Kernel(config) = 209 kernel = $(config.getSuitableKernelFilename) 210 kernel_arm9 = $(gsub $(kernel),Kernel\.MPCore\.,Kernel.ARM946ES.) 211 212 if $(not $(and $(defined TEST_DEBUG_ARM9), $(TEST_DEBUG_ARM9))) 213 kernel_arm9 = $(gsub $(kernel_arm9),Development,Release) 214 kernel_arm9 = $(gsub $(kernel_arm9),Debug,Release) 215 export 216 217# PC��̃v���O���������s����N���X�ł��B 218HostProgramRunner. = 219 class HostProgramRunner 220 221 program = 222 223 new(program) = 224 this.program = $(program) 225 return $(this) 226 227 run() = 228 $(program) & 229 230public.MakeHostProgramRunner(program) = 231 return $(HostProgramRunner.new $(program)) 232 233ProgramRunner. = 234 class ProgramRunner 235 236 new(program, exitpattern, timeout, depends) = 237 this.program = $(program) 238 this.exitPattern = $(exitpattern) 239 this.timeOut = $(timeout) 240 this.depends = $(depends) 241 return $(this) 242 243 GetDepends() = 244 if $(not $(SKIP_BUILD)) 245 ret[] = 246 $(program) 247 $(depends) 248 return $(ret) 249 return $(EMPTY) 250 251 run(options, logfile) = 252 dependsoption = 253 254 foreach( depend, $(depends)) 255 if $(not $(equal $(depend), "")) 256 dependsoption += -rp $(depend) 257 export dependsoption 258 export dependsoption 259 260 echo $(LOADRUN) $(options) $(dependsoption) -re $(program) -e $(exitPattern) -t $(timeOut) | tee $(logfile) 261 $(LOADRUN) $(options) $(dependsoption) -re $(program) -e $(exitPattern) -t $(timeOut) | tee $(logfile) 262 263public.MakeProgramRunnerWithDepends(program, exitpattern, timeout, deps) = 264 return $(ProgramRunner.new $(program),$(exitpattern),$(timeout), $(deps)) 265 266public.MakeProgramRunner(program, exitpattern, timeout) = 267 return $(ProgramRunner.new $(program),$(exitpattern),$(timeout), "") 268 269public.GetToolPath(programName, ext) = 270 return $(HORIZON_ROOT_IMAGES)$(DIRSEP)tools$(DIRSEP)$(programName)$(DIRSEP)$`(TARGET.getFullnameWithSystem Process)$(DIRSEP)$`(TARGET.buildtype)$(DIRSEP)$(programName)$(ext) 271 272# �w�肳�ꂽ���O�̃v���Z�X�� CDI �̃p�X��Ԃ��܂��B 273public.GetProcessCdiPath(processName) = 274 return @$(GetProcessCdiPathPlain $(processName)) 275 276# GetProcessCdiPath�́A@�t�łȂ��p�X��Ԃ��� 277public.GetProcessCdiPathPlain(processName) = 278 if $(filter NuiShell TestMenu, $(processName)) 279 return $(HORIZON_ROOT_IMAGES)$(DIRSEP)processes$(DIRSEP)CTR$(DIRSEP)$(processName)$(DIRSEP)$`(TARGET.getFullnameWithSystem Process)$(DIRSEP)$`(TARGET.buildtype)$(DIRSEP)$(processName).cdi 280 return $(HORIZON_ROOT_IMAGES)$(DIRSEP)processes$(DIRSEP)$(processName)$(DIRSEP)$`(TARGET.getFullnameWithSystem Process)$(DIRSEP)$`(TARGET.buildtype)$(DIRSEP)$(processName).cdi 281 282# �w�肳�ꂽ�����̃v���Z�X��CDI�̃p�X��Ԃ��܂��B 283# 284# ��: 285# DEPEND_PROCESSES[] = 286# test_XXXX>$(GetProcessCdiPathList ptm cfg spi) 287# 288public.GetProcessCdiPathList(processNames) = 289 pathlist = $(GetProcessCdiPath $(nth 0, $(processNames))) 290 foreach(proc, $(nth-tl 1, $(processNames))) 291 pathlist =$(pathlist),$(GetProcessCdiPath $(proc)) 292 export 293 return $(pathlist) 294 295public.GetLoadrunOptionsForTool() = 296 options = 297 298 if $(and $(defined RUN_NOWAIT), $(RUN_NOWAIT)) 299 options += --no-wait 300 export options 301 302 return $(options) 303 304# �����^�[�Q�b�g�Ńv���O�����点�邽�߂̃I�u�W�F�N�g�����܂��B 305# DefineMultiTargetTest �Ŏg���܂��B 306# TODO: ���̃e�X�g���s�n�Ɠ������� 307MakeMultiTargetRunner(program, depends, timeOut) = 308 #program = $`(config.getBinaryPath $,(program), $(EXT_CCI)) 309 return $(MultiTargetRunner.new $(program), $(depends), $(DEFAULT_EXIT_PATTERN), $(timeOut)) 310 311MultiTargetRunner. = 312 class MultiTargetRunner 313 314 new(runProgram, cdiDepends, exitPattern, timeOut) = 315 this.runProgram = $(runProgram) 316 this.exitPattern = $(exitPattern) 317 this.cdiDepends = $(cdiDepends) 318 this.timeOut = $(timeOut) 319 return $(this) 320 321 getOption(config) = 322 option = 323 324 option += -c0 esc -c0 init 325 326 # �J�[�l�� 327 option += -k11 $(GetARM11Kernel $(config)) 328 option += -k9 $(GetARM9Kernel $(config)) 329 330 # process.list 331 option += -pl $(GetProcessList $(config)) 332 333 #�v���O���� 334 option += 335 foreach( depend, $(cdiDepends) ) 336 value $(array -rp $(depend)) 337 338 if $(equal $(suffix $(runProgram)), .cdi) 339 option += -rp $(runProgram) 340 export option 341 else 342 option += -re $(runProgram) 343 export option 344 345 346 # exitpattern, timeout 347 option += -t $(timeOut) -e $(exitPattern) 348 349 option += $(GetLoadrunOptionsForTool) 350 351 return $(option) 352 353 needLog() = 354 return true 355 356 getDepends(config) = 357 depends = 358 359 if $(not $(and $(defined SKIP_BUILD),$(SKIP_BUILD))) 360 depends += $(array $(GetARM11Kernel $(config)) $(GetARM9Kernel $(config)) $(runProgram) $(cdiDepends)) 361 export 362 363 return $(depends) 364 365 getLogfilePath(config) = 366 return $(addsuffix .multi.log, $(removesuffix $(runProgram))) 367 368# �����^�[�Q�b�g�ɑ���e�X�g�̎��s���[�����`���܂��B 369DefineMultiTargetTest(runners) = 370 BUILD_TESTS = true 371 if $(eq 0,$(length $(filter dotests-multi, $(TARGETS)))) 372 return 373 374 foreach(TARGET, $(BUILDER.getTargets $(SUPPORTED_TARGETS))) 375 config = $(TARGET) 376 depends = 377 foreach( runner, $(runners) ) 378 value $(runner.getDepends $(config)) 379 380 outputs = 381 foreach( runner, $(runners) ) 382 value $(runner.getLogfilePath $(config)) 383 384 if $(not $(defined CTR_RUN_DEVICES)) 385 eprintln(�����^�[�Q�b�g���g�����e�X�g�����s����ɂ� CTR_RUN_DEVICES �Ń^�[�Q�b�g���w�肵�Ă��������B) 386 exit(1) 387 388 num_runners = $(length $(runners)) 389 devices = $(split $":", $(CTR_RUN_DEVICES)) 390 num_devices = $(length $(devices)) 391 392 if $(not $(le $(num_runners), $(num_devices))) 393 eprintln(���s�������v���O�����̐��ɑ��� CTR_RUN_DEVICES �ɐݒ肳��Ă���f�o�C�X�̐�������܂���B) 394 exit(1) 395 396 options = 397 foreach( runner, $(runners) ) 398 value $(quote-argv $(runner.getOption $(config))) 399 400 logfiles = 401 foreach( runner, $(runners) ) 402 value $(runner.getLogfilePath $(config)) 403 404 dotests-multi: $(depends) :effects: $(outputs) $(LOADRUN) 405 section: 406 i = 0 407 while $(lt $i, $(num_runners)) 408 option = $(split $" ",$(nth $(i),$(options))) 409 logfile = $(nth $(i),$(logfiles)) 410 device = $(nth $(i),$(devices)) 411 echo loadrunf $(option) -d $(device) 412 $(LOADRUN) $,(option) -d $(device) | tee $(logfile) & 413 sleep 3 414 i = $(add $i, 1) 415 416CategoryParam. = 417 class CategoryParam 418 419 category = Normal 420 cannot_execution = false # ���s�s�� 421 system = false # �V�X�e�� 422 require_batch_update = false # �ꊇ�A�b�v�f�[�g���K�v 423 not_require_user_approval = false # ���[�U���ӂ��s�v 424 not_require_right_for_mount = false # �}�E���g�Ɍ����s�v 425 can_skip_convert_jump_id = false # JumpId �ϊ��X�L�b�v�\ 426 427 descparam[] = 428 makeromflags = 429 ccflags = 430 431 new(category, params) = 432 this.category = $(category) 433 foreach(param, $(params)) 434 param_seq = $(split :, $(param)) 435 paramname = $(nth 0, $(param_seq)) 436 val = true 437 if $(equal $(length $(param_seq)), 2) 438 val = $(nth 1, $(param_seq)) 439 export val 440 441 switch $(paramname) 442 case CannotExecution 443 this.cannot_execution = $(val) 444 export 445 case System 446 this.system = $(val) 447 export 448 case RequireBatchUpdate 449 this.require_batch_update = $(val) 450 export 451 case NotRequireUserApproval 452 this.not_require_user_approval = $(val) 453 export 454 case NotRequireRightForMount 455 this.not_require_right_for_mount = $(val) 456 export 457 case CanSkipConvertJumpId 458 this.can_skip_convert_jump_id = $(val) 459 export 460 default 461 echo $"[testutil.om CategoryParam] Undefined Parameter:" $(paramname) 462 export 463 464 this.descparam[] += 465 CategoryFlags+=$(this.category) 466 this.makeromflags += -DCATEGORYFLAGS0="- $(this.category)" 467 this.ccflags += -DINFOVIEW_CATEGORY0=\"$(this.category)\" 468 idx = 1 469 if $(this.cannot_execution) 470 this.descparam[] += 471 CategoryFlags+=CannotExecution 472 this.makeromflags += -DCATEGORYFLAGS$(idx)=$"- CannotExecution" 473 this.ccflags += -DINFOVIEW_CATEGORY1 474 idx = $(add $(idx), 1) 475 export 476 if $(this.system) 477 this.descparam[] += 478 CategoryFlags+=System 479 this.makeromflags += -DCATEGORYFLAGS$(idx)=$"- System" 480 this.ccflags += -DINFOVIEW_CATEGORY2 481 idx = $(add $(idx), 1) 482 export 483 if $(this.require_batch_update) 484 this.descparam[] += 485 CategoryFlags+=RequireBatchUpdate 486 this.makeromflags += -DCATEGORYFLAGS$(idx)=$"- RequireBatchUpdate" 487 this.ccflags += -DINFOVIEW_CATEGORY3 488 idx = $(add $(idx), 1) 489 export 490 if $(this.not_require_user_approval) 491 this.descparam[] += 492 CategoryFlags+=NotRequireUserApproval 493 this.makeromflags += -DCATEGORYFLAGS$(idx)=$"- NotRequireUserApproval" 494 this.ccflags += -DINFOVIEW_CATEGORY4 495 idx = $(add $(idx), 1) 496 export 497 if $(this.not_require_right_for_mount) 498 this.descparam[] += 499 CategoryFlags+=NotRequireRightForMount 500 this.makeromflags += -DCATEGORYFLAGS$(idx)=$"- NotRequireRightForMount" 501 this.ccflags += -DINFOVIEW_CATEGORY5 502 idx = $(add $(idx), 1) 503 export 504 if $(this.can_skip_convert_jump_id) 505 this.descparam[] += 506 CategoryFlags+=CanSkipConvertJumpId 507 this.makeromflags += -DCATEGORYFLAGS$(idx)=$"- CanSkipConvertJumpId" 508 this.ccflags += -DINFOVIEW_CATEGORY6 509 idx = $(add $(idx), 1) 510 export 511 512 return $(this) 513 514 isSystem() = 515 if $(this.system) 516 return true 517 return false 518 519 isContents() = 520 if $(equal $(this.category), Contents) 521 return true 522 return false 523 524 getDesc() = 525 desc = $(HORIZON_ROOT)/resources/specfiles/Application.desc 526 if $(equal $(this.category), DlpChild) 527 desc = $(HORIZON_ROOT)/resources/specfiles/DlpChild.desc 528 export desc 529 if $(equal $(this.category), Trial) 530 desc = $(HORIZON_ROOT)/resources/specfiles/Trial.desc 531 export desc 532 if $(this.isSystem) 533 desc = $(HORIZON_ROOT)/resources/specfiles/_private/SystemTest.desc 534 export desc 535 return $(desc) 536 537# MakeDummyCia �Ɏw�肷�� category ���쐬���܂��B 538public.MakeCategoryParam(category, params) = 539 return $(CategoryParam.new $(category), $(params)) 540 541# �_�~�[�R���e���c�����܂��B 542public.MakeDummyContents(name, category, unique_id, contents_dir, numcontents, data_size) = 543 contents[] = 544 testutil_dir = $(ROOT_SOURCES)/libraries/test/util 545 idx_cfa = 0 546 while $(lt $(idx_cfa), $(numcontents)) 547 section 548 MAKEROMFLAGS += -DUNIQUE_ID=$(unique_id) 549 if $(category.isSystem) 550 MAKEROMFLAGS += -keyfile $(GetSystemFixedKeyFile) 551 export MAKEROMFLAGS 552 if $(category.isContents) 553 MAKEROMFLAGS += -DCONTENTSINDEX=$(idx_cfa) 554 export MAKEROMFLAGS 555 else 556 MAKEROMFLAGS += -DCONTENTSINDEX=0 557 export MAKEROMFLAGS 558 MAKEROMFLAGS += $(category.makeromflags) 559 560 cfa_name = content_$(idx_cfa) 561 cfa_dir = $(contents_dir)/$(name)/cfafiles 562 cfa_file = $(cfa_dir)/$(cfa_name)$(EXT_CFA) 563 data_file = $(MakeSpecifiedSizeFile $(contents_dir)/$(name)/$(cfa_name)/data.txt, $(data_size)) 564 565 $(cfa_file): $(data_file) 566 contents += $(FileArchiveWithOutdir $(dirname $(data_file)), $(cfa_dir), $(testutil_dir)/dummycontent.rsf) 567 idx_cfa = $(add $(idx_cfa), 1) 568 export contents idx_cfa 569 return $(contents) 570 571# �_�~�[�^�C�g�������܂��B 572public.MakeDummyCia(tar, name, category, unique_id, variation, major_version, minor_version, micro_version, numcontents, titlesize, save_data_size) = 573 cia_file = 574 575 if $(equal $(tar), CTR) 576 cia_file = $(MakeDummyCiaCtr $(name), $(category), $(unique_id), $(variation), $(major_version), $(minor_version), $(micro_version), $(numcontents), $(titlesize), $(save_data_size)) 577 export cia_file 578 579 if $(equal $(tar), TWL) 580 cia_file = $(MakeDummyCiaTwl $(name), $(category), $(unique_id), $(variation), $(major_version), $(minor_version), $(micro_version), $(numcontents), $(titlesize), $(save_data_size)) 581 export cia_file 582 583 return $(cia_file) 584 585# CTR�p�_�~�[�^�C�g�������܂��B 586public.MakeDummyCiaCtr(name, category, unique_id, variation, major_version, minor_version, micro_version, numcontents, titlesize, save_data_size) = 587 objects_dir = $(getOutputBaseDirectory)/$(SUBDIR_OBJECTS)/$(getModuleSubDirectory) 588 testutil_dir = $(ROOT_SOURCES)/libraries/test/util 589 cia_files = 590 591 # �R���e���c���쐬���܂��B 592 contents = 593 if $(gt $(numcontents), 0) 594 data_size = $(div $(titlesize) $(numcontents)) 595 contents = $(MakeDummyContents $(name), $(category), $(unique_id), $(objects_dir), $(numcontents), $(data_size)) 596 export contents 597 598 foreach(target, $(BUILDER.getTargets $(SUPPORTED_TARGETS))) 599 cia_file = $(target.getImageDirectory false)/$(name)$(EXT_CIA) 600 infoviewer_cxi = 601 if $(not $(category.isContents)) 602 # �e�X�g�v���O�����i�p�����[�^�\���p�j���쐬���܂��B 603 infoviewer_name = InfoViewer_$(name) 604 infoviewer_cxi = $(target.getImageDirectory false)/$(infoviewer_name)$(EXT_CXI) 605 606 srccppfile = $(testutil_dir)/InfoViewer.cpp 607 copycpp = $(target.getObjectDirectory)/$(infoviewer_name).cpp 608 $(copycpp): $(srccppfile) $(makeDirectory $(dirname $(copycpp))) 609 cp $(srccppfile) $(copycpp) 610 611 sources[] = 612 $(copycpp) 613 LIBS += libnn_demoLite 614 615 target_program = $(infoviewer_name) 616 TITLE = $(infoviewer_name) 617 ROM_SPEC_FILE = $(testutil_dir)/dummyaxf.rsf 618 ROMFS_DEPENDENCIES = 619 ROMFS_ROOT = 620 MAKEROMFLAGS += -DUNIQUE_ID=$(unique_id) \ 621 -DSAVEDATASIZE=$(save_data_size) \ 622 -DREMASTERVERSION=$(major_version) 623 624 CCFLAGS += -DINFOVIEW_FILENAME=\"$(basename $(cia_file))\" \ 625 -DINFOVIEW_UNIQUE_ID=\"$(unique_id)\" \ 626 -DINFOVIEW_TITLESIZE=\"$(titlesize)\" \ 627 -DINFOVIEW_SAVEDATASIZE=\"$(save_data_size)\" \ 628 -DINFOVIEW_NUMCONTENTS=\"$(numcontents)\" \ 629 -DINFOVIEW_VARIATION=\"$(variation)\" \ 630 -DINFOVIEW_REMASTERVERSION=\"$(major_version)\" \ 631 -DINFOVIEW_TMDVERSION=\"$(major_version).$(minor_version).$(micro_version)\" \ 632 $(category.ccflags) 633 634 DESCRIPTOR = $(category.getDesc) 635 DESC_PARAM[] = 636 $(category.descparam) 637 MAKEROMFLAGS += $(category.makeromflags) 638 if $(equal $(category.category), DlpChild) 639 MAKEROMFLAGS += -DVERSION=0 \ 640 -DCHILDINDEX=$(variation) 641 export MAKEROMFLAGS 642 else 643 MAKEROMFLAGS += -DVERSION=$(variation) \ 644 -DCHILDINDEX=0 645 export MAKEROMFLAGS 646 647 if $(defined UserRunProcess) 648 infoviewer_files = $(UserRunProcess $(target), $(target_program), $(sources)) 649 else 650 infoviewer_files = $(UserProcess $(target), $(target_program), $(sources)) 651 652 export infoviewer_cxi 653 654 # CIA �����܂��B 655 makeciaflags = 656 content_files = 657 idx = 0 658 if $(infoviewer_cxi) 659 makeciaflags += -i $(join $(infoviewer_cxi), :$(idx)) 660 content_files += $(infoviewer_cxi) 661 idx = $(add $(idx), 1) 662 export makeciaflags content_files idx 663 664 foreach(content, $(contents)) 665 makeciaflags += -i $(join $(content), :$(idx)) 666 content_files += $(content) 667 idx = $(add $(idx), 1) 668 export makeciaflags content_files idx 669 670 makeciaflags += -minor $(minor_version) -micro $(micro_version) 671 if $(category.isSystem) 672 makeciaflags += -cxikey $(GetSystemFixedKeyFile) 673 export makeciaflags 674 if $(category.isContents) 675 makeciaflags += -major $(major_version) 676 export makeciaflags 677 678 $(cia_file): $(content_files) $(makeDirectory $(dirname $(cia_file))) $(MAKECIA) 679 $(MAKECIA) -o $@ $(makeciaflags) 680 681 cia_files += $(cia_file) 682 683 export cia_files 684 685 return $(cia_files) 686 687# TWL�p�_�~�[�^�C�g�������܂��B 688public.MakeDummyCiaTwl(name, category, unique_id, variation, major_version, minor_version, micro_version, numcontents, titlesize, save_data_size) = 689 objects_dir = $(getOutputBaseDirectory)/$(SUBDIR_OBJECTS)/$(getModuleSubDirectory) 690 cia_files = 691 692 # TWL�p�_�~�[�t�@�C�����쐬���܂��B 693 twl_data = $(objects_dir)/twl/twldata.dat 694 if $(not $(file-exists $(twl_data))) 695 twl_data = $(MakeSpecifiedSizeFile $(twl_data), 1024) 696 697 foreach(target, $(BUILDER.getTargets $(SUPPORTED_TARGETS))) 698 # �^�C�g�������܂��B 699 cia_file = $(target.getImageDirectory false)/$(name)$(EXT_CIA) 700 content_files = $(twl_data) 701 makeciaflags = -major $(major_version) \ 702 -minor $(minor_version) \ 703 -micro $(micro_version) \ 704 -p $(unique_id) \ 705 -padding 706 707 $(cia_file): $(content_files) $(makeDirectory $(dirname $(cia_file))) $(MAKECIA) 708 $(MAKECIA) -a $(content_files) -o $@ $(makeciaflags) 709 710 cia_files += $(cia_file) 711 712 export cia_files 713 714 return $(cia_files) 715