Go Back   DaemonForums > OpenBSD > OpenBSD Installation and Upgrading

OpenBSD Installation and Upgrading Installing and upgrading OpenBSD.

Thread Tools Display Modes
  #1   (View Single Post)  
Old 3rd July 2017
jbgg jbgg is offline
New User
Join Date: Jun 2017
Posts: 2
Default installboot program as script


I will brief the reason why I have written a minimal script that does the same work as the program installboot(8) (at least what I needed).

I had compiled the boot(8) for i386, and I was wondering how to test it, but I did not brave enough for testing in the hard disk of my computer (though I used before installboot because I erased /boot once, but this was another story).
So I decided to create a new partition and new file system at a flash memory, after that /boot (new program compiled) was copied at new flash memory file system. I thought that the next step will be easy, just use installboot program, but I did not manage to modify the values that installboot changes to biosboot, because the file system is not the same as the installed system.

After that, I created an script to do it "manually". Of course, I have get the offset of the variables from my biosboot, and maybe in other computer could be different. Anyway, I think sharing the script is profitable.

The script can be found at https://github.com/jbgg/installboot2.

I think this is useful for the community.

Thank you for reading.

All suggestion are welcome.
Reply With Quote
  #2   (View Single Post)  
Old 3rd July 2017
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
Join Date: May 2008
Location: USA
Posts: 6,711

Hello and welcome.

The installboot(8) program will write boot blocks to any drive - a separate script is not necessary, though it may have been helpful to you. The -r option of installboot is used to direct installboot to the root directory of the drive, while the biosboot(8) and boot(8) programs stored in /usr/mdec are explicitly defined as the stage1 and stage2 bootloaders to be installed.

For this example, the drive selected is sd7, and a temporary mount point /mnt is used.
  1. Mount the drive's root directory.

    # mount /dev/sd7a /mnt
  2. Change the working directory to /usr/mdec for ease of access to the pathnames for /usr/mdec/biosboot and /usr/mdec/boot.

    # cd /usr/mdec
  3. Issue the installboot(8) command. The -v option may be used to obtain a list of actions taken by installboot().

    # installboot -v -r /mnt sd7 biosboot boot
Reply With Quote
  #3   (View Single Post)  
Old 3rd July 2017
jbgg jbgg is offline
New User
Join Date: Jun 2017
Posts: 2

Thank you for your answer. I forget "-r /mnt" because the disk only had one partition.
I have tested and it works fine.
Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
First program in C Daffy Programming 11 24th November 2011 03:29 PM
How to learn to program under BSD? Sunnz Programming 5 24th December 2008 11:45 PM
Learning how to program Solaris_Delta Programming 9 24th December 2008 07:58 PM
run linux's program johnzlly OpenBSD General 38 8th November 2008 12:10 PM
Executing a c program Libran Programming 13 12th August 2008 11:42 PM

All times are GMT. The time now is 06:37 AM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick