Grub configuration successfully ended. Yeah.

This commit is contained in:
Adrien Bourmault 2019-02-12 12:03:25 +01:00
parent 8114333370
commit 38ccc4216a
6 changed files with 174 additions and 0 deletions

50
boot/grub/create_disk.sh Executable file
View File

@ -0,0 +1,50 @@
#=----------------------------------------------------------------------------=#
# GNU GPL OS/K #
# #
# Desc: OS/K image maker script #
# #
# #
# Copyright © 2018-2019 The OS/K Team #
# #
# This file is part of OS/K. #
# #
# OS/K is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation, either version 3 of the License, or #
# any later version. #
# #
# OS/K is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY# without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with OS/K. If not, see <https://www.gnu.org/licenses/>. #
#=----------------------------------------------------------------------------=#
## Create the image
dd if=/dev/zero of=disk.img bs=512 count=131072
## Partition the image
# WARNING, DO NOT DELETE SPACES !
fdisk disk.img <<EEOF
n
p
1
a
w
EEOF
# WARNING, YOU CAN NOW DELETE SPACES
## Map
sudo losetup -D
sudo losetup /dev/loop0 disk.img -o 1048576 #mounting the logical partition
## Format
sudo mkdosfs -F32 -f 2 /dev/loop0
sync
sudo losetup -D

39
boot/grub/grub-install.sh Executable file
View File

@ -0,0 +1,39 @@
#=----------------------------------------------------------------------------=#
# GNU GPL OS/K #
# #
# Desc: Grub installation script for the OS/K image #
# #
# #
# Copyright © 2018-2019 The OS/K Team #
# #
# This file is part of OS/K. #
# #
# OS/K is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation, either version 3 of the License, or #
# any later version. #
# #
# OS/K is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY# without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with OS/K. If not, see <https://www.gnu.org/licenses/>. #
#=----------------------------------------------------------------------------=#
## Prepare Mount
sudo losetup -D
sudo losetup /dev/loop0 disk.img # mounting the device block
sudo losetup /dev/loop1 disk.img -o 1048576 #mounting the logical partition
## Mount
sudo mount /dev/loop1 ./disk
## Install grub
sudo grub-install --target=i386-pc --debug --root-directory=./disk --boot-directory=./disk/boot --no-floppy --modules="part_msdos biosdisk fat multiboot configfile" /dev/loop0
sudo cp ./grub.cfg ./disk/boot/grub/grub.cfg
sync
sudo umount /dev/loop1
sudo losetup -D

32
boot/grub/grub.cfg Executable file
View File

@ -0,0 +1,32 @@
#=----------------------------------------------------------------------------=#
# GNU GPL OS/K #
# #
# Desc: Grub 2 configuration file for OS/K boot #
# #
# #
# Copyright © 2018-2019 The OS/K Team #
# #
# This file is part of OS/K. #
# #
# OS/K is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation, either version 3 of the License, or #
# any later version. #
# #
# OS/K is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY# without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with OS/K. If not, see <https://www.gnu.org/licenses/>. #
#=----------------------------------------------------------------------------=#
set timeout=5
set default=0 #Set the default menu entry
menuentry "OS/K (pre-pre-alpha 0.0.1)" {
multiboot /boot/loader.bin # The multiboot command replaces the kernel command
boot
}

27
boot/grub/mount.sh Executable file
View File

@ -0,0 +1,27 @@
#=----------------------------------------------------------------------------=#
# GNU GPL OS/K #
# #
# Desc: Simple OS/K image mount script #
# #
# #
# Copyright © 2018-2019 The OS/K Team #
# #
# This file is part of OS/K. #
# #
# OS/K is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation, either version 3 of the License, or #
# any later version. #
# #
# OS/K is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY# without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with OS/K. If not, see <https://www.gnu.org/licenses/>. #
#=----------------------------------------------------------------------------=#
sudo losetup -D
sudo losetup /dev/loop0 disk.img -o 1048576 #mounting the logical partition
sudo mount -t vfat /dev/loop0 ./disk -o rw,uid=$(id -u),gid=$(id -g)

BIN
boot/grub/multiboot.pdf Normal file

Binary file not shown.

26
boot/grub/umount.sh Executable file
View File

@ -0,0 +1,26 @@
#=----------------------------------------------------------------------------=#
# GNU GPL OS/K #
# #
# Desc: Simple unmount script #
# #
# #
# Copyright © 2018-2019 The OS/K Team #
# #
# This file is part of OS/K. #
# #
# OS/K is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation, either version 3 of the License, or #
# any later version. #
# #
# OS/K is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY# without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with OS/K. If not, see <https://www.gnu.org/licenses/>. #
#=----------------------------------------------------------------------------=#
sudo umount ./disk
sudo losetup -D