This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Awe2K's profile picture

BIGLDR - multiboot bootloader for CC

Started by Awe2K, 02 November 2015 - 05:00 PM
Awe2K #1
Posted 02 November 2015 - 06:00 PM
Hi.

Now, I have finished basic functionality of my "BIG LDR" bootloader and now I'm proud to present it.
BIGLDR - bootloader that is capable of loading multiple operating systems, so if you want two or even more of them, you can use this bootloader.
Also, it offers easy script format to make booting easier.

So, my bootloader just scans disks and computer (root directories) for *.mbt files, and lists them in menu.
If no scripts found, console will be opened to enter commands.

Script format (list of commands):
Spoiler
  • chainload <target>: loads operating system that cannot be loaded by executing one file. (for example, CraftOS)
  • multiboot <kernel-file>: loads selected file and passes execution to it.
  • clear: clears screen
  • sleep <sec>: sleeps <sec> seconds
  • print …: prints text to screen (can also print variable contents)
  • ls: lists filesystem root
  • set <variable> <value>: sets global <variable> to <value> (as of 0.04, variable names have to be prefixed with '$'). Used to pass arguments/parameters to OS.
  • # - if line is prefixed by this, it'll become a comment. If there's a comment at first line of a script, it'll be script name.

Example scripts:
SpoilerThat one simply loads CraftOS:

#CraftOS
clear
chainload craftos

That one can boot custom kernel:

#Load some OS
clear
print Loading some very cool OS!
set $variable value123
sleep 1
multiboot kernel.bin

Run installer:
pastebin run JE6EX9db

Bootloader scripts for manual installation:
Spoilerpastebin get vJ4EekJn startup (latest)
If obfuscation/minification is not allowed:
pastebin get NkhEppYJ startup (very outdated)

Latest version: 0.04beta3

Changelog:
Spoiler

0.04beta3:
* Minor compatability fixes.
* Fixed freeze after loading CraftOS.
* Now it supports custom script names.
* Supports comments in scripts.
0.04beta2:
* Minor fixes.
* Added variables. (prefixed by '$')
* Added pre-1.74 computer compatability.
0.04beta1:
* Added random memory size generation (not very useful).
* Reformatted code.
* Minor fixes.
* Added abiltiy to set global variables.
0.03:
* First public release

Hope that bootloader will be useful for someone :rolleyes:/>

Edit: yeah, tried to make it look like GNU GRUB bootloader.
[attachment=2438:2015-11-14 (3).png][attachment=2439:2015-11-14 (4).png]
Edited on 14 November 2015 - 05:01 PM
Creator #2
Posted 02 November 2015 - 06:20 PM
Could you write an example script? For example load CraftOS or any other OS of your choice.
Awe2K #3
Posted 02 November 2015 - 06:23 PM
Okay:

load_craftos.mbt:

clear
chainload craftos

load_some_kernel.mbt:

clear
print Loading some very cool OS!
set some_parameter value123
sleep 1
multiboot kernel.bin
Lyqyd #4
Posted 02 November 2015 - 08:01 PM
Moved to Programs.
Awe2K #5
Posted 13 November 2015 - 02:19 PM
Updated to 0.04beta1.
Added several features:
  • You can now reference global variables in your script by prefixing it with '$' character.
  • Changed "set" command format a bit, now it uses '$' prefix before variable name (e.g. "set $var_name value")
  • (Added just for fun) Now it generates random memory amount (base-2) every boot.
  • Fixed minor bug with multiboot.
  • New bugs included!
UPD: directories ending with .mbt are not listed now.
Edited on 13 November 2015 - 02:17 PM
Awe2K #6
Posted 14 November 2015 - 03:57 PM
So, I've made BIGLDR installer, to make installation of loader a bit easier.
  • If custom OS is already installed (e.g. has "startup" file), then it will backup it and add config entry for it.
  • Also it can create config entry for craftos
  • Tried to make it compatible with all computers (pocket, pre-1.74, etc) and easy to use.
To get installer, just type:
pastebin get JE6EX9db bigldr_installer
Creator #7
Posted 14 November 2015 - 05:08 PM
You can make: pastebin run <code>
Awe2K #8
Posted 14 November 2015 - 05:17 PM
Thanks, didn't know this. Replaced that :)/>

Edit: updated bigldr again. Now it displays fancy names instead of file names (for example, "CraftOS" instead of "/craft_os.mbt").
Edited on 14 November 2015 - 04:20 PM