Merge bootloader

This commit is contained in:
K. Lange 2018-03-15 10:19:18 +09:00 committed by Kevin Lange
parent 155f467118
commit a75a714653
7 changed files with 23 additions and 395 deletions

3
.gitignore vendored
View File

@ -5,4 +5,5 @@
base/bin/*
cdrom/kernel
cdrom/mod/*
cdrom/ramdisk.img.gz
cdrom/ramdisk.img
cdrom/boot/boot.sys

View File

@ -1,5 +1,10 @@
APPS=init hello sh ls terminal uname compositor drawlines background session kdebug cat yutani-test sysinfo hostname yutani-query env mount date echo nyancat kill ps pstree bim terminal-vga cursor-off font-server
KERNEL_TARGET=i686-elf
KCC = $(KERNEL_TARGET)-gcc
KAS = $(KERNEL_TARGET)-as
KLD = $(KERNEL_TARGET)-ld
CC=i686-pc-toaru-gcc
AR=i686-pc-toaru-ar
CFLAGS=-nodefaultlibs -O3 -m32 -Wa,--32 -g -std=c99 -I. -Iapps -isystem include -Lbase/lib
@ -21,7 +26,9 @@ base/bin:
mkdir -p base/bin
base/lib:
mkdir -p base/lib
dirs: base/dev base/tmp base/proc base/bin base/lib
cdrom/boot:
mkdir -p cdrom/boot
dirs: base/dev base/tmp base/proc base/bin base/lib cdrom/boot
libc/%.o: libc/%.c
$(CC) -fPIC -c -m32 -Wa,--32 -O3 -isystem include -o $@ $<
@ -122,13 +129,20 @@ base/bin/pstree: apps/pstree.c base/lib/libnihc.so base/lib/libtoaru_tree.so bas
base/bin/%: apps/%.c base/lib/libnihc.so | dirs
$(CC) $(CFLAGS) -o $@ $< $(LIBS)
cdrom/ramdisk.img.gz: ${APPS_X} base/lib/ld.so base/lib/libtoaru-decor-fancy.so | dirs
genext2fs -B 4096 -d base -U -b 16384 -N 2048 cdrom/ramdisk.img
rm -f cdrom/ramdisk.img.gz
gzip cdrom/ramdisk.img
cdrom/ramdisk.img: ${APPS_X} base/lib/ld.so base/lib/libtoaru-decor-fancy.so Makefile | dirs
genext2fs -B 4096 -d base -U -b 4096 -N 2048 cdrom/ramdisk.img
image.iso: cdrom/ramdisk.img.gz
grub-mkrescue -d /usr/lib/grub/i386-pc --compress=xz -o $@ cdrom
image.iso: cdrom/ramdisk.img cdrom/boot/boot.sys cdrom/kernel
xorriso -as mkisofs -R -J -c boot/bootcat -b boot/boot.sys -no-emul-boot -boot-load-size 20 -o image.iso cdrom
cdrom/boot/boot.sys: boot/boot.o boot/cstuff.o boot/link.ld | cdrom/boot
${KLD} -T boot/link.ld -o $@ boot/boot.o boot/cstuff.o
boot/cstuff.o: boot/cstuff.c boot/ata.h boot/atapi_imp.h boot/elf.h boot/iso9660.h boot/multiboot.h boot/text.h boot/types.h boot/util.h
${KCC} -c -Os -o $@ $<
boot/boot.o: boot/boot.s
yasm -f elf -o $@ $<
.PHONY: clean
clean:

View File

@ -1,107 +0,0 @@
insmod vbe
insmod vga
insmod video_bochs
insmod video_cirrus
insmod iso9660
insmod png
#set root='(cd)'
set gfxmode=1024x768
set t_driver=auto
set t_resolution=1024,768
set g_resolution=1024x768
set t_root="root=/dev/ram0,nocache"
set t_migrate="start=--migrate"
set t_start="_start"
export gfxmode
export t_driver
export t_resolution
export g_resolution
export t_root
export t_migrate
export t_start
set mod_deb_enabled="yes"
set mod_ata_enabled="yes"
set mod_vid_enabled="yes"
set mod_snd_enabled="yes"
set mod_net_enabled="yes"
set mod_ataold_enabled="no"
set mod_vmware_enabled="yes"
set mod_vbox_enabled="yes"
export mod_deb_enabled
export mod_ata_enabled
export mod_vid_enabled
export mod_snd_enabled
export mod_net_enabled
export mod_ataold_enabled
export mod_vmware_enabled
export mod_vbox_enabled
insmod gfxterm
terminal_output gfxterm
loadfont /boot/grub/fonts/unicode.pf2
function set_theme {
set theme=/boot/grub/theme.txt
}
function load_modules {
echo "Loading modules..."
module /mod/zero.ko
module /mod/random.ko
module /mod/serial.ko
if [ "${mod_deb_enabled}" = "yes" ]; then
module /mod/debug_shell.ko
fi
module /mod/procfs.ko
module /mod/tmpfs.ko
if [ "${mod_ata_enabled}" = "yes" ]; then
module /mod/ata.ko
fi
if [ "${mod_ataold_enabled}" = "yes" ]; then
module /mod/ataold.ko
fi
module /mod/ext2.ko
module /mod/iso9660.ko
module /mod/ps2kbd.ko
module /mod/ps2mouse.ko
if [ "${mod_vid_enabled}" = "yes" ]; then
module /mod/lfbvideo.ko
if [ "${mod_vbox_enabled}" = "yes" ]; then
module /mod/vboxguest.ko
fi
if [ "${mod_vmware_enabled}" = "yes" ]; then
module /mod/vmware.ko
fi
if [ "${mod_deb_enabled}" = "yes" ]; then
module /mod/vidset.ko
fi
fi
module /mod/packetfs.ko
if [ "${mod_snd_enabled}" = "yes" ]; then
module /mod/snd.ko
module /mod/ac97.ko
fi
if [ "${mod_net_enabled}" = "yes" ]; then
module /mod/net.ko
module /mod/pcnet.ko
module /mod/rtl.ko
module /mod/e1000.ko
fi
}
function load_ramdisk {
echo "Loading ramdisk..."
module /ramdisk.img.gz
}
function set_vidmode {
echo "Switching to video mode..."
set gfxpayload=${g_resolution}x32
}
configfile /boot/grub/menus.cfg

View File

@ -1,91 +0,0 @@
set_theme
if [ ! "${seen_menu}" = "yes" ]; then
set timeout=5
set seen_menu="yes"
export seen_menu
fi
submenu 'Normal Graphical Boot' {
multiboot /kernel vid=${t_driver},${t_resolution} ${t_root} start=session
load_modules
load_ramdisk
set_vidmode
boot
}
submenu 'VGA Text-Mode Terminal (Debug)' {
multiboot /kernel ${t_root} start=--vga
load_modules
load_ramdisk
set gfxpayload=text
boot
}
submenu '> Advanced graphics configuration options...' {
set_theme
menuentry '800x600' {
set t_resolution=800,600
set g_resolution=800x600
export t_resolution
export g_resolution
configfile /boot/grub/menus.cfg
}
menuentry '1024x768 (default)' {
set t_resolution=1024,768
set g_resolution=1024x768
export t_resolution
export g_resolution
configfile /boot/grub/menus.cfg
}
menuentry '1280x720' {
set t_resolution=1280,720
set g_resolution=1280x720
export t_resolution
export g_resolution
configfile /boot/grub/menus.cfg
}
menuentry '1920x1080' {
set t_resolution=1920,1080
set g_resolution=1920x1080
export t_resolution
export g_resolution
configfile /boot/grub/menus.cfg
}
menuentry 'Custom...' {
echo -n "Width: "
read _w
echo
echo -n "Height: "
read _h
set t_resolution=${_w},${_h}
set g_resolution=${_w}x${_h}
export t_resolution
export g_resolution
configfile /boot/grub/menus.cfg
}
menuentry 'Automatically detect video adapter (Default)' {
set t_driver=auto
export t_driver
configfile /boot/grub/menus.cfg
}
menuentry 'Use QEMU/Bochs/VirtualBox Driver' {
set t_driver=qemu
export t_driver
configfile /boot/grub/menus.cfg
}
menuentry 'Use VMWare driver' {
set t_driver=vmware
export t_driver
configfile /boot/grub/menus.cfg
}
menuentry 'Use Preset LFB Driver' {
set t_driver=preset
export t_driver
configfile /boot/grub/menus.cfg
}
}
submenu '> Configure optional modules...' {
configfile /boot/grub/modules.cfg
}

View File

@ -1,128 +0,0 @@
set_theme
submenu 'Back' {
configfile /boot/grub/menus.cfg
}
if [ "${mod_deb_enabled}" = "yes" ]; then
submenu '[on] Debug modules' {
set mod_deb_enabled="no"
export mod_deb_enabled
configfile /boot/grub/modules.cfg
}
else
submenu '[ ] debug modules' {
set mod_deb_enabled="yes"
export mod_deb_enabled
configfile /boot/grub/modules.cfg
}
fi
if [ "${mod_ata_enabled}" = "yes" ]; then
submenu '[on] ATA/ATAPI DMA module' {
set mod_ata_enabled="no"
export mod_ata_enabled
configfile /boot/grub/modules.cfg
}
else
submenu '[ ] ATA/ATAPI DMA module' {
set mod_ata_enabled="yes"
export mod_ata_enabled
configfile /boot/grub/modules.cfg
}
fi
if [ "${mod_ataold_enabled}" = "yes" ]; then
submenu '[on] Legacy ATA module' {
set mod_ataold_enabled="no"
export mod_ataold_enabled
configfile /boot/grub/modules.cfg
}
else
submenu '[ ] Legacy ATA module' {
set mod_ataold_enabled="yes"
export mod_ataold_enabled
configfile /boot/grub/modules.cfg
}
fi
if [ "${mod_vid_enabled}" = "yes" ]; then
submenu '[on] Video modules' {
set mod_vid_enabled="no"
export mod_vid_enabled
configfile /boot/grub/modules.cfg
}
else
submenu '[ ] Video modules' {
set mod_vid_enabled="yes"
export mod_vid_enabled
configfile /boot/grub/modules.cfg
}
fi
if [ "${mod_snd_enabled}" = "yes" ]; then
submenu '[on] Sound modules (AC97, subsystem)' {
set mod_snd_enabled="no"
export mod_snd_enabled
configfile /boot/grub/modules.cfg
}
else
submenu '[ ] Sound modules (AC97, subsystem)' {
set mod_snd_enabled="yes"
export mod_snd_enabled
configfile /boot/grub/modules.cfg
}
fi
if [ "${mod_net_enabled}" = "yes" ]; then
submenu '[on] Network modules (PCNet, RTL8139, subsystem)' {
set mod_net_enabled="no"
export mod_net_enabled
configfile /boot/grub/modules.cfg
}
else
submenu '[ ] Network modules (PCNet, RTL8139, subsystem)' {
set mod_net_enabled="yes"
export mod_net_enabled
configfile /boot/grub/modules.cfg
}
fi
if [ "${mod_vmware_enabled}" = "yes" ]; then
submenu '[on] VMWare/QEMU absolute mouse' {
set mod_vmware_enabled="no"
export mod_vmware_enabled
configfile /boot/grub/modules.cfg
}
else
submenu '[ ] VMWare/QEMU absolute mouse' {
set mod_vmware_enabled="yes"
export mod_vmware_enabled
configfile /boot/grub/modules.cfg
}
fi
if [ "${mod_vbox_enabled}" = "yes" ]; then
submenu '[on] VirtualBox guest extensions' {
set mod_vbox_enabled="no"
export mod_vbox_enabled
configfile /boot/grub/modules.cfg
}
else
submenu '[ ] VirtualBox guest extensions' {
set mod_vbox_enabled="yes"
export mod_vbox_enabled
configfile /boot/grub/modules.cfg
}
fi
if [ "${t_migrate}" = "start=--migrate" ]; then
submenu '[on] Migrate to in-RAM filesystem on boot' {
set t_migrate=""
set t_start="start"
export t_migrate
export t_start
configfile /boot/grub/modules.cfg
}
else
submenu '[ ] Migrate to in-RAM filesystem on boot' {
set t_migrate="start=--migrate"
set t_start="_start"
export t_migrate
export t_start
configfile /boot/grub/modules.cfg
}
fi

View File

@ -1,61 +0,0 @@
title-text: "ToaruOS Bootable CD"
title-color: "white"
message-color: "white"
message-bg-color: "black"
desktop-image: "/wallpaper.png"
desktop-color: "#000000"
+ label {
text="Select a boot option or wait for the timeout."
width = 100%
top = 10%
align = center
color = #fff
}
+ label {
top = 66%
width = 100%
align = center
color = #fff
text = "The default user is 'local' with password 'local'."
}
+ label {
top = 77%
width = 100%
align = center
color = #fff
text = "ToaruOS is free software, released under the NCSA/University of Illinois License"
}
+ label {
top = 80%
width = 100%
align = center
color = #fff
text = "http://toaruos.org | https://github.com/klange/toaruos"
}
+ boot_menu {
left = 10%
width = 85%
height = 55%
top = 15%
item_color = "white"
selected_item_color = "#77b7ff"
item_height = 17
item_padding = 10
item_spacing = 6
}
+ progress_bar {
id = "__timeout__"
left = 15%
width = 70%
top = 90%
height = 12
show_text = true
text_color = "255, 255, 255"
text = "@TIMEOUT_NOTIFICATION_LONG@"
fg_color = "119, 183, 255"
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 503 KiB