as86汇编程序的编译与链接

来源:互联网 发布:js 删除table tr 编辑:程序博客网 时间:2024/06/08 19:04

       抄好了一份boot.s代码,又搞定了编译器,接下来小结一下编译与链接。

       先用as86编译器把汇编代码编译成.o文件:

grey@DESKTOP-3T80NPQ:/mnt/e/01_workspace/15_linux/01_kernal/03_my_test_code$ls

boot.s

grey@DESKTOP-3T80NPQ:/mnt/e/01_workspace/15_linux/01_kernal/03_my_test_code$as86 -0 -a -o boot.o boot.s

grey@DESKTOP-3T80NPQ:/mnt/e/01_workspace/15_linux/01_kernal/03_my_test_code$ls

boot.o  boot.s

       接下来进行链接操作:

grey@DESKTOP-3T80NPQ:/mnt/e/01_workspace/15_linux/01_kernal/03_my_test_code$ld86 -0 -s -o boot boot.o

grey@DESKTOP-3T80NPQ:/mnt/e/01_workspace/15_linux/01_kernal/03_my_test_code$ls

boot  boot.o boot.s

       OK!链接也已经成功!查看一下详细信息:

grey@DESKTOP-3T80NPQ:/mnt/e/01_workspace/15_linux/01_kernal/03_my_test_code$ls -l

total 1

-rwxrwxrwx 1 rootroot 544 Aug 20 18:55 boot

-rwxrwxrwx 1 rootroot 232 Aug 20 18:41 boot.o

-rwxrwxrwx 1 rootroot 554 Aug 20 16:05 boot.s

       这基本上就已经结束了,但是文件其实并不是给Linux编译的,带着一个MINIX的接口,因此也就会稍微大一些。如果进行相应的修改后,写入软盘应该就可以直接运行看到启动效果了。