Skip to content

Commit 72e3d92

Browse files
committedDec 21, 2022
Added tarfs files and makefile flags
1 parent 77572ee commit 72e3d92

File tree

8 files changed

+113
-9
lines changed

8 files changed

+113
-9
lines changed
 

‎Makefile

+12-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ LIBCBINDIR = bin/libc
2222
LIBCOBJDIR = obj/libc
2323
LIBKOBJDIR = obj/libk
2424

25+
MAKEBOOTDIR = makebootdir.sh
26+
MAKEISOLINUX = makeisolinux.sh
27+
2528
OVMF = /usr/share/qemu/OVMF.fd
29+
TARFS = 0
2630

2731
rwildcard=$(foreach d,$(wildcard $(1:=/*)),$(call rwildcard,$d,$2) $(filter $(subst *,%,$2),$d))
2832

@@ -104,6 +108,12 @@ ifeq ($(KASAN), 1)
104108
CFLAGS += -DUSE_KASAN=1
105109
endif
106110

111+
ifeq ($(TARFS), 1)
112+
CFLAGS += -DUSE_TARFS=1
113+
MAKEBOOTDIR = makebootdir_tar.sh
114+
MAKEISOLINUX = makeisolinux_tar.sh
115+
endif
116+
107117
makedirs:
108118
mkdir -p bin
109119
mkdir -p $(LIBCBINDIR)
@@ -194,8 +204,8 @@ libc: makedirs $(LIBCCOBJECTS) $(LIBCASMOBJECTS) $(EXTCOBJECTS)
194204
cp -Rf toolchain/tools/host-gcc/x86_64-toast/lib64/* $(DISTDIR)/usr/lib64/
195205

196206
iso-linux:
197-
sh makebootdir.sh
198-
sh makeisolinux.sh
207+
sh $(MAKEBOOTDIR)
208+
sh $(MAKEISOLINUX)
199209

200210
userland: libc
201211
@for path in $(shell find userland/* -maxdepth 0 -type d); do \

‎limine.cfg

-3
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,5 @@ MODULE_STRING=symbols.map
1818
MODULE_PATH=boot:///boot/font.psf
1919
MODULE_STRING=font.psf
2020

21-
#MODULE_PATH=boot:///boot/initrd
22-
#MODULE_STRING=initrd
23-
2421
# Remove the following line to enable kernel address layout randomisation.
2522
KASLR=no

‎limine_tar.cfg

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Timeout in seconds that Limine will use before automatically booting.
2+
TIMEOUT=5
3+
4+
# The entry name that will be displayed in the boot menu
5+
:Toast OS
6+
7+
# Change the protocol line depending on the used protocol.
8+
PROTOCOL=stivale2
9+
10+
RESOLUTION=1280x720x32
11+
12+
# Path to the kernel to boot. boot:/// represents the partition on which limine.cfg is located.
13+
KERNEL_PATH=boot:///boot/kernel
14+
15+
MODULE_PATH=boot:///boot/symbols.map
16+
MODULE_STRING=symbols.map
17+
18+
MODULE_PATH=boot:///boot/font.psf
19+
MODULE_STRING=font.psf
20+
21+
MODULE_PATH=boot:///boot/initrd
22+
MODULE_STRING=initrd
23+
24+
# Remove the following line to enable kernel address layout randomisation.
25+
KASLR=no

‎makebootdir.sh

-3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,3 @@ cp $BINDIR/$KERNEL_NAME boot/boot/
1111
mv symbols.map boot/boot/
1212
cp font.psf boot/boot/
1313
cp -Rf toolchain/system-root/* ./dist
14-
#cd dist
15-
#tar -cvf ../boot/boot/initrd *
16-
#cd ..

‎makebootdir_tar.sh

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/sh
2+
BINDIR=bin
3+
KERNEL_NAME=kernel
4+
5+
rm -Rf boot/
6+
7+
mkdir -p boot/EFI/BOOT
8+
mkdir -p boot/boot
9+
10+
cp $BINDIR/$KERNEL_NAME boot/boot/
11+
mv symbols.map boot/boot/
12+
cp font.psf boot/boot/
13+
cp -Rf toolchain/system-root/* ./dist
14+
cd dist
15+
tar -cvf ../boot/boot/initrd *
16+
cd ..

‎makeisolinux_tar.sh

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#!/bin/sh
2+
3+
export BINDIR=bin
4+
export OS_NAME=ToastOS
5+
6+
rm -Rf $BINDIR/*.img
7+
8+
dd if=/dev/zero of=$BINDIR/$OS_NAME.img bs=1M count=1024
9+
10+
(echo g
11+
echo n
12+
echo 1
13+
echo 2048
14+
echo +1000M
15+
echo t
16+
echo 1
17+
echo p
18+
echo w) |
19+
fdisk -u -C500 -S63 -H16 $BINDIR/$OS_NAME.img
20+
21+
git clone https://github.com/limine-bootloader/limine.git --branch=v2.0-branch-binary --depth=1
22+
23+
make -C limine
24+
25+
./limine/limine-install $BINDIR/$OS_NAME.img
26+
27+
sudo mkdir -p /mnt/osdev
28+
29+
export LOOP=`sudo losetup -f`
30+
31+
#offset is 2048 * 512 (start of the partition)
32+
sudo losetup -o1048576 $LOOP $BINDIR/$OS_NAME.img
33+
34+
sudo mkfs.vfat -F32 -n "EFI System" $LOOP
35+
36+
sudo mount -tvfat $LOOP /mnt/osdev
37+
38+
sudo cp limine_tar.cfg limine/limine.sys boot/
39+
40+
sudo mv boot/limine_tar.cfg boot/limine.cfg
41+
42+
sudo cp limine/BOOTX64.EFI boot/EFI/BOOT/
43+
44+
sudo cp -R boot/* /mnt/osdev
45+
46+
sync
47+
48+
rm -Rf limine
49+
50+
sudo umount $LOOP
51+
52+
sudo losetup -d $LOOP
53+
54+
echo Done!

‎src/include/kernel.h

+4-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44
#define KPREFIX(n) k_##n
55

66
#define USE_INPUT_SYSTEM 1
7-
#define USE_TARFS 0
7+
8+
#ifndef USE_TARFS
9+
# define USE_TARFS 0
10+
#endif
811

912
#include "defines.h"
1013

‎src/low-level/partitionmanager/PartitionManager.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,12 @@ void PartitionManager::Initialize()
5555

5656
DEBUG_OUT("[PartitionManager] \t%s with size: %s, type: %s)", partition.GetID().ToString(), partition.SizeString(), partition.GetType().ToString());
5757

58+
#if !USE_TARFS
5859
if(Ext2FileSystem::IsValid(&partition))
5960
{
6061
disk.fileSystem = new Ext2FileSystem(&partition);
6162
}
63+
#endif
6264

6365
if(disk.fileSystem != NULL)
6466
{

0 commit comments

Comments
 (0)
Please sign in to comment.