Let the kernel load figure out where to put mods

This patch makes the mkimage tool obsolete
This commit is contained in:
Dirk Vogt 2012-05-01 15:04:26 +02:00 committed by Thomas Veerman
parent d642d5508f
commit 207e4d2a71
2 changed files with 28 additions and 14 deletions

View file

@ -356,6 +356,7 @@ static void get_parameters(multiboot_info_t *mbi)
static void mb_extract_image(multiboot_info_t mbi) static void mb_extract_image(multiboot_info_t mbi)
{ {
phys_bytes start_paddr = 0x5000000;
multiboot_module_t *mb_module_info; multiboot_module_t *mb_module_info;
multiboot_module_t *module; multiboot_module_t *module;
u32_t mods_count = mbi.mods_count; u32_t mods_count = mbi.mods_count;
@ -415,20 +416,24 @@ static void mb_extract_image(multiboot_info_t mbi)
; ;
} }
stack_bytes = round_page(image[NR_TASKS+i].stack_kbytes * 1024); stack_bytes = image[NR_TASKS+i].stack_kbytes * 1024;
text_paddr = start_paddr + (text_vaddr & PAGE_MASK);
/* Load text segment */ /* Load text segment */
phys_copy(module->mod_start+text_offset, text_paddr, phys_copy(module->mod_start+text_offset, text_paddr,
text_filebytes); text_filebytes);
mb_clear_memrange(text_paddr+text_filebytes, mb_clear_memrange(text_paddr+text_filebytes,
trunc_page(text_paddr) + text_membytes); round_page(text_paddr) + text_membytes);
data_paddr = round_page((text_paddr + text_membytes));
data_paddr += data_vaddr & PAGE_MASK;
/* start of next module */
start_paddr = round_page(data_paddr + data_membytes + stack_bytes);
/* Load data and stack segments */ /* Load data and stack segments */
phys_copy(module->mod_start+data_offset, data_paddr, phys_copy(module->mod_start+data_offset, data_paddr, data_filebytes);
data_filebytes); mb_clear_memrange(data_paddr+data_filebytes, start_paddr);
mb_clear_memrange(data_paddr+data_filebytes,
trunc_page(data_paddr) + data_membytes
+ stack_bytes);
/* Save memmap for non-kernel tasks, so subscript past kernel /* Save memmap for non-kernel tasks, so subscript past kernel
tasks. */ tasks. */

View file

@ -34,7 +34,6 @@ usage:
@echo " make includes # Install include files" >&2 @echo " make includes # Install include files" >&2
@echo " make depend # Generate dependency files" >&2 @echo " make depend # Generate dependency files" >&2
@echo " make services # Compile and install all services" >&2 @echo " make services # Compile and install all services" >&2
@echo " make image # Make needed services and create boot image" >&2
@echo " make install # Make image, and install to hard disk" >&2 @echo " make install # Make image, and install to hard disk" >&2
@echo " make hdboot # Make image, and install to hard disk" >&2 @echo " make hdboot # Make image, and install to hard disk" >&2
@echo " make fdboot # Make image, and install to floppy disk" >&2 @echo " make fdboot # Make image, and install to floppy disk" >&2
@ -48,10 +47,7 @@ usage:
@echo " make fresh install # new everything" >&2 @echo " make fresh install # new everything" >&2
@echo " " >&2 @echo " " >&2
all: services image all: services
image: includes services
mkimage $(PROGRAMS)
# rebuild the program or system libraries # rebuild the program or system libraries
includes: includes:
@ -78,7 +74,7 @@ drivers: includes servers
bootable: bootable:
exec su root mkboot bootable exec su root mkboot bootable
hdboot: image hdboot:
rm -rf /boot/minix/.temp/ rm -rf /boot/minix/.temp/
mkdir -p /boot/minix/.temp mkdir -p /boot/minix/.temp
# mod_0 is used to make alphabetical order equal to the boot order # mod_0 is used to make alphabetical order equal to the boot order
@ -96,12 +92,25 @@ hdboot: image
sh mkboot $@ sh mkboot $@
sh ../commands/update_bootcfg/update_bootcfg.sh sh ../commands/update_bootcfg/update_bootcfg.sh
fdboot: image fdboot:
exec su root mkboot $@ exec su root mkboot $@
@sync @sync
install: includes services hdboot install: includes services hdboot
cross_install:
if [ ! -d ${DESTDIR}/multiboot ] ; \
then\
mkdir ${DESTDIR}/multiboot;\
fi
#ext2 might be needed
for i in ${PROGRAMS} ../servers/ext2/ext2;\
do\
newname="${DESTDIR}/multiboot/`basename $$i`"; \
cp $$i $$newname;\
strip -s $$newname;\
done
# download and update NetBSD reference sources. # download and update NetBSD reference sources.
nbsd_fetch: nbsd_fetch:
export CVS_RSH=ssh; \ export CVS_RSH=ssh; \