mirror of
https://gitlab.com/sortix/sortix.git
synced 2023-02-13 20:55:38 -05:00
The initrd now uses the mkinitrd format and the kernel now loads it.
This commit is contained in:
parent
d9c0c8d0cd
commit
011addf46c
3 changed files with 27 additions and 11 deletions
10
Makefile
10
Makefile
|
@ -5,7 +5,7 @@ endif
|
|||
REMOTE=192.168.2.6
|
||||
REMOTEUSER=sortie
|
||||
REMOTECOPYDIR:=/home/$(REMOTEUSER)/Desktop/MaxsiOS
|
||||
MODULES=libmaxsi hello pong sortix
|
||||
MODULES=libmaxsi hello pong mkinitrd sortix
|
||||
|
||||
VERSION=0.4
|
||||
DEBNAME:=sortix_$(VERSION)_$(CPU)
|
||||
|
@ -17,6 +17,7 @@ PACKAGENAME:=sortix
|
|||
ISODIR:=builds/$(DEBNAME)-iso
|
||||
ISOFILE:=builds/$(DEBNAME).iso
|
||||
JSNAME:=jssortix_$(VERSION)_$(CPU).bin
|
||||
INITRDDIR:=initrd
|
||||
|
||||
all:
|
||||
(for D in $(MODULES); do $(MAKE) all $(MFLAGS) --directory $$D; done)
|
||||
|
@ -99,7 +100,12 @@ iso: all debsource
|
|||
mkdir -p $(ISODIR)
|
||||
cp -r isosrc/. $(ISODIR)
|
||||
cp sortix/sortix.bin $(ISODIR)/boot
|
||||
cp hello/hello $(ISODIR)/boot/sortix.initrd
|
||||
mkdir -p $(INITRDDIR)
|
||||
cp hello/hello $(INITRDDIR)
|
||||
cp pong/pong $(INITRDDIR)
|
||||
cp $(INITRDDIR)/hello $(INITRDDIR)/init
|
||||
(cd $(INITRDDIR) && ../mkinitrd/mkinitrd * -o ../$(ISODIR)/boot/sortix.initrd)
|
||||
rm -rf $(INITRDDIR)
|
||||
cp builds/$(DEBSRCNAME)-src.tar.gz $(ISODIR)
|
||||
grub-mkrescue -o $(ISOFILE) $(ISODIR)
|
||||
rm -rf $(ISODIR)
|
||||
|
|
3
mkinitrd/.gitignore
vendored
Normal file
3
mkinitrd/.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
mkinitrd
|
||||
lsinitrd
|
||||
catinitrd
|
|
@ -45,6 +45,7 @@
|
|||
#include "serialterminal.h"
|
||||
#include "vgaterminal.h"
|
||||
#include "elf.h"
|
||||
#include "initrd.h"
|
||||
|
||||
using namespace Maxsi;
|
||||
|
||||
|
@ -209,6 +210,8 @@ namespace Sortix
|
|||
initrd = modules[2*I+0];
|
||||
break;
|
||||
}
|
||||
|
||||
if ( initrd == NULL ) { PanicF("No initrd provided"); }
|
||||
#endif
|
||||
|
||||
// Initialize the GDT and TSS structures.
|
||||
|
@ -250,9 +253,14 @@ namespace Sortix
|
|||
Process* process = new Process(addrspace);
|
||||
if ( process == 0 ) { Panic("kernel.cpp: Could not allocate the first process!"); }
|
||||
|
||||
if ( initrd != NULL )
|
||||
{
|
||||
initstart = (Thread::Entry) ELF::Construct(process, initrd, initrdsize);
|
||||
InitRD::Init(initrd, initrdsize);
|
||||
|
||||
const char* initname = "init";
|
||||
size_t programsize = 0;
|
||||
byte* program = InitRD::Open(initname, &programsize);
|
||||
if ( program == NULL ) { PanicF("initrd did not contain '%s'", initname); }
|
||||
|
||||
initstart = (Thread::Entry) ELF::Construct(process, program, programsize);
|
||||
if ( initstart == NULL )
|
||||
{
|
||||
Panic("kernel.cpp: Could not construct ELF program");
|
||||
|
@ -260,7 +268,6 @@ namespace Sortix
|
|||
|
||||
// HACK: This should be determined from other information!
|
||||
process->_endcodesection = 0x400000UL;
|
||||
}
|
||||
|
||||
if ( Scheduler::CreateThread(process, initstart) == NULL )
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue