Rebranding

This commit is contained in:
mintsuki 2020-08-29 20:02:16 +02:00
parent 2150daaf9a
commit 866e95b4c3
18 changed files with 62 additions and 106 deletions

3
.gitignore vendored
View File

@ -4,4 +4,5 @@
/bochsout.txt
/bx_enh_dbg.ini
.vscode
!/qloader2.bin
/limine-install
!/limine.bin

View File

@ -1,6 +1,6 @@
# qloader2 configuration file
# Limine configuration file
The qloader2 configuration file is comprised of *assignments* and *entries*.
The Limine configuration file is comprised of *assignments* and *entries*.
*Entries* describe boot *entries* which the user can select in the *boot menu*.

View File

@ -1,14 +1,18 @@
OS := $(shell uname)
CC = cc
.PHONY: all clean echfs-test ext2-test test.img
all:
$(MAKE) -C src all
cp src/qloader2.bin ./
cp src/limine.bin ./
clean:
$(MAKE) -C src clean
limine-install: limine-install.c
$(CC) limine-install.c -o limine-install
test.img:
rm -f test.img
dd if=/dev/zero bs=1M count=0 seek=4096 of=test.img
@ -26,8 +30,8 @@ echfs-test: test.img all
$(MAKE) -C test
echfs-utils -m -p0 test.img quick-format 32768
echfs-utils -m -p0 test.img import test/test.elf boot/test.elf
echfs-utils -m -p0 test.img import test/qloader2.cfg qloader2.cfg
./qloader2-install src/qloader2.bin test.img
echfs-utils -m -p0 test.img import test/limine.cfg limine.cfg
./limine-install src/limine.bin test.img
qemu-system-x86_64 -hda test.img -debugcon stdio
ext2-test: test.img all
@ -40,12 +44,12 @@ ext2-test: test.img all
sudo mount `cat loopback_dev`p1 test_image
sudo mkdir test_image/boot
sudo cp test/test.elf test_image/boot/
sudo cp test/qloader2.cfg test_image/
sudo cp test/limine.cfg test_image/
sync
sudo umount test_image/
sudo losetup -d `cat loopback_dev`
rm -rf test_image loopback_dev
./qloader2-install src/qloader2.bin test.img
./limine-install src/limine.bin test.img
qemu-system-x86_64 -hda test.img -debugcon stdio
fat32-test: test.img all
@ -64,7 +68,7 @@ else ifeq ($(OS), FreeBSD)
endif
sudo mkdir test_image/boot
sudo cp test/test.elf test_image/boot/
sudo cp test/qloader2.cfg test_image/
sudo cp test/limine.cfg test_image/
sync
sudo umount test_image/
ifeq ($(OS), Linux)
@ -73,5 +77,5 @@ else ifeq ($(OS), FreeBSD)
sudo mdconfig -d -u md9
endif
rm -rf test_image loopback_dev
./qloader2-install src/qloader2.bin test.img
./limine-install src/limine.bin test.img
qemu-system-x86_64 -hda test.img -debugcon stdio

View File

@ -1,11 +1,11 @@
# qloader2
# Limine
x86/x86_64 BIOS Bootloader
![Reference screenshot](/screenshot.png?raw=true "Reference screenshot")
### Supported boot protocols
* Linux
* stivale and stivale2 (qloader2's native boot protocols, see STIVALE{,2}.md for details)
* stivale and stivale2 (Limine's native boot protocols, see STIVALE{,2}.md for details)
### Supported filesystems
* ext2
@ -17,14 +17,13 @@ x86/x86_64 BIOS Bootloader
* GPT
## How to use
This repository contains a prebuilt version of qloader2 so building it won't
be necessary.
This repository contains a prebuilt version of Limine so building it won't be necessary.
In order to install qloader2 on a MBR device (which can just be a raw image file),
run the provided `qloader2-install` script as such:
In order to install Limine on a MBR device (which can just be a raw image file), build the
`limine-install` program using `make limine-install`, then run the resulting executable as such:
```bash
./qloader2-install ./qloader2.bin <path to device/image>
./limine-install ./limine.bin <path to device/image>
```
If using a GPT formatted device, it will be necessary to create an extra partition
@ -33,20 +32,20 @@ the install script where this partition is located by specifying the start secto
```bash
fdisk <device> # Create bootloader partition using your favourite method
./qloader2-install ./qloader2.bin <path to device/image> <start sector of boot partition>
./limine-install ./limine.bin <path to device/image> <start sector of boot partition>
```
Then make sure the device/image contains at least 1 partition formatted in
a supported filesystem containing a `/qloader2.cfg` or `/boot/qloader2.cfg` file
a supported filesystem containing a `/limine.cfg` or `/boot/limine.cfg` file
and the kernel/modules one wants to load.
An example `qloader2.cfg` file can be found in `test/qloader2.cfg`.
An example `limine.cfg` file can be found in `test/limine.cfg`.
More info on the format of `qloader2.cfg` can be found in `CONFIG.md`.
More info on the format of `limine.cfg` can be found in `CONFIG.md`.
For example, to create an empty image file of 64MiB in size, 1 echfs partition
on the image spanning the whole device, format it, copy the relevant files over,
and install qloader2, one can do:
and install Limine, one can do:
```bash
dd if=/dev/zero bs=1M count=0 seek=64 of=test.img
@ -55,18 +54,18 @@ parted -s test.img mkpart primary 1 100%
parted -s test.img set 1 boot on # Workaround for buggy BIOSes
echfs-utils -m -p0 test.img quick-format 32768
echfs-utils -m -p0 test.img import path/to/qloader2.cfg qloader2.cfg
echfs-utils -m -p0 test.img import path/to/limine.cfg limine.cfg
echfs-utils -m -p0 test.img import path/to/kernel.elf kernel.elf
echfs-utils -m -p0 test.img import <path to file> <path in image>
...
./qloader2-install $THIS_REPO/qloader2.bin test.img
./limine-install $THIS_REPO/limine.bin test.img
```
One can get `echfs-utils` by installing https://github.com/qword-os/echfs.
## Building from source
In order to hack qloader2, one must build the GCC toolchain from source first.
In order to hack Limine, one must build the GCC toolchain from source first.
To do so, run the `make_toolchain.sh` script from within the `toolchain` directory;
keep in mind that the script takes `MAKEFLAGS` as an argument.
@ -77,7 +76,7 @@ cd toolchain
```
After that is done, simply run `make` in the root of the repo to generate
`src/qloader2.bin`.
`limine.bin`.
## Discord server
We have a Discord server if you need support, info, or you just want to

View File

@ -6,7 +6,7 @@
int main(int argc, char *argv[]) {
if (argc < 3) {
printf("Usage: %s <path to qloader2 binary> <device> [stage2 start sector]\n", argv[0]);
printf("Usage: %s <path to bootloader binary> <device> [stage2 start sector]\n", argv[0]);
return 1;
}

Binary file not shown.

View File

@ -1,33 +0,0 @@
#!/bin/sh
set -e
if [ -z "$2" ]; then
echo "Usage: $0 <path to qloader2 binary> <device> [stage2 start sector]"
exit 1
fi
# Variables.
DEVICE="$2"
MBR="$(mktemp)"
BINARY_SECT_SRC="$(mktemp)"
BINARY_SECT_BIN="$(mktemp)"
QLOADER2="$1"
if [ -z "$3" ]; then
STAGE2_SECT=1
else
STAGE2_SECT="$3"
fi
echo "dd $STAGE2_SECT" > "$BINARY_SECT_SRC"
nasm "$BINARY_SECT_SRC" -f bin -o "$BINARY_SECT_BIN"
# Copy the loader to the device.
dd if="$DEVICE" of="$MBR" bs=1 count=64 skip=446 2>/dev/null
dd if="$QLOADER2" of="$DEVICE" bs=512 count=1 conv=notrunc 2>/dev/null
dd if="$QLOADER2" of="$DEVICE" bs=512 count=63 skip=1 seek=$(( $STAGE2_SECT )) conv=notrunc 2>/dev/null
dd if="$BINARY_SECT_BIN" of="$DEVICE" bs=1 count=4 seek=$(( 0x1b0 )) conv=notrunc 2>/dev/null
dd if="$MBR" of="$DEVICE" bs=1 count=64 seek=446 conv=notrunc 2>/dev/null
rm "$MBR" "$BINARY_SECT_SRC" "$BINARY_SECT_BIN"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 6.6 KiB

View File

@ -29,11 +29,11 @@ INTERNAL_LDFLAGS = \
C_FILES := $(shell find ./ -type f -name '*.c' | sort)
OBJ := $(C_FILES:.c=.o)
all: qloader2.bin
all: limine.bin
qloader2.bin: $(OBJ)
limine.bin: $(OBJ)
$(LD) $(OBJ) $(LDFLAGS) $(INTERNAL_LDFLAGS) -o stage2.bin
cd bootsect && nasm bootsect.asm -fbin -o ../qloader2.bin
cd bootsect && nasm bootsect.asm -fbin -o ../limine.bin
%.o: %.c
$(CC) $(CFLAGS) $(INTERNAL_CFLAGS) -c $< -o $@

View File

@ -21,7 +21,7 @@ start:
; Some BIOSes don't pass the correct boot drive number,
; so we need to do the job
.check_drive:
; Qloader2 isn't made for floppy disks, these are dead anyways.
; Limine isn't made for floppy disks, these are dead anyways.
; So if the value the BIOS passed is <0x80, just assume it has passed
; an incorrect value
test dl, 0x80
@ -72,7 +72,7 @@ halt:
; Data
LoadingMsg db 0x0D, 0x0A, '<ql2>', 0x0D, 0x0A, 0x0A, 0x00
LoadingMsg db 0x0D, 0x0A, 'Limine', 0x0D, 0x0A, 0x0A, 0x00
Stage2Msg db 'Loading stage2...', 0x00
ErrReadDiskMsg db 0x0D, 0x0A, 'Disk read error, system halted', 0x00
ErrEnableA20Msg db 0x0D, 0x0A, 'A20 enable error, system halted', 0x00

View File

@ -11,8 +11,8 @@ static char *config_addr;
int init_config(int drive, int part) {
struct file_handle f;
if (fopen(&f, drive, part, "/qloader2.cfg")) {
if (fopen(&f, drive, part, "/boot/qloader2.cfg")) {
if (fopen(&f, drive, part, "/limine.cfg")) {
if (fopen(&f, drive, part, "/boot/limine.cfg")) {
return -1;
}
}

6
src/limine.h Normal file
View File

@ -0,0 +1,6 @@
#ifndef __LIMINE_H__
#define __LIMINE_H__
#define LIMINE_VERSION "0.4"
#endif

View File

@ -13,7 +13,7 @@ ASM_BASIC(
"jmp main\n\t"
);
#include <qloader2.h>
#include <limine.h>
#include <drivers/vga_textmode.h>
#include <lib/real.h>
#include <lib/blib.h>
@ -35,7 +35,7 @@ void main(int boot_drive) {
// Initial prompt.
init_vga_textmode();
print("qloader2 " QLOADER2_VERSION "\n\n");
print("Limine " LIMINE_VERSION "\n\n");
print("Boot drive: %x\n", boot_drive);

View File

@ -1,7 +1,7 @@
#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>
#include <qloader2.h>
#include <limine.h>
#include <menu.h>
#include <lib/print.h>
#include <lib/blib.h>
@ -32,7 +32,7 @@ char *menu(void) {
refresh:
text_clear();
print("\n\n \e[44m qloader\e[33m2\e[37m " QLOADER2_VERSION " \e[40m\n\n\n");
print("\n\n \e[36m Limine " LIMINE_VERSION " \e[37m\n\n\n");
print("Select an entry:\n\n");

View File

@ -1,7 +1,7 @@
#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>
#include <qloader2.h>
#include <limine.h>
#include <protos/stivale2.h>
#include <lib/elf.h>
#include <lib/blib.h>
@ -247,8 +247,8 @@ void stivale2_load(char *cmdline, int boot_drive) {
print("stivale2: Top used address in ELF: %X\n", top_used_addr);
strcpy(stivale2_struct.bootloader_brand, "qloader2");
strcpy(stivale2_struct.bootloader_version, QLOADER2_VERSION);
strcpy(stivale2_struct.bootloader_brand, "Limine");
strcpy(stivale2_struct.bootloader_version, LIMINE_VERSION);
//////////////////////////////////////////////
// Create firmware struct tag

View File

@ -1,6 +0,0 @@
#ifndef __QLOADER2_H__
#define __QLOADER2_H__
#define QLOADER2_VERSION "0.4"
#endif

9
test/limine.cfg Normal file
View File

@ -0,0 +1,9 @@
TIMEOUT=3
:MyOS
PROTOCOL=stivale2
KERNEL_PARTITION=0
KERNEL_PATH=boot/test.elf
KERNEL_CMDLINE=something

View File

@ -1,24 +0,0 @@
TIMEOUT=3
:Test kernel
PROTOCOL=stivale2
KERNEL_PARTITION=0
KERNEL_PATH=boot/test.elf
KERNEL_CMDLINE=something
MODULE_PARTITION=0
MODULE_PATH=qloader2.cfg
MODULE_STRING=something here
:Test 2
KERNEL_PARTITION=0
KERNEL_PATH=/boot/test.elf
KERNEL_PROTO=stivale
KERNEL_CMDLINE=none
MODULE_PARTITION=0
MODULE_PATH=qloader2.cfg
MODULE_STRING=something here