Changeset 63f5cd6 in mainline


Ignore:
Timestamp:
2006-04-22T22:34:46Z (19 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
271fcaf
Parents:
ab4ac14
Message:

ppc32: support for loading init

Location:
arch/ppc32
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • arch/ppc32/Makefile.inc

    rab4ac14 r63f5cd6  
    2929build: image.boot
    3030
    31 image.boot: kernel
    32         make -C arch/$(ARCH)/loader COMPILER=$(COMPILER) KERNEL=../../../$(KERNELDIR)/kernel.bin
     31image.boot: kernel uspace
     32        make -C arch/$(ARCH)/loader COMPILER=$(COMPILER) KERNEL=../../../$(KERNELDIR)/kernel.bin INIT=../../../$(USPACEDIR)/init/init
    3333        cp arch/$(ARCH)/loader/image.boot image.boot
    3434
    35 clean: clean_kernel
     35clean: clean_kernel clean_uspace
    3636        make -C arch/$(ARCH)/loader clean
    3737        -rm -f image.boot
    3838
    39 arch_distclean: distclean_kernel
     39arch_distclean: distclean_kernel distclean_uspace
  • arch/ppc32/loader/Makefile

    rab4ac14 r63f5cd6  
    6565-include Makefile.depend
    6666
    67 image.boot: depend $(OBJECTS) kernel.o
    68         $(LD) -no-check-sections -N -T _link.ld $(OBJECTS) kernel.o -o $@
     67image.boot: depend $(OBJECTS) kernel.o init.o
     68        $(LD) -no-check-sections -N -T _link.ld $(OBJECTS) kernel.o init.o -o $@
    6969
    7070depend:
     
    7272
    7373clean:
    74         -rm -f $(OBJECTS) image.boot kernel.o Makefile.depend
     74        -rm -f $(OBJECTS) image.boot kernel.o init.o Makefile.depend
    7575
    7676kernel.o: $(KERNEL)
    77         $(OBJCOPY) -I binary -O elf32-powerpc -B powerpc:common --rename-section .data=.image $(KERNEL) $@
     77        $(OBJCOPY) -I binary -O elf32-powerpc -B powerpc:common --rename-section .data=.kernel_image $(KERNEL) $@
     78
     79init.o: $(INIT)
     80        $(OBJCOPY) -I binary -O elf32-powerpc -B powerpc:common --rename-section .data=.init_image $(INIT) $@
    7881
    7982%.o: %.S
  • arch/ppc32/loader/_link.ld

    rab4ac14 r63f5cd6  
    2424               
    2525                . = ALIGN(4096);
    26                 *(.image);
     26                *(.kernel_image);
     27               
     28                . = ALIGN(4096);
     29                *(.init_image);
    2730        }
    2831}
  • arch/ppc32/loader/main.c

    rab4ac14 r63f5cd6  
    3434#define KERNEL_END ((void *) &_binary_____________kernel_kernel_bin_end)
    3535#define KERNEL_SIZE ((unsigned int) KERNEL_END - (unsigned int) KERNEL_START)
     36
     37#define INIT_START ((void *) &_binary_____________uspace_init_init_start)
     38#define INIT_END ((void *) &_binary_____________uspace_init_init_end)
     39#define INIT_SIZE ((unsigned int) INIT_END - (unsigned int) INIT_START)
    3640
    3741#define HEAP_GAP 1024000
     
    8084       
    8185        check_align(KERNEL_START, "Kernel image");
     86        check_align(INIT_START, "Init image");
    8287        check_align(&real_mode, "Bootstrap trampoline");
    8388        check_align(&trans, "Translation table");
     
    108113        printf("\nMemory statistics (total %d MB)\n", bootinfo.memmap.total >> 20);
    109114        printf(" kernel image         at %L (size %d bytes)\n", KERNEL_START, KERNEL_SIZE);
    110         printf(" boot info            at %L (physical %L)\n", &bootinfo, bootinfo_pa);
     115        printf(" init image           at %L (size %d bytes)\n", INIT_START, INIT_SIZE);
     116        printf(" boot info structure  at %L (physical %L)\n", &bootinfo, bootinfo_pa);
    111117        printf(" bootstrap trampoline at %L (physical %L)\n", &real_mode, real_mode_pa);
    112118        printf(" translation table    at %L (physical %L)\n", &trans, trans_pa);
    113119       
    114         unsigned int top = ALIGN_UP(KERNEL_SIZE, PAGE_SIZE);
    115         unsigned int addr;
    116         for (addr = 0; addr < KERNEL_SIZE; addr += PAGE_SIZE) {
    117                 void *pa = ofw_translate(KERNEL_START + addr);
    118                 fix_overlap(KERNEL_START + addr, &pa, "Kernel image", &top);
    119                 trans[addr >> PAGE_WIDTH] = pa;
     120        unsigned int top = ALIGN_UP(KERNEL_SIZE, PAGE_SIZE) + ALIGN_UP(INIT_SIZE, PAGE_SIZE);
     121        unsigned int kernel_pages = ALIGN_UP(KERNEL_SIZE, PAGE_SIZE) >> PAGE_WIDTH;
     122        unsigned int init_pages = ALIGN_UP(INIT_SIZE, PAGE_SIZE) >> PAGE_WIDTH;
     123       
     124        unsigned int i;
     125       
     126        for (i = 0; i < kernel_pages; i++) {
     127                void *pa = ofw_translate(KERNEL_START + (i << PAGE_WIDTH));
     128                fix_overlap(KERNEL_START + (i << PAGE_WIDTH), &pa, "Kernel image", &top);
     129                trans[i] = pa;
     130        }
     131       
     132        for (i = 0; i < init_pages; i++) {
     133                void *pa = ofw_translate(INIT_START + (i << PAGE_WIDTH));
     134                fix_overlap(INIT_START + (i << PAGE_WIDTH), &pa, "Init image", &top);
     135                trans[kernel_pages + i] = pa;
     136                if (i == 0) {
     137                        bootinfo.init.addr = (void *) ((kernel_pages + i) << PAGE_WIDTH);
     138                        bootinfo.init.size = INIT_SIZE;
     139                }
    120140        }
    121141       
     
    125145       
    126146        printf("\nBooting the kernel...\n");
    127         jump_to_kernel(bootinfo_pa, sizeof(bootinfo), trans_pa, KERNEL_SIZE, fb, real_mode_pa);
     147        jump_to_kernel(bootinfo_pa, sizeof(bootinfo), trans_pa, (kernel_pages + init_pages) << PAGE_WIDTH, fb, real_mode_pa);
    128148}
  • arch/ppc32/loader/main.h

    rab4ac14 r63f5cd6  
    4040
    4141typedef struct {
     42        void *addr;
     43        unsigned int size;
     44} utask_t;
     45
     46typedef struct {
     47        utask_t init;
    4248        memmap_t memmap;
    4349        screen_t screen;
     
    4652extern int _binary_____________kernel_kernel_bin_start;
    4753extern int _binary_____________kernel_kernel_bin_end;
     54
     55extern int _binary_____________uspace_init_init_start;
     56extern int _binary_____________uspace_init_init_end;
     57
    4858extern void start(void);
    4959extern void bootstrap(void);
Note: See TracChangeset for help on using the changeset viewer.