如何制作可启动的 iso(不是 cd 或闪存驱动器)来测试您自己的引导加载程序? [英] How to make an bootable iso(not cd or flash drive) for testing your own boot loader?

查看:24
本文介绍了如何制作可启动的 iso(不是 cd 或闪存驱动器)来测试您自己的引导加载程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试编写一个引导加载程序(hello world 排序).我正在使用 Bochs 进行模拟(平台 Linux-Ubuntu).但我无法为我的二进制文件制作可启动的 iso.虽然在教程中使用了 VFD(虚拟软盘),但它适用于 windows 平台.这是我的引导加载程序代码(仅用于测试)

i am trying to write a boot loader(hello world sort). i am using Bochs for simulation (platform Linux-Ubuntu). But i am unable to make an bootable iso for my binary file. Though in tutorial VFD(virtual floppy disk) is used but it is for windows platform. Here is my code for bootloader ( just for testing)

;*********************************************
;    Boot1.asm
;        - A Simple Bootloader for testing if cd is booting or not
;
;    Operating Systems Development Tutorial
;*********************************************

[BITS 16]    ;tell the assembler that its a 16 bit code
[ORG 0x7C00]    ;Origin, tell the assembler that where the code will

Start:

    cli                    ; Clear all Interrupts
    hlt                    ; halt the system

times 510 - ($-$$) db 0                ; We have to be 512 bytes. Clear the rest of the bytes with 0

dw 0xAA55                    ; Boot Signature

我在 Ubuntu 上尝试了主 ISO.它将二进制文件转换为 ISO,但不转换为可引导的 ISO.Bochs 显示错误cd is not eltorito",我在谷歌上搜索并发现它是可启动 ISO 的标准.我必须添加哪些其他内容才能使其可启动.我最后已经添加了引导签名.谁能推荐一个可靠的应用程序来在 Ubuntu 上制作可启动的 ISO?由于这个原因,我的工作被卡住了......或者我很确定很多人必须参与 Linux 平台上的操作系统开发.你们是如何测试的?

i tried master ISO on Ubuntu. It is converting the binary file to ISO but not to bootable ISO. Bochs is showing error "cd is not eltorito" which i googled and found to be standard for bootable ISO.What additional things i have to add to it to make it bootable. i have already added boot signature in the end. Can anyone suggest a reliable application to make a bootable ISO on Ubuntu? My work is stuck due to this.... OR i am pretty sure a lot of people must be involved in OS development on Linux platform. How do you people test?

我用 Unetbootin 和我的引导加载程序的 iso 制作了一个可引导的闪存驱动器.切换到Virtual-box并稍微扭曲以从pendrive启动,但仍然显示它无法启动.我认为有人说得对,你在操作系统开发中需要很大的耐心.

I have made a bootable flash-drive with Unetbootin with the iso of my bootloader program. switched to Virtual-box and twisted a bit to boot from pendrive, but still its showing it to be non-bootable. I think someone said it correctly that u need a lot of patience in OS development.

:呼,我的引导加载程序终于运行了……
我使用虚拟软盘映像在 Virtual box 上启动我的程序.以下是如果有人遇到困难的步骤.
1.创建具有引导加载程序的 boot.asm.
2.用nasm编译.nasm -f bin boot.asm -o boot.bin.
3.sudo mkfs.msdos -C/home/用户名/floppy.img 1440
4.sudo chown 用户名 ./floppy.img.链接文字
5.用dd复制.dd if=./boot.bin of=./floppy.img.
6.运行 VirtualBox 并选择 floppy.img 作为新虚拟机的启动设备.
PS:您也可以将 floppy.img 附加到设备循环"并像真正的软盘一样挂载它.

:phew finally my bootloader program ran...
I used virtual floppy image to boot my program on Virtual box. Here are the steps in case somebody is struggling with it.
1.Create boot.asm which have your bootloader program.
2.Compile with nasm. nasm -f bin boot.asm -o boot.bin.
3.sudo mkfs.msdos -C /home/username/floppy.img 1440
4.sudo chown username ./floppy.img. link text
5.Copy with dd. dd if=./boot.bin of=./floppy.img.
6.Run VirtualBox and select floppy.img as booting device in your new virtual machine.
PS: you can also attach floppy.img to device "loop" and mount it just as a real floppy disk.

推荐答案

一个非常简单的脚本将在 linux 中执行此操作,如下所示:-

a very simple script will do this in linux as below :-

rm -f disk_images/myos.iso
mkisofs -quiet -V 'MYOS' -input-charset iso8859-1 -o disk_images/myos.iso -b myos.flp disk_images/ || exit

软驱制作如下:-

nasm -f bin -o boot.bin boot.asm
dd if=boot.bin of=floppy.img count=1 bs=512 //for the bootloader

dd if=boot.bin of=floppy.img skip seek=1 count=1339 //assuming a 1.44Mb floppy

然后你就有了文件系统

mkdosfs (or whatever system you want ) -C floppy.img 1440

如果您需要有关 windows 的帮助,请告诉我 :)

If you ned help for windows , let me know :)

这篇关于如何制作可启动的 iso(不是 cd 或闪存驱动器)来测试您自己的引导加载程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆