From: Dirk Vogt Date: Tue, 1 May 2012 13:04:26 +0000 (+0200) Subject: Let the kernel load figure out where to put mods X-Git-Tag: v3.2.1~533 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/style.css?a=commitdiff_plain;h=207e4d2a71a1b42d6aa51b8d348ed8fa817f6999;p=minix.git Let the kernel load figure out where to put mods This patch makes the mkimage tool obsolete --- diff --git a/kernel/arch/i386/pre_init.c b/kernel/arch/i386/pre_init.c index 0a294669f..0e5532436 100644 --- a/kernel/arch/i386/pre_init.c +++ b/kernel/arch/i386/pre_init.c @@ -356,6 +356,7 @@ static void get_parameters(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 *module; 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 */ phys_copy(module->mod_start+text_offset, 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 */ - phys_copy(module->mod_start+data_offset, data_paddr, - data_filebytes); - mb_clear_memrange(data_paddr+data_filebytes, - trunc_page(data_paddr) + data_membytes - + stack_bytes); + phys_copy(module->mod_start+data_offset, data_paddr, data_filebytes); + mb_clear_memrange(data_paddr+data_filebytes, start_paddr); /* Save memmap for non-kernel tasks, so subscript past kernel tasks. */ diff --git a/tools/Makefile b/tools/Makefile index eec6e742d..3616699f7 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -34,7 +34,6 @@ usage: @echo " make includes # Install include files" >&2 @echo " make depend # Generate dependency files" >&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 hdboot # Make image, and install to hard 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 " " >&2 -all: services image - -image: includes services - mkimage $(PROGRAMS) +all: services # rebuild the program or system libraries includes: @@ -78,7 +74,7 @@ drivers: includes servers bootable: exec su root mkboot bootable -hdboot: image +hdboot: rm -rf /boot/minix/.temp/ mkdir -p /boot/minix/.temp # mod_0 is used to make alphabetical order equal to the boot order @@ -96,12 +92,25 @@ hdboot: image sh mkboot $@ sh ../commands/update_bootcfg/update_bootcfg.sh -fdboot: image +fdboot: exec su root mkboot $@ @sync 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. nbsd_fetch: export CVS_RSH=ssh; \