]> Zhao Yanbai Git Server - minix.git/commitdiff
Let the kernel load figure out where to put mods
authorDirk Vogt <dirk@minix3.org>
Tue, 1 May 2012 13:04:26 +0000 (15:04 +0200)
committerThomas Veerman <thomas@minix3.org>
Mon, 18 Jun 2012 10:53:22 +0000 (10:53 +0000)
This patch makes the mkimage tool obsolete

kernel/arch/i386/pre_init.c
tools/Makefile

index 0a294669ff7e96cf62f7f06bdcdf204d9c70345f..0e5532436046b6cb48b0c27a7be2c8b68725b14f 100644 (file)
@@ -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. */
index eec6e742db13ac47d8170f2535d57e11ea96fe87..3616699f716801cea647ced8e20f04d3f5b93695 100644 (file)
@@ -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;                                                     \