visopsys.org

Visopsys Forums
It is currently Fri Jan 19, 2018 6:49 am

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: About copy-boot and bootable images
PostPosted: Tue Sep 30, 2014 11:53 am 
Offline

Joined: Sun Sep 01, 2013 7:58 pm
Posts: 29
About copy-boot and bootable images

It is unfortunately not normally possible to build bootable Visopsys images
on non-Linux platforms. The problem lies in the following piece of code in the
setOsLoaderParams() function in src/programs/copy-boot.c (the source code for the copy-boot program, which copies the boot sector on a device or image):

Code:
#ifdef VISOPSYS
      // For some reason the Linux driver gives us the second unused cluster
      firstUnusedCluster += 1;
#endif


While this piece of code seems to be needed due to a quirk of Linux's FAT filesystem driver, this makes loading vloader (the second-stage bootloader) fail when the FAT filesystem is written using other filesystem drivers (such as NetBSD's).

A provisional solution when building 0.74 is simply to comment the piece of code out. The definitive solution is obviously changing the #ifdef to something like #ifdef linux (check this, I don't remember exactly what is set by the Linux system headers)

Also, the shipped scripts to build floppy and CD images only work for Linux systems, as they use Linux specific utilities and features and they require
being run as root.

It is however possible to make a working floppy image in the following way:
- make a 1440K blank image, and format it using your platform's own tool
Let's call this image testflp.img
- run copy-boot on the image ( ./copy-boot ../build/system/boot/bootsect.fat testflp.img)
- use the tools provided by the MTools suite in order to copy the files on the floppy
image, remembering to first copy vloader (the second-stage bootloader), then visopsys (the kernel) and then everything else

This results is a working floppy image, and it does not even require root priviliges to make.

A CD image is made likewise, just remember to make a root cd filesystem, copy the files for the live CD environment on it, copy the bootable floppy image in it,
and run a tool like mkisofs specifying that you want to make ISO image bootable using floppy emulation.

Notice, also, that GCC versions <= 4.5 miscompile the Visopsys kernel, and you'll run in all kinds of problems. Use a GCC version >= 4.6 and they will go away. Old Visopsys kernel versions compiled fine with GCC <= 4.5, and maybe this has something to do with how fpu registers are backed-up and restored? I don't exactly know, just a guess.

_________________
Visopsys@Unhaut - http://unhaut.fav.cc/visopsys


Top
 Profile  
 
 Post subject: Re: About copy-boot and bootable images
PostPosted: Wed Oct 01, 2014 11:14 am 
Offline
User avatar

Joined: Tue Nov 16, 2010 7:20 pm
Posts: 460
nextvolume wrote:
A provisional solution when building 0.74 is simply to comment the piece of code out. The definitive solution is obviously changing the #ifdef to something like #ifdef linux (check this, I don't remember exactly what is set by the Linux system headers)

Also, the shipped scripts to build floppy and CD images only work for Linux systems, as they use Linux specific utilities and features

This is true, yes. I've not tried to develop Visopsys on other systems, nor do I have any BSDs or similar to try it with. I guess I could install one in a VM, but even better if one of our contributors can help out with this! :shifty:

nextvolume wrote:
This results is a working floppy image, and it does not even require root priviliges to make.

Good stuff, thanks mate!

nextvolume wrote:
Notice, also, that GCC versions <= 4.5 miscompile the Visopsys kernel, and you'll run in all kinds of problems. Use a GCC version >= 4.6 and they will go away. Old Visopsys kernel versions compiled fine with GCC <= 4.5, and maybe this has something to do with how fpu registers are backed-up and restored? I don't exactly know, just a guess.

Grr, yeah, the GCC guys are always messing about and breaking things between versions. Usually I have to keep up with the more recent versions, because if those are broken I'm more likely to get bug reports from people trying to build it. The FPU stuff uses inline assembler macros.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


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 post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group