[Manual XIP porting]M49X WM6.5 Rom kitchen
일반적인 기기의 XIP는 Lennysh(Dell X50v/X51v로 유명했죠...^^ )의 XIP kitchen이나 Ervius의 XIPporterEX로 쉽게 XIP porting이 가능했습니다.
하지만 M49X의 경우 위의 tool들을 사용하면 USB cable을 PC와 연결하면 멈춰버리는 문제가 발생합니다.
그래서 시간이 걸리고 불편하더라도 지금 상황에서는 수동으로 XIP를 porting하는 방법 밖에는 없네요.
(누군가 M49X에 맞게 멋진 프로그램을 짜주신다면...^^ 참 좋겠는데요...ㅎㅎㅎ)
자... 그럼 시작합니다.
먼저 매뉴얼 XIP porting을 위해서 XIP porting tool이 필요합니다.
첨부로 우리의 멋진 Ervius 및 기타 날고 기는 분들이 만들어 두신 tool을 첨부합니다.
파일 받으셔서 압축 해제하셔서 해당 폴더를 XIP porting용 kitchen으로 만들어 쓰시면 될 것 같네요.
해당 파일에 23008 build M49X(Device) XIP와 23034 build(Dornor) XIP를 첨부해 두었으니 연습해 보시면 좋겠네요.
1. Device XIP와 Dornor XIP를 dump하여 map을 작성하고 package로 만듭니다.
kitchen에 xip.bin을 놓고 XIPPort.exe를 실행하시면 창이 뜨고 가장 위의 dump xip.bin을 클릭하시면 OUT이라는 폴더내에 dump가 됩니다. 이제 write maps를 클릭하여 map을 작성하고 make pkgs를 클릭하여 dump된 파일들을 package화 합니다.
저 같은 경우는 이 Dump된 OUT폴더의 이름을 OUT_23008로 하였습니다.
Dornor XIP도 마찬가지로 작업합니다. 저는 이것을 OUT_23034로 rename하였습니다.
2. Device XIP dump 폴더 내의 MSXIPKernel과 MSXIPKernelLTK(File과 Module 모두)를 Dornor XIP Dump내의 내용으로 바꾸어 줍니다. 이 때 추가적으로 있는 *.txt도 같이 복사하셔야 합니다. (txt파일에 allocation 정보가 들어 있습니다.)
Build가 올라가면서 MS에서 release하는 XIP의 내용이 MSXIPKernel과 MSXIPKernelLTK입니다.
M49X도 WM6.5로 개발되면 native kernel이 있을테고 OEMXIPKernel도 거기에 맞추어 update 될텐데 현실은 그렇지 않습니다.^^
3. 이제 Device XIP와 Dornor XIP가 합쳐져서 새로운 XIP dump 폴더가 만들어 졌습니다.
이 폴더 이름을 OUT으로 바꾸어 줍니다.
XIPPort.exe를 다시 실행 하셔서 undo를 클릭하여 package화 되기 전으로 돌아갑니다.
Relloc P를 클릭하여 re-allocation합니다. write maps를 클릭하여 새로운 map을 작성합니다.
4. OUT폴더 내의 map.txt를 열어주세요.
아래의 내용은 o32의 내용입니다.
시작주소 - 끝주소 L길이
01f701fe - 01f701fe L00000000 Start: first DLL address
01f701fe - 01fb0000 L0003fe02 NUL
01fb0000 - 01fd3000 L00023000 Virtual base address of PocketFS.dll
01fb1000 - 01fd3000 L00022000 !!!!!!!!!!!!!!!!!!
01fb1000 - 01fd1000 L00020000 unknown data of region_0 PocketFS.dll
01fd1000 - 01fd2000 L00001000 initialized data of region_1 PocketFS.dll
01fd2000 - 01fd3000 L00001000 initialized data of region_2 PocketFS.dll
01fd3000 - 01fe9000 L00016000 NUL
01fe9000 - 01fea000 L00001000 initialized data of region_1 zylonite_dma.dll
01fea000 - 01fec000 L00002000 initialized data of region_1 ONDisk.dll
01fec000 - 01fed000 L00001000 initialized data of region_1 nandspy.dll
01fed000 - 01fee000 L00001000 initialized data of region_1 ceddk.dll
01fee000 - 01fef000 L00001000 initialized data of region_1 cecompr.dll
01fef000 - 01ff0000 L00001000 initialized data of region_1 regenum.dll
01ff0000 - 01ff1000 L00001000 initialized data of region_1 pm.dll
01ff1000 - 01ff2000 L00001000 initialized data of region_1 mspart.dll
01ff2000 - 01ff3000 L00001000 initialized data of region_1 mencfilt.dll
01ff3000 - 01ff4000 L00001000 initialized data of region_1 imgfs.dll
01ff4000 - 01ff5000 L00001000 initialized data of region_1 fsreplxfilt.dll
01ff5000 - 01ff6000 L00001000 initialized data of region_1 fsdmgr.dll
01ff6000 - 01ff7000 L00001000 initialized data of region_1 fatutil.dll
01ff7000 - 01ff8000 L00001000 initialized data of region_1 fatfsd.dll
01ff8000 - 01ff9000 L00001000 initialized data of region_1 diskcache.dll
01ff9000 - 01ffa000 L00001000 initialized data of region_1 devmgr.dll
01ffa000 - 01ffc000 L00002000 initialized data of region_1 crypt32.dll
01ffc000 - 01ffd000 L00001000 initialized data of region_1 coredll.dll
01ffd000 - 01ffe000 L00001000 initialized data of region_1 certmod.dll
01ffe000 - 01fff000 L00001000 initialized data of region_1 cachefilt.dll
01fff000 - 02000000 L00001000 initialized data of region_1 busenum.dll
02000000 - 02000000 L00000000 End: last DLL address
위의 빨간색으로 보이는 곳이 겹쳐진 부분입니다만... 삼성 original XIP도 해당 부분이 있기에 o32영역은 그냥 넘어갑시다.
다음으로 e32의 내용입니다.
시작주소 - 끝주소 L길이
02000000 - 03e24000 L01e24000 NUL
03e24000 - 03e2a000 L00006000 Virtual base address of zylonite_dma.dll
03e2a000 - 03e44000 L0001a000 Virtual base address of ONDisk.dll
03e44000 - 03e49000 L00005000 Virtual base address of nandspy.dll
03e49000 - 03e4f000 L00006000 Virtual base address of ceddk.dll
03e4f000 - 03e53000 L00004000 Virtual base address of cecompr.dll
03e52000 - 03e53000 L00001000 !!!!!!!!!!!!!!!!!!
03e52000 - 03e56000 L00004000 Virtual base address of regenum.dll
03e56000 - 03e65000 L0000f000 Virtual base address of pm.dll
03e65000 - 03e6d000 L00008000 Virtual base address of mspart.dll
03e6d000 - 03e7d000 L00010000 Virtual base address of mencfilt.dll
03e7d000 - 03e89000 L0000c000 Virtual base address of imgfs.dll
03e89000 - 03e93000 L0000a000 Virtual base address of fsreplxfilt.dll
03e93000 - 03ea9000 L00016000 Virtual base address of fsdmgr.dll
03ea9000 - 03eb2000 L00009000 Virtual base address of fatutil.dll
03eb2000 - 03ec5000 L00013000 Virtual base address of fatfsd.dll
03ec5000 - 03ecb000 L00006000 Virtual base address of diskcache.dll
03ecb000 - 03ed7000 L0000c000 Virtual base address of devmgr.dll
03ed7000 - 03f49000 L00072000 Virtual base address of crypt32.dll
03f49000 - 03fe1000 L00098000 Virtual base address of coredll.dll
03fe1000 - 03fef000 L0000e000 Virtual base address of certmod.dll
03fef000 - 03ffa000 L0000b000 Virtual base address of cachefilt.dll
03ffa000 - 04000000 L00006000 Virtual base address of busenum.dll
04000000 - 80001000 L7c001000 NUL
위의 빨간 부분에 겹쳤다는 !!!!!!표시 보이시죠?
cecompr.dll과 regenum.dll가 1000만큼 겹쳐 있네요.
이제 HEX 계산기와 MReloc.exe을 실행시키세요.(HEX 계산기는 저같은 경우 Win7의 기본 계산기로 사용합니다.)
이제 저 겹친 부분을 없애기 위해 한 칸씩 위로 밀어내야 합니다.
regenum.dll의 시작주소에서 cecompr.dll의 길이를 빼면 cecompr.dll의 시작 주소가 나오겠죠? (외우세요!! 공식입니다...ㅎㅎㅎ )
시작주소 - 끝주소 L길이
03e4f000 - 03e53000 L00004000 Virtual base address of cecompr.dll
03e52000 - 03e53000 L00001000 !!!!!!!!!!!!!!!!!!
03e52000 - 03e56000 L00004000 Virtual base address of regenum.dll
여기서는 3e52000(renenum.dll의 시작주소) - 4000(cecompr.dll의 길이) = 3e4e000(cecompr.dll의 새로운 시작주소) 이 되겠네요.
그럼 MReloc에서 Choose Module을 클릭하여 OUT\Module\cecompr.dll 을 선택해 줍니다.
e32와 o32가 보일텐데요... 이것은 현재 열어둔 map과 같을 겁니다.
지금 우리는 e32파트를 수정하므로 e32파트만 보고 수정하도록 합니다.
e32파트에 활성화된 하나의 입력폼이 보일텐데 거기에 위에서 계산한 새로운 시작위치(3e4e000)를 입력하고 아래 Doit!을 클릭합니다.
이렇게 되면 cecompr.dll module내의 imageinfo.bin이 update됩니다.
이제 cecompr.dll modul내의 imageinfo.txt를 열어 수정할 차례입니다.
현재 우리는 e32파트를 수정하고 있으므로 해당 부분만 봅시다.
Module name: cecompr.dll
e32_objcnt: 00000004
e32_imageflags: 0000212E
e32_entryrva: 000019F0
e32_vbase: V=03E4F000
e32_subsysmajor: 00000005
e32_subsysminor: 00000002
e32_stackmax: 00010000
e32_vsize: 00004000
e32_sect14rva: 00000000
e32_sect14size: 00000000
e32_timestamp: C7CB7463
e32_unit[0].rva: 00001D50
e32_unit[0].size: 0000008E
e32_unit[1].rva: 00001CFC
e32_unit[1].size: 00000028
e32_unit[2].rva: 00000000
e32_unit[2].size: 00000000
e32_unit[3].rva: 00003000
e32_unit[3].size: 00000080
e32_unit[4].rva: 00000000
e32_unit[4].size: 00000000
e32_unit[5].rva: 00004000
e32_unit[5].size: 00001000
e32_unit[6].rva: 00001000
e32_unit[6].size: 0000001C
e32_unit[7].rva: 00000000
e32_unit[7].size: 00000000
e32_unit[8].rva: 00000000
e32_unit[8].size: 00000000
e32_subsys: 00000009
V=03E4F000 시작위치가 아까 MReloc으로 수정하기 전의 값이네요. 해당 값을 우리가 계산한 새로운 값(3E4E000)으로 변경하고 저장합니다.
이제 cecompr.dll은 완성했습니다.
XIPPort에서 Relloc P를 클릭 후 write maps를 클릭하여 map을 다시 열어봅시다.
02000000 - 03e24000 L01e24000 NUL
03e24000 - 03e2a000 L00006000 Virtual base address of zylonite_dma.dll
03e2a000 - 03e44000 L0001a000 Virtual base address of ONDisk.dll
03e44000 - 03e49000 L00005000 Virtual base address of nandspy.dll
03e49000 - 03e4f000 L00006000 Virtual base address of ceddk.dll
03e4e000 - 03e4f000 L00001000 !!!!!!!!!!!!!!!!!!
03e4e000 - 03e52000 L00004000 Virtual base address of cecompr.dll
03e52000 - 03e56000 L00004000 Virtual base address of regenum.dll
03e56000 - 03e65000 L0000f000 Virtual base address of pm.dll
03e65000 - 03e6d000 L00008000 Virtual base address of mspart.dll
03e6d000 - 03e7d000 L00010000 Virtual base address of mencfilt.dll
03e7d000 - 03e89000 L0000c000 Virtual base address of imgfs.dll
03e89000 - 03e93000 L0000a000 Virtual base address of fsreplxfilt.dll
03e93000 - 03ea9000 L00016000 Virtual base address of fsdmgr.dll
03ea9000 - 03eb2000 L00009000 Virtual base address of fatutil.dll
03eb2000 - 03ec5000 L00013000 Virtual base address of fatfsd.dll
03ec5000 - 03ecb000 L00006000 Virtual base address of diskcache.dll
03ecb000 - 03ed7000 L0000c000 Virtual base address of devmgr.dll
03ed7000 - 03f49000 L00072000 Virtual base address of crypt32.dll
03f49000 - 03fe1000 L00098000 Virtual base address of coredll.dll
03fe1000 - 03fef000 L0000e000 Virtual base address of certmod.dll
03fef000 - 03ffa000 L0000b000 Virtual base address of cachefilt.dll
03ffa000 - 04000000 L00006000 Virtual base address of busenum.dll
04000000 - 80001000 L7c001000 NUL
이제 regenum.dll과 cecompr.dll사이의 겹침이 사라졌네요.
하지만 이제 cecompr.dll과 ceddk.dll 사이가 겹쳐버리네요...^^
같은 방법으로 끝까지(zylonite_dma.dll) 밀어줍시다.
겹치는 곳이 하나도 없어질 때까지 가는 겁니다...!!
5. map.txt의 가장 마지막 부분을 봅니다. 우리가 사용하게되는 RAM영역이군요...^^
803aa000 - 803aa000 L00000000 Start: start of RAM
803aa000 - 803af000 L00005000 NUL
803af000 - 803b0000 L00001000 initialized data of region_1 giisr.dll
803b0000 - 803b6000 L00006000 uninitialized data of region_2 nk.exe
803b6000 - 8053a000 L00184000 initialized data of region_3 nk.exe
803c5000 - 8053a000 L00175000 !!!!!!!!!!!!!!!!!!
803c5000 - 803c6000 L00001000 initialized data of region_1 hd.dll
803c6000 - 803ca000 L00004000 initialized data of region_1 osaxst0.dll
803ca000 - 8053a000 L00170000 NUL
8053a000 - 8053a000 L00000000 ------ start of RAM free space
8053a000 - 874e1000 L06fa7000 NUL
874e1000 - 874e1000 L00000000 End: end of RAM
이것 또한 o32영역입니다.
하지만 우리의 nk.exe께서는 이상하게 region이 여러개로 나뉘어 있네요...ㅡㅡㅋ
현재 region이 여러개로 나뉜 것에 대해서는 어떻게 밀어 버려야 할지 모르겠습니다.(아시는 분 또는 관련 정보 있으신 분은 제보 부탁드리겠습니다.)
그래서!!! 과감히 필요없다고 하는 hd.dll을 지워버리기로 급기야 결심합니다...^^
module 폴더에서 그냥 지우시고 relloc P 클릭하시면 됩니다.
그러면 이제 겹친 부분이 o32상위의 PocketFS.dll을 제외하고는 없네요...^^
이것은 삼성 original XIP도 그러니 그냥 넘어갑니다...^^(솔직히 위에서 말씀드렸듯이 region이 여러개로 나뉜 것은 제가 모르겠습니다. 삼성 original XIP가 그러니 삼성도 모를지도...ㅡㅡ;)
6. 이제 마지막 순간이네요...^^
build xip_out.bin을 클릭하세요. 짜잔~~~하고 늠름한 자태의 xip_out.bin이 기다리고 있습니다.
본 글에서 설명드렸듯이 xip.bin으로 이름을 변경하신 후, ROM 폴더에 넣으시고 2-1.xip_update.cmd를 실행하시면 끝입니다.
*참고
1. 삭제해도 무관한 XIP module및 파일