feat: mise en place du chargement d'une arborescence CRAMFS pour demarrer le système

This commit is contained in:
Nicolas Hordé 2019-01-19 16:23:57 +01:00
parent 4f7aae792e
commit acb06bc8a8
9 changed files with 50 additions and 50 deletions

Binary file not shown.

View File

@ -1,40 +1,39 @@
all: harddisk.img.final floppy.img.final harddiskuefi.img.final
harddiskuefi.img.before: harddiskuefi.img.before:
(xz -d -k harddiskuefi.img.xz) xz -d -k harddiskuefi.img.xz
(dd if=harddiskuefi.img of=harddiskuefi.img.part1 skip=13672 bs=512) dd if=harddiskuefi.img of=harddiskuefi.img.part1 skip=13672 bs=512
(dd if=harddiskuefi.img of=harddiskuefi.img.before count=13672 bs=512;sync) dd if=harddiskuefi.img of=harddiskuefi.img.before count=13672 bs=512
(mkdir ./mnt -p) mkdir ./mnt -p
sync
harddiskuefi.img.final: harddiskuefi.img.before harddiskuefi.img.final: initram.img harddiskuefi.img.before
(mount.fuse-ext2 -o rw+ harddiskuefi.img.part1 ./mnt) mount.fuse-ext2 -o rw+ harddiskuefi.img.part1 ./mnt
(cp ../system/system.sys ./mnt/boot/;sync) cp ../system/system.sys ./mnt/boot/
(fusermount ./mnt -u) cp ./initram.img ./mnt/boot/
(cat harddiskuefi.img.before > harddiskuefi.img.final) sync
(cat harddiskuefi.img.part1 >> harddiskuefi.img.final;sync) fusermount ./mnt -u
cat harddiskuefi.img.before > harddiskuefi.img.final
cat harddiskuefi.img.part1 >> harddiskuefi.img.final
sync
harddisk.img.before: harddisk.img.before:
(xz -d -k harddisk.img.xz) xz -d -k harddisk.img.xz
(dd if=harddisk.img of=harddisk.img.part1 skip=63 bs=512) dd if=harddisk.img of=harddisk.img.part1 skip=63 bs=512
(dd if=harddisk.img of=harddisk.img.before count=63 bs=512;sync) dd if=harddisk.img of=harddisk.img.before count=63 bs=512
(mkdir ./mnt -p) mkdir ./mnt -p
sync
harddisk.img.final: harddisk.img.before harddisk.img.final: initram.img harddisk.img.before
(mount.fuse-ext2 -o rw+ harddisk.img.part1 ./mnt) mount.fuse-ext2 -o rw+ harddisk.img.part1 ./mnt
(cp ../system/system.sys ./mnt/boot/;sync) cp ../system/system.sys ./mnt/boot/
(fusermount ./mnt -u) cp ./initram.img ./mnt/boot/
(cat harddisk.img.before > harddisk.img.final) sync
(cat harddisk.img.part1 >> harddisk.img.final;sync) fusermount ./mnt -u
cat harddisk.img.before > harddisk.img.final
cat harddisk.img.part1 >> harddisk.img.final
sync
floppy.img.final: initram.img:
(dd if=/dev/zero of=floppy.img.final count=2880 bs=512) make -C ../programs
(mkfs.msdos -F 12 -n "COS2000" floppy.img.final)
(mkdir ./mnt -p)
(fusefat floppy.img.final ./mnt -o rw+)
(cp ../boot/loader.sys ./mnt/)
(cp ../system/system.sys ./mnt/;sync)
(fusermount ./mnt -u)
(dd if=../boot/boot12.bin of=floppy.img.final seek=0 count=1 conv=notrunc;sync)
littleclean: littleclean:
rm -f *.final rm -f *.final

View File

@ -8,7 +8,7 @@ echo ${lo}
losetup -P ${lo} harddisk.img losetup -P ${lo} harddisk.img
mkfs.ext2 ${lo}p1 mkfs.ext2 ${lo}p1
mount ${lo}p1 /mnt mount ${lo}p1 /mnt
grub-install --no-floppy --install-modules="biosdisk part_msdos ext2 configfile normal linux16 vbe png gfxmenu video video_colors video_cirrus video_fb" --boot-directory=/mnt/boot ${lo} --target=i386-pc grub-install --no-floppy --install-modules="biosdisk part_msdos ext2 configfile normal linux16 linux vbe png gfxmenu video video_colors video_cirrus video_fb" --boot-directory=/mnt/boot ${lo} --target=i386-pc
echo -en "\ echo -en "\
insmod ext2 insmod ext2
insmod biosdisk insmod biosdisk
@ -22,7 +22,8 @@ set timeout=4\n\
set default=0\n\ set default=0\n\
menuentry "cos2000" {\n\ menuentry "cos2000" {\n\
set root=(hd0,1)\n\ set root=(hd0,1)\n\
linux16 /boot/system.sys root=hd0,2\n linux16 /boot/system.sys root=hd0,2 vesa=0318\n\
initrd16 /boot/initram.img\n\
boot\n\ boot\n\
}" > /mnt/boot/grub/grub.cfg }" > /mnt/boot/grub/grub.cfg
umount /mnt umount /mnt

View File

@ -25,6 +25,8 @@ typedef struct bootparams {
u32 e820_numbers; u32 e820_numbers;
u8* cmdline; u8* cmdline;
u8 kbflag; u8 kbflag;
u32 ramdisksize;
u32 ramdiskaddr;
} bootparams; } bootparams;

View File

@ -129,15 +129,13 @@ int ps()
/*******************************************************************************/ /*******************************************************************************/
/* Test l'usage de création de tâche */ /* Test l'usage de création de tâche */
#include "TEST/test.c"
#include "TEST/test2.c"
int testtask() int testtask()
{ {
print("*** Creation d'une tache\r\n"); print("*** Creation d'une tache\r\n");
pid_t pid; pid_t pid;
pid = createprocess(&programs_test2, false); pid = createprocess(NULL, false);
runprocess(pid); runprocess(pid);
pid = createprocess(&programs_test, false); pid = createprocess(NULL, false);
runprocess(pid); runprocess(pid);
} }

View File

@ -27,15 +27,7 @@ syscall: clean remakeapi all
remakeapi: remakeapi:
$(MAKECALL) $(MAKECALL)
programs: programs/test lib/TEST/test.c lib/TEST/test2.c programs:
lib/TEST/test.c:
xxd -i programs/test lib/TEST/test.c
lib/TEST/test2.c:
xxd -i programs/test2 lib/TEST/test2.c
programs/test:
make -C programs make -C programs
harddisk: final/harddisk.img.final harddisk: final/harddisk.img.final
@ -43,7 +35,7 @@ harddisk: final/harddisk.img.final
uefi: final/harddiskuefi.img.final uefi: final/harddiskuefi.img.final
install: install:
$(INSTALL) gcc qemu fusefat fuseext2 gdb ovmf bsdmainutils tar bsdmainutils indent binutils bochs bochs-x bochsbios dos2unix gnome-terminal $(INSTALL) gcc qemu fusefat fuseext2 gdb ovmf bsdmainutils tar bsdmainutils cramfsprogs indent binutils bochs bochs-x bochsbios dos2unix gnome-terminal
togit: togit:
make -C system togit make -C system togit

View File

@ -7,12 +7,17 @@ INDENT=indent -nhnl -l75 -ppi3 -ts8 -bls -nbc -di8 -nbad -nbap -nsob -i8 -bl -bl
REMOVE=rm -f REMOVE=rm -f
CHANGELF=elfedit --output-osabi FenixOS CHANGELF=elfedit --output-osabi FenixOS
CHANGEPERM=chmod 644 CHANGEPERM=chmod 644
MOVE=mv
all: lib/libs.a $(EXECS) all: lib/libs.a ../final/initram.img
sync sync
togit: clean indent togit: clean indent
../final/initram.img: $(EXECS)
(find . -type f ! -perm /u=x -maxdepth 1 -regex '.+/\.?[^\.]+' -exec $(MOVE) {} ../final/cramfs/executables/ \;;true)
mkcramfs ../final/cramfs/ ../final/initram.img
lib/libs.a: lib/libs.a:
make -C lib make -C lib
@ -26,7 +31,8 @@ clean:
make -C lib clean make -C lib clean
$(REMOVE) *.o $(REMOVE) *.o
$(REMOVE) *.c~ $(REMOVE) *.c~
find . -type f ! -perm /u=x -maxdepth 1 -regex '.+/\.?[^\.]+' -exec $(REMOVE) {} \; (find ../final/cramfs/executables -type f ! -perm /u=x -maxdepth 1 -regex '.+/\.?[^\.]+' -exec $(REMOVE) {} \;;true)
(find . -type f ! -perm /u=x -maxdepth 1 -regex '.+/\.?[^\.]+' -exec $(REMOVE) {} \;;true)
sync sync
indent: indent:

View File

@ -274,7 +274,9 @@ void initpmode()
void initparams() void initparams()
{ {
//params.cmdline=((header*)hdr)->cmd_line_ptr; params.cmdline=((header*)&hdr)->cmd_line_ptr;
params.ramdiskaddr=((header*)&hdr)->ramdisk_image;
params.ramdisksize=((header*)&hdr)->ramdisk_size;
asm("xorl %%eax,%%eax\n \ asm("xorl %%eax,%%eax\n \
movw %%ds,%%ax\n \ movw %%ds,%%ax\n \
shl $4,%%eax\n \ shl $4,%%eax\n \