Use custom Limine build
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -8,3 +8,4 @@ mop3dist.tar
|
|||||||
mop3dist.tar.lz4
|
mop3dist.tar.lz4
|
||||||
site/
|
site/
|
||||||
*.img
|
*.img
|
||||||
|
build_limine/
|
||||||
|
|||||||
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
[submodule "Limine"]
|
||||||
|
path = Limine
|
||||||
|
url = https://github.com/Limine-Bootloader/Limine.git
|
||||||
1
Limine
Submodule
1
Limine
Submodule
Submodule Limine added at 1276c44024
1
Makefile
1
Makefile
@@ -1,5 +1,6 @@
|
|||||||
platform ?= amd64
|
platform ?= amd64
|
||||||
|
|
||||||
|
include make/limine.mk
|
||||||
include make/lz4.mk
|
include make/lz4.mk
|
||||||
include make/apps.mk
|
include make/apps.mk
|
||||||
include make/kernel.mk
|
include make/kernel.mk
|
||||||
|
|||||||
Binary file not shown.
@@ -8,6 +8,7 @@ if [ "$1" = "debug" ]; then
|
|||||||
bt="buildtype=debug"
|
bt="buildtype=debug"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
make -B all_limine
|
||||||
make -B all_lz4
|
make -B all_lz4
|
||||||
make -B all_kernel "$bt"
|
make -B all_kernel "$bt"
|
||||||
make -B all_libu "$bt"
|
make -B all_libu "$bt"
|
||||||
|
|||||||
47
aux/drive_check_health.sh
Executable file
47
aux/drive_check_health.sh
Executable file
@@ -0,0 +1,47 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [[ -z "$1" ]]; then
|
||||||
|
echo "Usage: $0 <disk_image.img>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
IMAGE_FILE="$1"
|
||||||
|
|
||||||
|
if [[ ! -f "$IMAGE_FILE" ]]; then
|
||||||
|
echo "Error: File '$IMAGE_FILE' not found."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if fdisk -l "$IMAGE_FILE" > /dev/null 2>&1; then
|
||||||
|
echo "MBR ok"
|
||||||
|
fdisk -l "$IMAGE_FILE"
|
||||||
|
else
|
||||||
|
echo "MBR bad"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
LOOP_DEV=$(sudo losetup --show -fP "$IMAGE_FILE")
|
||||||
|
|
||||||
|
cleanup() {
|
||||||
|
sudo losetup -d "$LOOP_DEV"
|
||||||
|
echo "$LOOP_DEV detached"
|
||||||
|
}
|
||||||
|
trap cleanup EXIT
|
||||||
|
|
||||||
|
PARTITIONS=$(lsblk -lnp -o NAME "$LOOP_DEV" | grep -v "^$LOOP_DEV$")
|
||||||
|
|
||||||
|
if [[ -z "$PARTITIONS" ]]; then
|
||||||
|
echo "no partitions found"
|
||||||
|
else
|
||||||
|
for PART in $PARTITIONS; do
|
||||||
|
echo "Checking partition: $PART"
|
||||||
|
sudo fsck.fat -nv "$PART"
|
||||||
|
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
echo "$PART ok"
|
||||||
|
else
|
||||||
|
echo "$PART bad"
|
||||||
|
fi
|
||||||
|
echo "------------------------------------------"
|
||||||
|
done
|
||||||
|
fi
|
||||||
@@ -8,7 +8,7 @@ mkdir -p img_root/EFI/BOOT
|
|||||||
cp -v kernel/build/kernel.elf img_root/boot/
|
cp -v kernel/build/kernel.elf img_root/boot/
|
||||||
cp -v boot/limine/limine-bios.sys boot/limine.conf img_root/boot/limine/
|
cp -v boot/limine/limine-bios.sys boot/limine.conf img_root/boot/limine/
|
||||||
cp -v boot/limine/limine-bios-cd.bin boot/limine/limine-uefi-cd.bin img_root/boot/limine/
|
cp -v boot/limine/limine-bios-cd.bin boot/limine/limine-uefi-cd.bin img_root/boot/limine/
|
||||||
cp -v boot/limine/BOOTX64.EFI boot/limine/BOOTIA32.EFI img_root/EFI/BOOT/
|
cp -v boot/limine/BOOTX64.EFI img_root/EFI/BOOT/
|
||||||
cp -v mop3dist.tar.lz4 img_root/boot/
|
cp -v mop3dist.tar.lz4 img_root/boot/
|
||||||
|
|
||||||
dd if=/dev/zero of=mop3.img bs=1M count=64
|
dd if=/dev/zero of=mop3.img bs=1M count=64
|
||||||
|
|||||||
@@ -3,15 +3,20 @@
|
|||||||
make -C boot/limine
|
make -C boot/limine
|
||||||
rm -rf iso_root
|
rm -rf iso_root
|
||||||
mkdir -p iso_root/boot/limine
|
mkdir -p iso_root/boot/limine
|
||||||
|
mkdir -p iso_root/EFI/BOOT
|
||||||
|
|
||||||
cp -v kernel/build/kernel.elf iso_root/boot
|
cp -v kernel/build/kernel.elf iso_root/boot
|
||||||
cp -v boot/limine/limine-bios.sys boot/limine/limine-bios-cd.bin \
|
cp -v boot/limine/limine-bios.sys boot/limine/limine-bios-cd.bin \
|
||||||
boot/limine.conf iso_root/boot/limine
|
boot/limine/limine-uefi-cd.bin boot/limine.conf iso_root/boot/limine
|
||||||
|
|
||||||
|
cp -v boot/limine/BOOTX64.EFI iso_root/EFI/BOOT
|
||||||
|
|
||||||
cp -v mop3dist.tar.lz4 iso_root/boot
|
cp -v mop3dist.tar.lz4 iso_root/boot
|
||||||
|
|
||||||
xorriso -as mkisofs -R -r -b boot/limine/limine-bios-cd.bin \
|
xorriso -as mkisofs -R -r -b boot/limine/limine-bios-cd.bin \
|
||||||
-no-emul-boot -boot-load-size 4 -boot-info-table \
|
-no-emul-boot -boot-load-size 4 -boot-info-table -hfsplus \
|
||||||
|
-apm-block-size 2048 --efi-boot boot/limine/limine-uefi-cd.bin \
|
||||||
|
-efi-boot-part --efi-boot-image --protective-msdos-label \
|
||||||
iso_root -o mop3.iso
|
iso_root -o mop3.iso
|
||||||
|
|
||||||
boot/limine/limine bios-install mop3.iso
|
boot/limine/limine bios-install mop3.iso
|
||||||
|
|||||||
1
boot/.gitignore
vendored
Normal file
1
boot/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
limine/
|
||||||
2
boot/limine/.gitignore
vendored
2
boot/limine/.gitignore
vendored
@@ -1,2 +0,0 @@
|
|||||||
limine
|
|
||||||
limine.exe
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,22 +0,0 @@
|
|||||||
Copyright (C) 2019-2025 Mintsuki and contributors.
|
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
|
||||||
modification, are permitted provided that the following conditions are met:
|
|
||||||
|
|
||||||
1. Redistributions of source code must retain the above copyright notice, this
|
|
||||||
list of conditions and the following disclaimer.
|
|
||||||
|
|
||||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
this list of conditions and the following disclaimer in the documentation
|
|
||||||
and/or other materials provided with the distribution.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
||||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
||||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
.POSIX:
|
|
||||||
|
|
||||||
SHELL=/bin/sh
|
|
||||||
|
|
||||||
CC=cc
|
|
||||||
CFLAGS=-g -O2 -pipe
|
|
||||||
CPPFLAGS=
|
|
||||||
LDFLAGS=
|
|
||||||
LIBS=
|
|
||||||
|
|
||||||
.PHONY: all
|
|
||||||
all: limine
|
|
||||||
|
|
||||||
.PHONY: clean
|
|
||||||
clean:
|
|
||||||
rm -f limine limine.exe
|
|
||||||
|
|
||||||
limine: limine.c
|
|
||||||
$(CC) $(CFLAGS) -std=c99 $(CPPFLAGS) $(LDFLAGS) $< $(LIBS) -o $@
|
|
||||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
1354
boot/limine/limine.c
1354
boot/limine/limine.c
File diff suppressed because it is too large
Load Diff
@@ -23,13 +23,18 @@ mkvol bootpart $3 $1p0
|
|||||||
# Prepare directories
|
# Prepare directories
|
||||||
mkdir bootpart:/boot
|
mkdir bootpart:/boot
|
||||||
mkdir bootpart:/boot/limine
|
mkdir bootpart:/boot/limine
|
||||||
|
mkdir bootpart:/EFI
|
||||||
|
mkdir bootpart:/EFI/BOOT
|
||||||
|
|
||||||
# Copy files
|
# Copy files
|
||||||
copy bootmedia:/boot/kernel.elf bootpart:/boot/kernel.elf
|
copy bootmedia:/boot/kernel.elf bootpart:/boot/kernel.elf
|
||||||
copy bootmedia:/boot/limine/limine-bios.sys bootpart:/boot/limine/limine-bios.sys
|
copy bootmedia:/boot/limine/limine-bios.sys bootpart:/boot/limine/limine-bios.sys
|
||||||
copy bootmedia:/boot/limine/limine-bios-cd.bin bootpart:/boot/limine/limine-bios-cd.bin
|
copy bootmedia:/boot/limine/limine-bios-cd.bin bootpart:/boot/limine/limine-bios-cd.bin
|
||||||
copy bootmedia:/boot/limine/limine.conf bootpart:/boot/limine/limine.conf
|
copy bootmedia:/boot/limine/limine.conf bootpart:/boot/limine/limine.conf
|
||||||
|
copy bootmedia:/boot/limine/limine-uefi-cd.bin bootpart:/boot/limine/limine-uefi-cd.bin
|
||||||
copy bootmedia:/boot/mop3dist.tar.lz4 bootpart:/boot/mop3dist.tar.lz4
|
copy bootmedia:/boot/mop3dist.tar.lz4 bootpart:/boot/mop3dist.tar.lz4
|
||||||
|
copy bootmedia:/EFI/BOOT/BOOTIA32.EFI bootpart:/EFI/BOOT/BOOTIA32.EFI
|
||||||
|
copy bootmedia:/EFI/BOOT/BOOTX64.EFI bootpart:/EFI/BOOT/BOOTX64.EFI
|
||||||
|
|
||||||
# List
|
# List
|
||||||
ls bootpart:/boot
|
ls bootpart:/boot
|
||||||
|
|||||||
@@ -27,5 +27,6 @@
|
|||||||
#define ST_XDRV_WRITE_ERROR 23
|
#define ST_XDRV_WRITE_ERROR 23
|
||||||
#define ST_NOT_PARTIAL 24
|
#define ST_NOT_PARTIAL 24
|
||||||
#define ST_USB_CTRL_ERROR 25
|
#define ST_USB_CTRL_ERROR 25
|
||||||
|
#define ST_IO_ERROR 26
|
||||||
|
|
||||||
#endif // _M_STATUS_H
|
#endif // _M_STATUS_H
|
||||||
|
|||||||
@@ -112,3 +112,19 @@ void* memmove (void* dest, const void* src, unsigned int n) {
|
|||||||
}
|
}
|
||||||
return dest;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char* strchr (register const char* s, int c) {
|
||||||
|
do {
|
||||||
|
if (*s == c) {
|
||||||
|
return (char*)s;
|
||||||
|
}
|
||||||
|
} while (*s++);
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
char* strcpy (char* strDest, const char* strSrc) {
|
||||||
|
char* temp = strDest;
|
||||||
|
while ((*strDest++ = *strSrc++))
|
||||||
|
;
|
||||||
|
return temp;
|
||||||
|
}
|
||||||
|
|||||||
@@ -23,4 +23,10 @@ void* memmove (void* dest, const void* src, unsigned int n);
|
|||||||
|
|
||||||
#define strlen_null(x) (strlen ((x)) + 1)
|
#define strlen_null(x) (strlen ((x)) + 1)
|
||||||
|
|
||||||
|
char* strchr (register const char* s, int c);
|
||||||
|
|
||||||
|
char* strcpy (char* strDest, const char* strSrc);
|
||||||
|
|
||||||
|
char* strcat (char* dest, const char* src);
|
||||||
|
|
||||||
#endif // _KERNEL_LIBK_STRING_H
|
#endif // _KERNEL_LIBK_STRING_H
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ static const char* str_status[] = {
|
|||||||
[ST_XDRV_WRITE_ERROR] = "drive write error",
|
[ST_XDRV_WRITE_ERROR] = "drive write error",
|
||||||
[ST_NOT_PARTIAL] = "not a partially created process",
|
[ST_NOT_PARTIAL] = "not a partially created process",
|
||||||
[ST_USB_CTRL_ERROR] = "USB controller error",
|
[ST_USB_CTRL_ERROR] = "USB controller error",
|
||||||
|
[ST_IO_ERROR] = "I/O Error",
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _LIBSYSTEM_STR_STATUS_H
|
#endif // _LIBSYSTEM_STR_STATUS_H
|
||||||
|
|||||||
16
make/limine.mk
Normal file
16
make/limine.mk
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
LIMINE_OPTS=--enable-bios-cd \
|
||||||
|
--enable-bios \
|
||||||
|
--enable-uefi-x86-64 \
|
||||||
|
--enable-uefi-cd
|
||||||
|
|
||||||
|
all_limine:
|
||||||
|
mkdir -p build_limine && \
|
||||||
|
cd build_limine && \
|
||||||
|
../Limine/bootstrap && \
|
||||||
|
../Limine/configure $(LIMINE_OPTS) && \
|
||||||
|
make -j $(nproc) && \
|
||||||
|
rm -rf ../boot/limine && \
|
||||||
|
cp -r ./bin ../boot/limine
|
||||||
|
|
||||||
|
|
||||||
|
.PHONY: all_limine
|
||||||
@@ -1208,3 +1208,4 @@ const char binary_limine_hdd_bin_data[] = {
|
|||||||
0x8d, 0x50, 0xf9, 0x6c, 0xb0, 0x7c, 0x56, 0x01, 0xfa, 0xb9, 0x4e, 0xf9, 0x7d, 0x83, 0x61, 0xfe,
|
0x8d, 0x50, 0xf9, 0x6c, 0xb0, 0x7c, 0x56, 0x01, 0xfa, 0xb9, 0x4e, 0xf9, 0x7d, 0x83, 0x61, 0xfe,
|
||||||
0x3f, 0x19, 0xa8, 0x86, 0x93, 0x70, 0x5e, 0x00, 0x00,
|
0x3f, 0x19, 0xa8, 0x86, 0x93, 0x70, 0x5e, 0x00, 0x00,
|
||||||
};
|
};
|
||||||
|
/* clang-format on */
|
||||||
|
|||||||
@@ -66,6 +66,9 @@ static void ask_and_setup_dos_partition (struct dos_pte* pte, int part_num) {
|
|||||||
part_sector_count = str_to_uint32 (part_sector_count_str);
|
part_sector_count = str_to_uint32 (part_sector_count_str);
|
||||||
part_isboot = (strcmp (part_isboot_str, "yes") == 0);
|
part_isboot = (strcmp (part_isboot_str, "yes") == 0);
|
||||||
|
|
||||||
|
if (part_sector_count == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
pte->start_lba = part_start_lba;
|
pte->start_lba = part_start_lba;
|
||||||
|
|
||||||
pte->sector_count = part_sector_count;
|
pte->sector_count = part_sector_count;
|
||||||
|
|||||||
Reference in New Issue
Block a user