原创 mkboot批处理命令解读

2006-11-1 23:41 5289 8 8 分类: MCU/ 嵌入式

下面是做bootrom时的批处理命令,其实一般这个步骤不会出错,但是解释一下会更有利于对bootrom启动的理解:(本人用的bootrom_uncmp)


@echo off
if "%1" == "" goto usage  参数一盘符一般选a:
if "%2" == "" goto usage  做bootrom的源文件


vxsys %1  在第零扇区写入机器代码引导bootrom,这段代码决定了bootrom必须连续
if errorlevel 1 goto sysfail
if exist %1bootrom.sys del %1bootrom.sys


rem Check files with known names
rem Customers using unique file names should make modifications below.
if "%2" == "bootrom.dat"         goto omf
if "%2" == "bootrom"             goto omf
if "%2" == "bootrom_uncmp"       goto omf
if "%2" == "vxWorks_rom"         goto omf
if "%2" == "bootrom.bin"         goto binext
if "%2" == "bootrom_uncmp.bin"   goto binext
if "%2" == "vxWorks_rom.bin"     goto binext


echo Warning, Unrecognized file name %2. Assuming .bin extension.


:binext
copy %2 %1bootrom.sys
if errorlevel 1 goto copyfail
goto chkdsk


:omf
objcopypentium -O binary --gap-fill="0" %2 %1bootrom.sys  生成bootrom,最好软盘时空盘,否则可能造成不连续。也可以在其他盘(如CF卡)下做。
if errorlevel 1 goto omffail


:chkdsk  检查文件是否连续
echo System tranferred.  Checking %1BOOTROM.SYS is contiguous
echo chkdsk %1bootrom.sys
chkdsk %1bootrom.sys
goto end


:omffail 出现错误
echo Failed to objcopy %2 to %1BOOTROM.SYS!
goto usage


:sysfail
echo Failed to install boot sector on drive %1!
goto usage


:copyfail
echo Failed to copy %2 to %1BOOTROM.SYS!


:usage
echo Usage: mkboot drive: bootfile (e.g. mkboot a: bootrom.bin)
echo Installs VxWorks boot sector on drive, and copies over bootfile
echo as boot image BOOTROM.SYS. If the bootrom file is named bootrom.dat
echo as documented in older literature, then the file is assumed to be
echo an object module and is converted to binary before copied.
echo Note: BOOTROM.SYS must be contiguous or the boot will fail.  This can
echo be verified with CHKDSK.


:end

PARTNER CONTENT

文章评论0条评论)

登录后参与讨论
EE直播间
更多
我要评论
0
8
关闭 站长推荐上一条 /3 下一条