学习[30天自制操作系统]day02遇到的makefile的问题

【问题一】make run运行错误

问题描述

光盘代码day_02 helloos_4 helloos_5
在使用makefile 运行qemu 模拟器过程出错

错误图片


# 默认动作

default :
	../z_tools/make.exe img

# 镜像文件生成

ipl.bin : ipl.nas Makefile
	../z_tools/nask.exe ipl.nas ipl.bin ipl.lst

helloos.img : ipl.bin Makefile
	../z_tools/edimg.exe   imgin:../z_tools/fdimg0at.tek \
		wbinimg src:ipl.bin len:512 from:0 to:0   imgout:helloos.img

# 其他指令

asm :
	../z_tools/make.exe -r ipl.bin

img :
	../z_tools/make.exe -r helloos.img

run :
	../z_tools/make.exe img
	copy helloos.img ..\z_tools\qemu\fdimage0.bin
	../z_tools/make.exe -C ../z_tools/qemu

install :
	../z_tools/make.exe img
	../z_tools/imgtol.com w a: helloos.img

clean :
	-del ipl.bin
	-del ipl.lst

src_only :
	../z_tools/make.exe clean
	-del helloos.img

文字报错信息:

D:\Users\tolset\helloos4>..\z_tools\make.exe run -i
../z_tools/make.exe img
make.exe[1]: Entering directory `D:/Users/tolset/helloos4'
../z_tools/make.exe -r helloos.img
make.exe[2]: Entering directory `D:/Users/tolset/helloos4'
make.exe[2]: `helloos.img' is up to date.
make.exe[2]: Leaving directory `D:/Users/tolset/helloos4'
make.exe[1]: Leaving directory `D:/Users/tolset/helloos4'
#copy helloos.img ../z_tools/qemu/fdimage0.bin
copy helloos.img ..\z_tools\qemu\fdimage0.bin
process_begin: CreateProcess((null), copy helloos.img ..\z_tools\qemu\fdimage0.bin, ...) failed.
make (e=2): 系统找不到指定的文件。
..\z_tools\make.exe: [run] Error 2 (ignored)
../z_tools/make.exe -C ../z_tools/qemu
make.exe[1]: Entering directory `D:/Users/tolset/z_tools/qemu'
qemu-win.bat

make run错误 解决方案

copy helloos.img ..\z_tools\qemu\fdimage0.bin

改为:

cp helloos.img ..\z_tools\qemu\fdimage0.bin

【问题一】解决完毕

【问题二】make clean运行(系统找不到指定的文件。)

运行信息

del ipl.bin
process_begin: CreateProcess((null), del ipl.bin, ...) failed.
make (e=2): 系统找不到指定的文件。
..\z_tools\make.exe: [clean] Error 2 (ignored)
del ipl.lst
process_begin: CreateProcess((null), del ipl.lst, ...) failed.
make (e=2): 系统找不到指定的文件。

makefile 中的 clean: 部分修改即可

clean :
	-rm -f ipl.bin
	-rm -f ipl.lst
src_only :
	../z_tools/make.exe clean
	-rm -f helloos.img

好了,问题解决。

[附]完整Makefile文件代码


# 默认动作

default :
	../z_tools/make.exe img

# 镜像文件生成

ipl.bin : ipl.nas Makefile
	../z_tools/nask.exe ipl.nas ipl.bin ipl.lst

helloos.img : ipl.bin Makefile
	../z_tools/edimg.exe   imgin:../z_tools/fdimg0at.tek \
		wbinimg src:ipl.bin len:512 from:0 to:0   imgout:helloos.img

# 其他指令

asm :
	../z_tools/make.exe -r ipl.bin

img :
	../z_tools/make.exe -r helloos.img

run :
	../z_tools/make.exe img
	cp helloos.img ..\z_tools\qemu\fdimage0.bin
	../z_tools/make.exe -C ../z_tools/qemu

install :
	../z_tools/make.exe img
	../z_tools/imgtol.com w a: helloos.img

clean :
	-rm -f ipl.bin
	-rm -f ipl.lst

src_only :
	../z_tools/make.exe clean
	-rm -f helloos.img

【结束】

谢谢你的浏览,希望可以帮助到你。

  • 3
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Msln1995

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值