mkboot批处理命令解读

下面是做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

 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值