Howto: Dual Boot BeOS [Unfinished]

Write tutorials and howtos in here
There are more tutorials here http://community.linuxmint.com/tutorial/welcome
Forum rules
Do not start a support topic here please. Before you post please read this

Howto: Dual Boot BeOS [Unfinished]

Postby grimdestripador on Sun Feb 08, 2009 6:20 pm

In the new light of a new BeOS GCC4 compiler I wish to doccument my process making my current Quad core Mint Box dual boot with linux and the open sourced BeOS named Haiku-os. http://www.vortexforces.com/doku.php?id=tribute_to_linux_-_quadxdamage Image

Prepare Files
Download the alpha cycle dev release with Gcc4. Select a Raw HDD image. The URL I used was this zip file

DD & Bootloader
These Steps are based on Read makebootable - What and why and how to do it manually from haiku-os.org's website and comments thereafter

The Stage 1 Bootloader
This can be accomplished using the following script.
Code: Select all
/*
 * Tiny version of Haiku's makebootable for Linux
 *
 * Copyright 2008, Stefan Schramm, mail@stefanschramm.net.
 * Distributed under the terms of the MIT license.
 *
 * Changelog:
 * 2008-12-08: replaced example "hda4" with "hdaX" for safety
 *
 * Compiling: gcc makebootabletiny.c -o makebootabletiny
 */

#include <stdio.h>
#include <fcntl.h>
#include <linux/hdreg.h>

static const int partitionOffsetOffset = 506;

int main(int argc, const char *const *argv) {

   // check argument count
   if (argc < 2) {
      printf("Usage: %s <partition>\n", argv[0]);
      printf("Example: %s /dev/hdaX\n", argv[0]);
      return 1;
   }

   // open handle to partition
   int part = open(argv[1], O_RDWR);
   if (part < 0) {
      fprintf(stderr, "Error: Failed to open partition %s\n", argv[1]);
      return 1;
   }

   // get geometry
   struct hd_geometry geom;
   if (ioctl(part, HDIO_GETGEO, &geom) < 0) {
      fprintf(stderr, "Error: Failed to get device geometry\n");
      close(part);
      return 1;
   }

   // display geometry
   printf("determined partition start (sectors): 0x%x\n", geom.start);

   // go to partition offset offset and read current configuration
   lseek(part, partitionOffsetOffset, 0);
   long buf = 0;
   read(part, &buf, 4);
   printf("old bootcode configuration:           0x%x\n", buf);

   if (buf == geom.start) {
      printf("bootcode already configured correctly - exiting.\n");
      close(part);
      return 0;
   }

   // write partition offset
   lseek(part, partitionOffsetOffset, 0);
   write(part, &geom.start, 4);

   printf("bootcode configured - exiting.\n");
   close(part);
   return 0;

}
User avatar
grimdestripador
Level 6
Level 6
 
Posts: 1069
Joined: Fri Feb 16, 2007 2:26 am

Linux Mint is funded by ads and donations.
 

Return to Tutorials / Howtos

Who is online

Users browsing this forum: No registered users and 17 guests