@echo off

@cd BuildOs
@echo d | xcopy /E /H /K /Q /Y ..\src\4\IMGFS\OEM OEM
@echo d | xcopy /E /H /K /Q /Y ..\src\4\IMGFS\SYS SYS
@mkdir OEM
@mkdir ROM
@mkdir ROM\XIP

@xcopy /H /Q /Y ..\src\4\XIP\MSXIPKernel\boot_ms.rgu ROM\XIP\
@xcopy /H /Q /Y ..\src\4\XIP\OEMXIPKERNEL\boot.rgu ROM\XIP\

SET _FLATRELEASEDIR=.
@cd SYS\Metadata
@..\..\Tools\rgucomp.exe -o default.hv > default.txt
@..\..\Tools\rgucomp.exe -o user.hv > user.txt
@..\..\Tools\iconv.exe -t UTF-16LE default.txt > default.ucs-2le
@..\..\Tools\iconv.exe -t UTF-16LE user.txt > user.ucs-2le

@copy /B /Y ..\..\Tools\rguheader.UCS-2LE + default.ucs-2le + user.ucs-2le 034e7cf6-8a37-40ad-85bd-6851b921866a.rgu
@del default.txt
@del default.ucs-2le
@del user.txt
@del user.ucs-2le
SET _FLATRELEASEDIR=
@cd ..\..

BuildOS.exe

@rem echo f | xcopy /H /Q /Y SYS\.ROM temp\dump\.ROM
@rem echo f | xcopy /H /Q /Y SYS\.VM temp\dump\.VM
@rem echo f | xcopy /H /Q /Y ..\src\4\IMGFS\OEM.cer temp\dump\OEM.cer

cd ..
