flat assembler
Message board for the users of flat assembler.

Index > OS Construction > Problem to use generated iso

Goto page 1, 2  Next
Author
Thread Post new topic Reply to topic
Fulgurance



Joined: 27 Nov 2017
Posts: 276
Fulgurance 26 Apr 2022, 16:17
Hello, from a long time, I use a bash script to generate an iso to boot my custom OS with the generated EFI file by fasmg. Normally it was working at the moment I programmed that. But today when I try it with virtualbox, the virtual machine don't boot the iso image.

It's my small OS repository: https://github.com/Fulgurance/OS
My make_prokect file is like this:

Code:
#!/bin/bash

fasmg BOOTX64.fasm && mv BOOTX64.exe BOOTX64.efi && cp BOOTX64.efi ISO/EFI/BOOT/ && mkisofs -o Test.iso ISO    


It generate normally my iso.
To be honest I'm not really good to generate an ISO file.[/code]

(don't pay attention about the missing ISO directory in my repository, it's not like that locally on my laptop)
Post 26 Apr 2022, 16:17
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20363
Location: In your JS exploiting you and your system
revolution 27 Apr 2022, 05:13
I'm not sure if you are asking a question.

Are you reporting a problem with fasmg? Or mkisofs? Or the BOOTX64.fasm source? Or VirtualBox?

When you say "don't boot" does it crash, or give an error message, or something else?


Last edited by revolution on 27 Apr 2022, 08:18; edited 1 time in total
Post 27 Apr 2022, 05:13
View user's profile Send private message Visit poster's website Reply with quote
Fulgurance



Joined: 27 Nov 2017
Posts: 276
Fulgurance 27 Apr 2022, 08:11
Oh yes sorry I wasn’t clear .

No it’s just my ISO don’t boot.

I just go to the UEFI shell when my virtual machine start

Nothing
Post 27 Apr 2022, 08:11
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20363
Location: In your JS exploiting you and your system
revolution 27 Apr 2022, 08:17
Erm, I'm still not sure ...

Are you reporting a problem with fasmg? Or mkisofs? Or the BOOTX64.fasm source? Or VirtualBox?

When you say "don't boot" does it crash, or give an error message, or something else?
Post 27 Apr 2022, 08:17
View user's profile Send private message Visit poster's website Reply with quote
Fulgurance



Joined: 27 Nov 2017
Posts: 276
Fulgurance 27 Apr 2022, 08:51
I use fasmg. But the code run normally (it’s a save I made before )

You think the problem come from mkisofs?

Do you need a screenshot ?
Post 27 Apr 2022, 08:51
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20363
Location: In your JS exploiting you and your system
revolution 27 Apr 2022, 09:10
Fulgurance wrote:
You think the problem come from mkisofs?
I'm still not sure what your problem actually is.

What do you mean by "don't boot"? Please give the specific results that you experience.

BTW: You don't need to use mv.
Code:
fasmg BOOTX64.fasm BOOTX64.efi && ...    
Or use the format:
Code:
format ... as 'efi'    
Post 27 Apr 2022, 09:10
View user's profile Send private message Visit poster's website Reply with quote
Fulgurance



Joined: 27 Nov 2017
Posts: 276
Fulgurance 27 Apr 2022, 09:31
I think something is wrong with the ISO format, because the ISO isn't detected at all. If I start with the ISO or without the ISO, the result is the same, the UEFI shell don't detect any ISO

This is the result of my generator:

Code:
 zohran   master  ~  Documents  Programmation  OS  2  ./make_project
flat assembler  version g.jmhx
2 passes, 0.1 seconds, 10240 bytes.
Setting input-charset to 'UTF-8' from locale.
Total translation table size: 0
Total rockridge attributes bytes: 0
Total directory bytes: 4096
Path table size(bytes): 34
Max brk space used 0
181 extents written (0 MB)    


You mean like this ?

Code:
format pe64 as 'efi'    


I have an error

Code:
 zohran   master  ~  Documents  Programmation  OS  ./make_project
flat assembler  version g.jmhx
BOOTX64.fasm [5]:
        format pe64 as 'efi'
macro format?.PE64? [53]
Custom error: invalid argument.
[ble: exit 2]    


Description:
Filesize: 6.31 KB
Viewed: 11489 Time(s)

Test.png


Post 27 Apr 2022, 09:31
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20363
Location: In your JS exploiting you and your system
revolution 27 Apr 2022, 09:43
Oh, I guess that only fasm supports the "... as 'ext'" syntax.

In that case you can use the second command line argument instead of mv.
Post 27 Apr 2022, 09:43
View user's profile Send private message Visit poster's website Reply with quote
Fulgurance



Joined: 27 Nov 2017
Posts: 276
Fulgurance 27 Apr 2022, 09:57
Okay I changed what you said, but the same result, the ISO file isn't detected at all by VirtualBox, I can add my ISO, but not detected by the UEFI of the virtual machine. Maybe the generated ISO is generated bad.

I made an archive of my save for you, if you want to have a look (joined to my message)


Description:
Download
Filename: OS.tar.gz
Filesize: 678.88 KB
Downloaded: 379 Time(s)

Post 27 Apr 2022, 09:57
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4050
Location: vpcmpistri
bitRAKE 28 Apr 2022, 00:40
Prior to booting, if you push ESC for BIOS config, select "Boot Manager" and you should be able to see the QEMU DVD-ROM item. If you can see it then QEMU has loaded the image but it is not bootable.

That's my best guess as to why there is no error message - because it boots into EFI Shell. Next the EFI Shell can be removed from the boot options, and then you should be able to see an error:
Code:
BdsDxe: failed to load Boot0001 "UEFI QEMU DVD-ROM ...
BdsDxe: No bootable option or device was found.    

_________________
¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup
Post 28 Apr 2022, 00:40
View user's profile Send private message Visit poster's website Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4050
Location: vpcmpistri
bitRAKE 28 Apr 2022, 00:49
Looking at the source code, it looks like UEFI is expecting an El Torito ISO.
Post 28 Apr 2022, 00:49
View user's profile Send private message Visit poster's website Reply with quote
Fulgurance



Joined: 27 Nov 2017
Posts: 276
Fulgurance 28 Apr 2022, 09:50
How do you normally make an iso with your own system/ bootable UEFI application ?
Post 28 Apr 2022, 09:50
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4050
Location: vpcmpistri
bitRAKE 28 Apr 2022, 10:20
I don't create image files or use virtual drive images - the development cycle is too slow. It's faster to use QEMU's virtio to make a folder act as a drive. I compile directly into folder, run QEMU - no image file.

Even testing on real hardware, I have a FAT32 formatted USB stick. Just copy files - no image. When I get further in development, I can compile into network directory and boot other machine off network - no USB stick. Very Happy

_________________
¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup
Post 28 Apr 2022, 10:20
View user's profile Send private message Visit poster's website Reply with quote
Fulgurance



Joined: 27 Nov 2017
Posts: 276
Fulgurance 28 Apr 2022, 11:53
Can you explain me quickly how you do that with qemu please ? I'm not familiar enough with qemu, but I'm interested in ! (one example please)
Post 28 Apr 2022, 11:53
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4050
Location: vpcmpistri
bitRAKE 28 Apr 2022, 12:10
Relevant section of documentation:
https://www.qemu.org/docs/master/system/images.html#virtual-fat-disk-images

This is the command line option in Windows (where %1 is the directory name):
Code:
-drive file=fat:rw:%1,media=disk,if=virtio,format=raw    
It's the basis of this repo (look at the CMD files that execute QEMU):
https://github.com/bitRAKE/UEFI_playground

The source code of the driver is at (epic innovation right here):
https://github.com/qemu/qemu/blob/master/block/vvfat.c

It can seem buggy in Windows because we need to fight the OS that doesn't want to share the files -- often it seems read only, or like it's in snapshot mode.

Don't try FAT32 - it will probably crash QEMU:
Code:
-drive file=fat:32:rw:%1,media=disk,if=virtio,format=raw    


The network configuration is more flexible, but also more configuration. I have done some research, and will provide an example in the future. It is definitely the way forward as QEMU can virtio the network folder as well. Research PXE booting to learn more.

_________________
¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup
Post 28 Apr 2022, 12:10
View user's profile Send private message Visit poster's website Reply with quote
Fulgurance



Joined: 27 Nov 2017
Posts: 276
Fulgurance 28 Apr 2022, 12:59
I will be annoying again Laughing But, when you said the Window command line, is it the same with Linux ? (I use Linux). I will try that after my japanese lesson.
Post 28 Apr 2022, 12:59
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4050
Location: vpcmpistri
bitRAKE 28 Apr 2022, 13:25
Oh, easy mode then - the documentation is all directed at linux implementation.
Code:
-hdb fat:/my_directory    
Post 28 Apr 2022, 13:25
View user's profile Send private message Visit poster's website Reply with quote
Fulgurance



Joined: 27 Nov 2017
Posts: 276
Fulgurance 28 Apr 2022, 14:08
Like this ? I had an error, I think I missed something:

Code:
 zohran   master  ~  Documents  Programmation  OS  1  qemu-system-x86_64 -hdb fat:/home/zohran/Documents/Programmation/OS/ISO/
WARNING: Image format was not specified for 'json:{"fat-type": 0, "dir": "/home/zohran/Documents/Programmation/OS/ISO/", "driver": "vvfat", "floppy": false, "rw": false}' and probing guessed raw.
         Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
         Specify the 'raw' format explicitly to remove the restrictions.
qemu-system-x86_64: Block node is read-only
[ble: exit 1]
 zohran   master  ~  Documents  Programmation  OS  1  ls ISO
EFI
 zohran   master  ~  Documents  Programmation  OS  tree ISO
ISO
└── EFI
    └── BOOT
        └── BOOTX64.efi

2 directories, 1 file    


If I link directly the .efi file, I have "Could not read directory error". Maybe I have to use sudo for that ?
Post 28 Apr 2022, 14:08
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4050
Location: vpcmpistri
bitRAKE 28 Apr 2022, 14:19
The error can be removed by using the more verbose command:
(it is just a warning really)
Code:
-drive file=fat:16:rw:/home/zohran/Documents/Programmation/OS/ISO/,media=disk,if=virtio,format=raw    
... is like a 500mb virtual disk.

_________________
¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup
Post 28 Apr 2022, 14:19
View user's profile Send private message Visit poster's website Reply with quote
Fulgurance



Joined: 27 Nov 2017
Posts: 276
Fulgurance 28 Apr 2022, 14:41
The screen stay with the message: "Booting from hardisk".

I have to link normally just where is my efi file, isn't it ?
Post 28 Apr 2022, 14:41
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page 1, 2  Next

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.