Unroot the makefile, enhancements !
This commit is contained in:
parent
32db8a0a9e
commit
afdd7aa4a0
|
@ -103,4 +103,6 @@ IDT Overhaul
|
||||||
[...] Time Skip
|
[...] Time Skip
|
||||||
|
|
||||||
2019-11-08 @os-k-team <os-k-team@os-k.eu>
|
2019-11-08 @os-k-team <os-k-team@os-k.eu>
|
||||||
* Compilation process : beginning the modernization
|
* Compilation process : beginning the modernization
|
||||||
|
2019-11-11 @os-k-team <os-k-team@os-k.eu>
|
||||||
|
* Compilation process : "unrooting" and enhancing the compilation process scripts
|
40
Makefile
40
Makefile
|
@ -22,7 +22,7 @@
|
||||||
# along with OS/K. If not, see <https://www.gnu.org/licenses/>. #
|
# along with OS/K. If not, see <https://www.gnu.org/licenses/>. #
|
||||||
#=----------------------------------------------------------------------------=#
|
#=----------------------------------------------------------------------------=#
|
||||||
|
|
||||||
.PHONY: all test test32 debug gdb install_mbr dust clean OS/K
|
.PHONY: all test test32 debug gdb install dust clean OS/K
|
||||||
.DELETE_ON_ERROR: $(BINDIR)/kaleid
|
.DELETE_ON_ERROR: $(BINDIR)/kaleid
|
||||||
|
|
||||||
|
|
||||||
|
@ -73,6 +73,9 @@ BINDIR=build/bin
|
||||||
BUILDDIR=build
|
BUILDDIR=build
|
||||||
vpath %.c $(KALEIDDIR)
|
vpath %.c $(KALEIDDIR)
|
||||||
|
|
||||||
|
# Installation parameters
|
||||||
|
installdisk ?= $(BINDIR)/disk.img
|
||||||
|
|
||||||
# Color codes
|
# Color codes
|
||||||
CL='\033[0;32m'
|
CL='\033[0;32m'
|
||||||
CL2='\033[1;36m'
|
CL2='\033[1;36m'
|
||||||
|
@ -242,10 +245,9 @@ $(KOBJDIR)/%.o: %.c | $(KOBJDIR)
|
||||||
$(BINDIR)/kaleid: $(LOBJDIR)/kaleid.x86_64
|
$(BINDIR)/kaleid: $(LOBJDIR)/kaleid.x86_64
|
||||||
@echo ${CL2}[$@] ${NC}Objcopy...${CL3}
|
@echo ${CL2}[$@] ${NC}Objcopy...${CL3}
|
||||||
@$(OBJCOPY) -I elf64-x86-64 -O elf32-i386 $(LOBJDIR)/kaleid.x86_64 $(BINDIR)/kaleid
|
@$(OBJCOPY) -I elf64-x86-64 -O elf32-i386 $(LOBJDIR)/kaleid.x86_64 $(BINDIR)/kaleid
|
||||||
#@make copy_kernel
|
|
||||||
@echo ${CL2}[$@] ${CL}Success.${CL3}
|
@echo ${CL2}[$@] ${CL}Success.${CL3}
|
||||||
|
|
||||||
$(LOBJDIR)/kaleid.x86_64: $(LibCObj) $(KernObj) $(LOBJDIR)/loader.o
|
$(LOBJDIR)/kaleid.x86_64: $(LibCObj) $(KernObj) $(LOBJDIR)/loader.o $(BUILDDIR)/kernel.ld
|
||||||
@echo ${CL2}[$@] ${NC}Linking kernel objects...${CL3}
|
@echo ${CL2}[$@] ${NC}Linking kernel objects...${CL3}
|
||||||
@$(LD) $(LDFLAGS) -T $(BUILDDIR)/kernel.ld \
|
@$(LD) $(LDFLAGS) -T $(BUILDDIR)/kernel.ld \
|
||||||
$(LOBJDIR)/loader.o $(KernObj) $(LibCObj) \
|
$(LOBJDIR)/loader.o $(KernObj) $(LibCObj) \
|
||||||
|
@ -263,16 +265,16 @@ OS/K: $(dep) ./ProjectTree $(BINDIR)/kaleid
|
||||||
|
|
||||||
## QEMU/DEBUG RELATED
|
## QEMU/DEBUG RELATED
|
||||||
|
|
||||||
test: all
|
test: all install
|
||||||
@qemu-system-x86_64 -vga std -cpu core2duo -soundhw pcspk -s \
|
@qemu-system-x86_64 -vga std -cpu core2duo -soundhw pcspk -s \
|
||||||
-rtc base=localtime -m $(ram) -hda $(BUILDDIR)/bin/disk.img \
|
-rtc base=localtime -m $(ram) -hda $(BUILDDIR)/bin/disk.img \
|
||||||
-d cpu_reset,guest_errors,pcall,int 2> $(BUILDDIR)/qemu.log &
|
-d cpu_reset,guest_errors,pcall,int 2> $(BUILDDIR)/qemu.log &
|
||||||
|
|
||||||
test32: all
|
test32: all install
|
||||||
@qemu-system-i386 -m $(ram) -hda $(BUILDDIR)/bin/disk.img -d \
|
@qemu-system-i386 -m $(ram) -hda $(BUILDDIR)/bin/disk.img -d \
|
||||||
cpu_reset,guest_errors,pcall,int 2> $(BUILDDIR)/qemu.log &
|
cpu_reset,guest_errors,pcall,int 2> $(BUILDDIR)/qemu.log &
|
||||||
|
|
||||||
gdb: all
|
gdb: all install
|
||||||
@setsid qemu-system-x86_64 -m $(ram) -soundhw pcspk -rtc base=localtime \
|
@setsid qemu-system-x86_64 -m $(ram) -soundhw pcspk -rtc base=localtime \
|
||||||
-hda $(BUILDDIR)/bin/disk.img -no-reboot -no-shutdown -d \
|
-hda $(BUILDDIR)/bin/disk.img -no-reboot -no-shutdown -d \
|
||||||
cpu_reset,guest_errors,pcall,int -s -S 2> $(BUILDDIR)/qemu.log &
|
cpu_reset,guest_errors,pcall,int -s -S 2> $(BUILDDIR)/qemu.log &
|
||||||
|
@ -282,7 +284,7 @@ gdb: all
|
||||||
-ex "symbol-file $(BINDIR)/kaleid" \
|
-ex "symbol-file $(BINDIR)/kaleid" \
|
||||||
-ex "break BtStartKern" \
|
-ex "break BtStartKern" \
|
||||||
|
|
||||||
ddd: all
|
ddd: all install_os_k
|
||||||
@setsid qemu-system-x86_64 -m $(ram) -hda $(BUILDDIR)/bin/disk.img -no-reboot -soundhw pcspk \
|
@setsid qemu-system-x86_64 -m $(ram) -hda $(BUILDDIR)/bin/disk.img -no-reboot -soundhw pcspk \
|
||||||
-no-shutdown -d cpu_reset,guest_errors,pcall,int -s 2> $(BUILDDIR)/qemu.log &
|
-no-shutdown -d cpu_reset,guest_errors,pcall,int -s 2> $(BUILDDIR)/qemu.log &
|
||||||
@ddd
|
@ddd
|
||||||
|
@ -290,40 +292,24 @@ ddd: all
|
||||||
|
|
||||||
## HD IMAGE RELATED ---------------------------------------------------------- #
|
## HD IMAGE RELATED ---------------------------------------------------------- #
|
||||||
|
|
||||||
install_mbr: $(BINDIR)/disk.img $(MBRDIR)/grub.cfg
|
install: $(installdisk) $(MBRDIR)/grub.cfg $(BINDIR)/kaleid
|
||||||
@mkdir -p $(BINDIR)/disk
|
|
||||||
@echo ${CL2}[$@] ${NC}Installing MBR on image...${CL3}
|
@echo ${CL2}[$@] ${NC}Installing MBR on image...${CL3}
|
||||||
@$(MBRDIR)/grub-install.sh $(BINDIR)/disk.img $(BINDIR)/disk $(MBRDIR)/grub.cfg
|
@$(BUILDDIR)/install-os-k.sh $(installdisk) $(MBRDIR)/grub.cfg $(BINDIR)/kaleid
|
||||||
@rmdir $(BINDIR)/disk
|
|
||||||
@echo ${CL2}[$@] ${CL}Success.${CL3}
|
@echo ${CL2}[$@] ${CL}Success.${CL3}
|
||||||
|
|
||||||
copy_kernel:
|
$(BINDIR)/disk.img: $(BUILDDIR)/create_disk.sh
|
||||||
@mkdir -p $(BINDIR)/disk
|
|
||||||
@echo ${CL2}[$@] ${NC}Integrating kernel${CL3}
|
|
||||||
-@$(MBRDIR)/umount.sh $(BINDIR)/disk || /bin/true
|
|
||||||
@$(MBRDIR)/mount.sh $(BINDIR)/disk.img $(BINDIR)/disk
|
|
||||||
@cp $(BINDIR)/kaleid $(BINDIR)/disk/boot/kaleid
|
|
||||||
@$(MBRDIR)/umount.sh $(BINDIR)/disk
|
|
||||||
@echo ${CL2}[$@] ${CL}Success.${CL3}
|
|
||||||
@rmdir $(BINDIR)/disk
|
|
||||||
|
|
||||||
$(BINDIR)/disk.img: $(MBRDIR)/create_disk.sh
|
|
||||||
@echo ${CL2}[$@]${NC} Constructing disk image...${CL3}
|
@echo ${CL2}[$@]${NC} Constructing disk image...${CL3}
|
||||||
-@$(MBRDIR)/umount.sh $(BINDIR)/disk || /bin/true
|
@$(BUILDDIR)/create_disk.sh $(BINDIR)/disk.img
|
||||||
@$(MBRDIR)/create_disk.sh $(BINDIR)/disk.img
|
|
||||||
@make install_mbr
|
|
||||||
@echo ${CL2}[$@]${NC} Constructing disk image...${CL3}
|
@echo ${CL2}[$@]${NC} Constructing disk image...${CL3}
|
||||||
|
|
||||||
|
|
||||||
## CLEANUP RELATED ----------------------------------------------------------- #
|
## CLEANUP RELATED ----------------------------------------------------------- #
|
||||||
|
|
||||||
dust:
|
dust:
|
||||||
-@$(MBRDIR)/umount.sh $(BINDIR)/disk || /bin/true
|
|
||||||
@rm -Rf $(OBJDIR)/*
|
@rm -Rf $(OBJDIR)/*
|
||||||
@echo ${CL2}[$@] ${CL}Cleaned.${CL3}
|
@echo ${CL2}[$@] ${CL}Cleaned.${CL3}
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
-@$(MBRDIR)/umount.sh $(BINDIR)/disk || /bin/true
|
|
||||||
@rm -Rvf ./ProjectTree $(BUILDDIR)/*.log
|
@rm -Rvf ./ProjectTree $(BUILDDIR)/*.log
|
||||||
@rm -Rvf $(BINDIR)/* $(OBJDIR)/*
|
@rm -Rvf $(BINDIR)/* $(OBJDIR)/*
|
||||||
@echo ${CL2}[$@] ${CL}Cleaned.${CL3}
|
@echo ${CL2}[$@] ${CL}Cleaned.${CL3}
|
||||||
|
|
126
ProjectTree
126
ProjectTree
|
@ -26,12 +26,8 @@
|
||||||
.
|
.
|
||||||
├── boot
|
├── boot
|
||||||
│ ├── grub
|
│ ├── grub
|
||||||
│ │ ├── create_disk.sh
|
|
||||||
│ │ ├── grub.cfg
|
│ │ ├── grub.cfg
|
||||||
│ │ ├── grub-install.sh
|
│ │ └── multiboot.pdf
|
||||||
│ │ ├── mount.sh
|
|
||||||
│ │ ├── multiboot.pdf
|
|
||||||
│ │ └── umount.sh
|
|
||||||
│ ├── loader
|
│ ├── loader
|
||||||
│ │ ├── cpu
|
│ │ ├── cpu
|
||||||
│ │ │ ├── cpu32.inc
|
│ │ │ ├── cpu32.inc
|
||||||
|
@ -48,6 +44,122 @@
|
||||||
│ └── folder.desc
|
│ └── folder.desc
|
||||||
├── build
|
├── build
|
||||||
│ ├── bin
|
│ ├── bin
|
||||||
|
│ ├── media
|
||||||
|
│ │ └── neox
|
||||||
|
│ │ └── FDD3-0486
|
||||||
|
│ │ └── boot
|
||||||
|
│ │ └── grub
|
||||||
|
│ │ ├── i386-pc
|
||||||
|
│ │ │ ├── adler32.mod
|
||||||
|
│ │ │ ├── affs.mod
|
||||||
|
│ │ │ ├── ata.mod
|
||||||
|
│ │ │ ├── bitmap.mod
|
||||||
|
│ │ │ ├── boot.mod
|
||||||
|
│ │ │ ├── bswap_test.mod
|
||||||
|
│ │ │ ├── btrfs.mod
|
||||||
|
│ │ │ ├── cbls.mod
|
||||||
|
│ │ │ ├── cbmemc.mod
|
||||||
|
│ │ │ ├── cbtime.mod
|
||||||
|
│ │ │ ├── cmdline_cat_test.mod
|
||||||
|
│ │ │ ├── cmp.mod
|
||||||
|
│ │ │ ├── configfile.mod
|
||||||
|
│ │ │ ├── cpuid.mod
|
||||||
|
│ │ │ ├── cs5536.mod
|
||||||
|
│ │ │ ├── ctz_test.mod
|
||||||
|
│ │ │ ├── datetime.mod
|
||||||
|
│ │ │ ├── diskfilter.mod
|
||||||
|
│ │ │ ├── div.mod
|
||||||
|
│ │ │ ├── div_test.mod
|
||||||
|
│ │ │ ├── dm_nv.mod
|
||||||
|
│ │ │ ├── drivemap.mod
|
||||||
|
│ │ │ ├── elf.mod
|
||||||
|
│ │ │ ├── exfat.mod
|
||||||
|
│ │ │ ├── extcmd.mod
|
||||||
|
│ │ │ ├── fat.mod
|
||||||
|
│ │ │ ├── font.mod
|
||||||
|
│ │ │ ├── gcry_arcfour.mod
|
||||||
|
│ │ │ ├── gcry_blowfish.mod
|
||||||
|
│ │ │ ├── gcry_dsa.mod
|
||||||
|
│ │ │ ├── gcry_idea.mod
|
||||||
|
│ │ │ ├── gcry_md5.mod
|
||||||
|
│ │ │ ├── gcry_rijndael.mod
|
||||||
|
│ │ │ ├── gcry_rmd160.mod
|
||||||
|
│ │ │ ├── gcry_rsa.mod
|
||||||
|
│ │ │ ├── gcry_seed.mod
|
||||||
|
│ │ │ ├── gcry_serpent.mod
|
||||||
|
│ │ │ ├── gcry_sha256.mod
|
||||||
|
│ │ │ ├── gcry_whirlpool.mod
|
||||||
|
│ │ │ ├── gptsync.mod
|
||||||
|
│ │ │ ├── hashsum.mod
|
||||||
|
│ │ │ ├── help.mod
|
||||||
|
│ │ │ ├── hfs.mod
|
||||||
|
│ │ │ ├── loopback.mod
|
||||||
|
│ │ │ ├── lsacpi.mod
|
||||||
|
│ │ │ ├── lsapm.mod
|
||||||
|
│ │ │ ├── lsmmap.mod
|
||||||
|
│ │ │ ├── lspci.mod
|
||||||
|
│ │ │ ├── lvm.mod
|
||||||
|
│ │ │ ├── lzopio.mod
|
||||||
|
│ │ │ ├── memrw.mod
|
||||||
|
│ │ │ ├── minicmd.mod
|
||||||
|
│ │ │ ├── minix2_be.mod
|
||||||
|
│ │ │ ├── minix.mod
|
||||||
|
│ │ │ ├── mpi.mod
|
||||||
|
│ │ │ ├── multiboot2.mod
|
||||||
|
│ │ │ ├── multiboot.mod
|
||||||
|
│ │ │ ├── nilfs2.mod
|
||||||
|
│ │ │ ├── ntfs.mod
|
||||||
|
│ │ │ ├── ntldr.mod
|
||||||
|
│ │ │ ├── odc.mod
|
||||||
|
│ │ │ ├── part_acorn.mod
|
||||||
|
│ │ │ ├── part_amiga.mod
|
||||||
|
│ │ │ ├── part_dfly.mod
|
||||||
|
│ │ │ ├── part_dvh.mod
|
||||||
|
│ │ │ ├── part_gpt.mod
|
||||||
|
│ │ │ ├── part_sun.mod
|
||||||
|
│ │ │ ├── parttool.mod
|
||||||
|
│ │ │ ├── pci.mod
|
||||||
|
│ │ │ ├── play.mod
|
||||||
|
│ │ │ ├── priority_queue.mod
|
||||||
|
│ │ │ ├── probe.mod
|
||||||
|
│ │ │ ├── procfs.mod
|
||||||
|
│ │ │ ├── progress.mod
|
||||||
|
│ │ │ ├── pxechain.mod
|
||||||
|
│ │ │ ├── pxe.mod
|
||||||
|
│ │ │ ├── random.mod
|
||||||
|
│ │ │ ├── reboot.mod
|
||||||
|
│ │ │ ├── regexp.mod
|
||||||
|
│ │ │ ├── scsi.mod
|
||||||
|
│ │ │ ├── serial.mod
|
||||||
|
│ │ │ ├── setpci.mod
|
||||||
|
│ │ │ ├── signature_test.mod
|
||||||
|
│ │ │ ├── sleep.mod
|
||||||
|
│ │ │ ├── sleep_test.mod
|
||||||
|
│ │ │ ├── syslinuxcfg.mod
|
||||||
|
│ │ │ ├── tar.mod
|
||||||
|
│ │ │ ├── terminal.mod
|
||||||
|
│ │ │ ├── testload.mod
|
||||||
|
│ │ │ ├── test.mod
|
||||||
|
│ │ │ ├── testspeed.mod
|
||||||
|
│ │ │ ├── trig.mod
|
||||||
|
│ │ │ ├── tr.mod
|
||||||
|
│ │ │ ├── true.mod
|
||||||
|
│ │ │ ├── uhci.mod
|
||||||
|
│ │ │ ├── usbms.mod
|
||||||
|
│ │ │ ├── usbserial_ftdi.mod
|
||||||
|
│ │ │ ├── usbserial_pl2303.mod
|
||||||
|
│ │ │ ├── vbe.mod
|
||||||
|
│ │ │ ├── verify.mod
|
||||||
|
│ │ │ ├── vga.mod
|
||||||
|
│ │ │ ├── video_bochs.mod
|
||||||
|
│ │ │ ├── video.mod
|
||||||
|
│ │ │ ├── videotest_checksum.mod
|
||||||
|
│ │ │ ├── xnu.mod
|
||||||
|
│ │ │ ├── xnu_uuid.mod
|
||||||
|
│ │ │ ├── xnu_uuid_test.mod
|
||||||
|
│ │ │ ├── zfscrypt.mod
|
||||||
|
│ │ │ └── zfs.mod
|
||||||
|
│ │ └── locale
|
||||||
│ ├── obj
|
│ ├── obj
|
||||||
│ │ └── kaleid
|
│ │ └── kaleid
|
||||||
│ │ ├── kernel
|
│ │ ├── kernel
|
||||||
|
@ -103,6 +215,8 @@
|
||||||
│ │ ├── sprintf.d
|
│ │ ├── sprintf.d
|
||||||
│ │ ├── string.d
|
│ │ ├── string.d
|
||||||
│ │ └── strtol.d
|
│ │ └── strtol.d
|
||||||
|
│ ├── create_disk.sh
|
||||||
|
│ ├── install-os-k.sh
|
||||||
│ └── kernel.ld
|
│ └── kernel.ld
|
||||||
├── include
|
├── include
|
||||||
│ ├── ex
|
│ ├── ex
|
||||||
|
@ -211,4 +325,4 @@
|
||||||
├── ProjectTree
|
├── ProjectTree
|
||||||
└── README.md
|
└── README.md
|
||||||
|
|
||||||
41 directories, 145 files
|
48 directories, 252 files
|
||||||
|
|
|
@ -1,64 +0,0 @@
|
||||||
#=----------------------------------------------------------------------------=#
|
|
||||||
# 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/>. #
|
|
||||||
#=----------------------------------------------------------------------------=#
|
|
||||||
|
|
||||||
#Color codes
|
|
||||||
CL='\033[0;32m'
|
|
||||||
CL2='\033[1;36m'
|
|
||||||
CL3='\033[0m'
|
|
||||||
NC='\033[1;37m'
|
|
||||||
|
|
||||||
set -e #exit if error
|
|
||||||
|
|
||||||
echo ${CL2}[grub-install.sh]${NC} Mouting image... \(losetup\)${CL3}
|
|
||||||
## Prepare Mount
|
|
||||||
sudo losetup -D > /dev/null
|
|
||||||
sudo losetup /dev/loop0 $1 > /dev/null # mounting the device block
|
|
||||||
sudo losetup /dev/loop1 $1 -o 1048576 > /dev/null #mounting the logical partition
|
|
||||||
|
|
||||||
echo ${CL2}[grub-install.sh]${NC} Mounting volume... \(mount\)${CL3}
|
|
||||||
## Mount
|
|
||||||
if [ -e $2/boot ]
|
|
||||||
then
|
|
||||||
sudo umount $2 > /dev/null
|
|
||||||
fi
|
|
||||||
sudo mount /dev/loop1 $2 > /dev/null
|
|
||||||
|
|
||||||
echo ${CL2}[grub-install.sh]${NC} Installing grub... \(grub-install\)${CL3}
|
|
||||||
## Install grub
|
|
||||||
sudo grub-install -V
|
|
||||||
sudo grub-install --target=i386-pc --debug --root-directory=$2 --boot-directory=$2/boot --no-floppy --modules="part_msdos biosdisk fat multiboot configfile" /dev/loop0 2> build/grub.log
|
|
||||||
|
|
||||||
echo ${CL2}[grub-install.sh]${NC} Copying grub.cfg
|
|
||||||
sudo cp $3 $2/boot/grub/grub.cfg > /dev/null
|
|
||||||
|
|
||||||
echo ${CL2}[grub-install.sh]${NC} Sync image... \(sync\)${CL3}
|
|
||||||
sync
|
|
||||||
|
|
||||||
echo ${CL2}[grub-install.sh]${NC} Unmounting volume... \(umount\)${CL3}
|
|
||||||
sudo umount /dev/loop1 > /dev/null
|
|
||||||
|
|
||||||
echo ${CL2}[grub-install.sh]${NC} Unmounting image... \(losetup\)${CL3}
|
|
||||||
sudo losetup -D > /dev/null
|
|
||||||
|
|
||||||
echo ${CL2}[grub-install.sh]${CL} See grub.log for more informations.${CL3}
|
|
|
@ -1,38 +0,0 @@
|
||||||
#=----------------------------------------------------------------------------=#
|
|
||||||
# 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/>. #
|
|
||||||
#=----------------------------------------------------------------------------=#
|
|
||||||
|
|
||||||
#Color codes
|
|
||||||
CL='\033[0;32m'
|
|
||||||
CL2='\033[1;36m'
|
|
||||||
CL3='\033[0m'
|
|
||||||
NC='\033[1;37m'
|
|
||||||
|
|
||||||
set -e #exit if error
|
|
||||||
|
|
||||||
echo ${CL2}[mount.sh]${NC} Mouting image... \(losetup\)${CL3}
|
|
||||||
sudo losetup -D > /dev/null
|
|
||||||
sudo losetup /dev/loop0 $1 -o 1048576 > /dev/null #mounting the logical partition
|
|
||||||
echo ${CL2}[mount.sh]${NC} Mouting volume... \(mount\)${CL3}
|
|
||||||
sudo mount -t vfat /dev/loop0 $2 -o rw,uid=$(id -u),gid=$(id -g) > /dev/null
|
|
||||||
echo ${CL2}[mount.sh]${CL} Terminated without error.${CL3}
|
|
|
@ -36,8 +36,8 @@ global BtHeader
|
||||||
extern BtStartKern
|
extern BtStartKern
|
||||||
|
|
||||||
[BITS 32]
|
[BITS 32]
|
||||||
[section .multiboot]
|
|
||||||
|
|
||||||
|
[section .multiboot]
|
||||||
;; MAGNIFICENT MULTIBOOT HEADER FOR GRUB ------------------------------------ ;;
|
;; MAGNIFICENT MULTIBOOT HEADER FOR GRUB ------------------------------------ ;;
|
||||||
BtHeader:
|
BtHeader:
|
||||||
ALIGN 4
|
ALIGN 4
|
||||||
|
@ -50,8 +50,11 @@ BtHeader:
|
||||||
dd MB_VIDEO_HEIGHT
|
dd MB_VIDEO_HEIGHT
|
||||||
dd MB_VIDEO_DEPTH
|
dd MB_VIDEO_DEPTH
|
||||||
|
|
||||||
[section .text]
|
[section .joke]
|
||||||
|
;; MAGNIFICENT MULTIBOOT HEADER FOR OUR OS BINARY --------------------------- ;;
|
||||||
|
db "This program cannot be run in Win32 mode, or DOS mode, or in any operating system mode that owns your fantasy. KTHXBYE",0
|
||||||
|
|
||||||
|
[section .text]
|
||||||
;;MULTIBOOT POINT ENTRY FOR GRUB -------------------------------------------- ;;
|
;;MULTIBOOT POINT ENTRY FOR GRUB -------------------------------------------- ;;
|
||||||
BtStartLoader:
|
BtStartLoader:
|
||||||
mov esp, KERNEL_STACK ; Setup the stack
|
mov esp, KERNEL_STACK ; Setup the stack
|
||||||
|
@ -180,4 +183,4 @@ AfterInitStack:
|
||||||
mov bl, 0x0c
|
mov bl, 0x0c
|
||||||
mov esi, nokernel ; Error 05
|
mov esi, nokernel ; Error 05
|
||||||
call write
|
call write
|
||||||
jmp Die
|
jmp Die
|
|
@ -33,33 +33,31 @@ set -e #exit if error
|
||||||
## Create the image
|
## Create the image
|
||||||
echo ${CL2}[create_disk.sh]${NC} Creating image... \(dd\)${CL3}
|
echo ${CL2}[create_disk.sh]${NC} Creating image... \(dd\)${CL3}
|
||||||
dd if=/dev/zero of=$1 bs=512 count=131072 status=progress
|
dd if=/dev/zero of=$1 bs=512 count=131072 status=progress
|
||||||
echo ${CL2}[create_disk.sh]${NC} Partitionning image... \(fdisk\)${CL3}
|
|
||||||
## Partition the image
|
## Partition the image
|
||||||
# WARNING, DO NOT DELETE SPACES !
|
echo ${CL2}[create_disk.sh]${NC} Partitionning image... \(parted\)${CL3}
|
||||||
sudo fdisk $1 > /dev/null <<EEOF
|
/sbin/parted --script $1 mktable msdos mkpart primary 2048s 100% set 1 boot on
|
||||||
n
|
|
||||||
p
|
|
||||||
1
|
|
||||||
|
|
||||||
|
|
||||||
a
|
|
||||||
w
|
|
||||||
EEOF
|
|
||||||
# WARNING, YOU CAN NOW DELETE SPACES
|
|
||||||
|
|
||||||
echo ${CL2}[create_disk.sh]${NC} Mouting image... \(losetup\)${CL3}
|
|
||||||
## Map
|
|
||||||
sudo losetup -D > /dev/null
|
|
||||||
sudo losetup /dev/loop0 $1 -o 1048576 > /dev/null #mounting the logical partition
|
|
||||||
|
|
||||||
echo ${CL2}[create_disk.sh]${NC} Formatting image... \(mkdosfs\)${CL3}
|
|
||||||
## Format
|
## Format
|
||||||
sudo mkdosfs -F32 -f 2 /dev/loop0 > /dev/null
|
echo ${CL2}[create_disk.sh]${NC} Formatting image... \(mkdosfs\)${CL3}
|
||||||
|
/sbin/mkdosfs -F32 -f 2 $1
|
||||||
|
|
||||||
|
echo ${CL2}[create_disk.sh]${NC} Mount image... \(udisksctl\)${CL3}
|
||||||
|
udisksctl loop-setup --no-user-interaction --file $1
|
||||||
|
lpblock=$(/sbin/losetup -j $1 | cut -d ':' -f 1)
|
||||||
|
mountpoint=$(udisksctl info -b $lpblock | grep MountPoint | cut -d ':' -f 2 | sed 's/ //g')
|
||||||
|
|
||||||
echo ${CL2}[create_disk.sh]${NC} Sync image... \(sync\)${CL3}
|
echo ${CL2}[create_disk.sh]${NC} Sync image... \(sync\)${CL3}
|
||||||
sync
|
sync
|
||||||
|
|
||||||
echo ${CL2}[create_disk.sh]${NC} Unmounting... \(losetup\)${CL3}
|
echo ${CL2}[create_disk.sh]${NC} Install grub into $lpblock as $mountpoint... \(grub-install\)${CL3}
|
||||||
sudo losetup -D > /dev/null
|
|
||||||
|
sudo grub-install --force --target=i386-pc --root-directory=$mountpoint --boot-directory=$mountpoint/boot --no-floppy --modules="part_msdos biosdisk fat multiboot configfile" $lpblock
|
||||||
|
|
||||||
|
echo ${CL2}[create_disk.sh]${NC} Sync image... \(sync\)${CL3}
|
||||||
|
sync
|
||||||
|
|
||||||
|
echo ${CL2}[create_disk.sh]${NC} Unmount image... \(udisksctl\)${CL3}
|
||||||
|
udisksctl unmount --no-user-interaction -b $lpblock
|
||||||
|
|
||||||
echo ${CL2}[create_disk.sh]${CL} Terminated without error.${CL3}
|
echo ${CL2}[create_disk.sh]${CL} Terminated without error.${CL3}
|
|
@ -1,7 +1,7 @@
|
||||||
#=----------------------------------------------------------------------------=#
|
#=----------------------------------------------------------------------------=#
|
||||||
# GNU GPL OS/K #
|
# GNU GPL OS/K #
|
||||||
# #
|
# #
|
||||||
# Desc: Simple unmount script #
|
# Desc: Grub installation script for the OS/K image #
|
||||||
# #
|
# #
|
||||||
# #
|
# #
|
||||||
# Copyright © 2018-2019 The OS/K Team #
|
# Copyright © 2018-2019 The OS/K Team #
|
||||||
|
@ -29,10 +29,22 @@ CL3='\033[0m'
|
||||||
NC='\033[1;37m'
|
NC='\033[1;37m'
|
||||||
|
|
||||||
set -e #exit if error
|
set -e #exit if error
|
||||||
|
|
||||||
|
echo ${CL2}[create_disk.sh]${NC} Mount image... \(udisksctl\)${CL3}
|
||||||
|
udisksctl loop-setup --no-user-interaction --file $1
|
||||||
|
lpblock=$(/sbin/losetup -j $1 | cut -d ':' -f 1)
|
||||||
|
echo Block is $lpblock
|
||||||
|
#udisksctl mount --no-user-interaction -b $lpblock
|
||||||
|
mountpoint=$(udisksctl info -b $lpblock | grep MountPoint | cut -d ':' -f 2 | sed 's/ //g')
|
||||||
|
|
||||||
|
echo ${CL2}[grub-install.sh]${NC} Copying grub.cfg
|
||||||
|
cp $2 $mountpoint/boot/grub/grub.cfg
|
||||||
|
echo ${CL2}[grub-install.sh]${NC} Copying kernel
|
||||||
|
cp $3 $mountpoint/boot/kaleid
|
||||||
|
|
||||||
|
echo ${CL2}[grub-install.sh]${NC} Sync image... \(sync\)${CL3}
|
||||||
sync
|
sync
|
||||||
sleep 1
|
|
||||||
echo ${CL2}[umount.sh]${NC} Unmounting volume... \(umount\)${CL3}
|
echo ${CL2}[create_disk.sh]${NC} Unmount image... \(udisksctl\)${CL3}
|
||||||
sudo umount $1
|
udisksctl unmount --no-user-interaction -b $lpblock
|
||||||
echo ${CL2}[umount.sh]${NC} Unmounting image... \(losetup\)${CL3}
|
#udisksctl loop-delete --no-user-interaction -b $lpblock
|
||||||
sudo losetup -D
|
|
||||||
echo ${CL2}[umount.sh]${CL} Terminated without error.${CL3}
|
|
|
@ -27,11 +27,13 @@
|
||||||
ENTRY(BtStartLoader) /* the name of the entry label */
|
ENTRY(BtStartLoader) /* the name of the entry label */
|
||||||
|
|
||||||
SECTIONS {
|
SECTIONS {
|
||||||
|
|
||||||
. = 0x00100000; /* the code should be loaded at 1 MB */
|
. = 0x00100000; /* the code should be loaded at 1 MB */
|
||||||
|
|
||||||
.boot ALIGN (0x1000) :
|
.boot ALIGN (0x1000) :
|
||||||
{
|
{
|
||||||
*(.multiboot)
|
*(.multiboot)
|
||||||
|
*(.joke)
|
||||||
}
|
}
|
||||||
|
|
||||||
.text ALIGN (0x1000) :
|
.text ALIGN (0x1000) :
|
||||||
|
@ -68,3 +70,5 @@ SECTIONS {
|
||||||
|
|
||||||
kernelEnd = .;
|
kernelEnd = .;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue