Subversion Repositories HelenOS-historic

Compare Revisions

Ignore whitespace Rev 1218 → Rev 1219

/boot/trunk/arch/ppc32/Makefile.inc
28,12 → 28,12
 
build: image.boot
 
image.boot: kernel
make -C arch/$(ARCH)/loader COMPILER=$(COMPILER) KERNEL=../../../$(KERNELDIR)/kernel.bin
image.boot: kernel uspace
make -C arch/$(ARCH)/loader COMPILER=$(COMPILER) KERNEL=../../../$(KERNELDIR)/kernel.bin INIT=../../../$(USPACEDIR)/init/init
cp arch/$(ARCH)/loader/image.boot image.boot
 
clean: clean_kernel
clean: clean_kernel clean_uspace
make -C arch/$(ARCH)/loader clean
-rm -f image.boot
 
arch_distclean: distclean_kernel
arch_distclean: distclean_kernel distclean_uspace
/boot/trunk/arch/ppc32/loader/main.c
34,6 → 34,10
#define KERNEL_END ((void *) &_binary_____________kernel_kernel_bin_end)
#define KERNEL_SIZE ((unsigned int) KERNEL_END - (unsigned int) KERNEL_START)
 
#define INIT_START ((void *) &_binary_____________uspace_init_init_start)
#define INIT_END ((void *) &_binary_____________uspace_init_init_end)
#define INIT_SIZE ((unsigned int) INIT_END - (unsigned int) INIT_START)
 
#define HEAP_GAP 1024000
 
bootinfo_t bootinfo;
79,6 → 83,7
printf("\nHelenOS PPC Bootloader\n");
check_align(KERNEL_START, "Kernel image");
check_align(INIT_START, "Init image");
check_align(&real_mode, "Bootstrap trampoline");
check_align(&trans, "Translation table");
107,22 → 112,37
printf("\nMemory statistics (total %d MB)\n", bootinfo.memmap.total >> 20);
printf(" kernel image at %L (size %d bytes)\n", KERNEL_START, KERNEL_SIZE);
printf(" boot info at %L (physical %L)\n", &bootinfo, bootinfo_pa);
printf(" init image at %L (size %d bytes)\n", INIT_START, INIT_SIZE);
printf(" boot info structure at %L (physical %L)\n", &bootinfo, bootinfo_pa);
printf(" bootstrap trampoline at %L (physical %L)\n", &real_mode, real_mode_pa);
printf(" translation table at %L (physical %L)\n", &trans, trans_pa);
unsigned int top = ALIGN_UP(KERNEL_SIZE, PAGE_SIZE);
unsigned int addr;
for (addr = 0; addr < KERNEL_SIZE; addr += PAGE_SIZE) {
void *pa = ofw_translate(KERNEL_START + addr);
fix_overlap(KERNEL_START + addr, &pa, "Kernel image", &top);
trans[addr >> PAGE_WIDTH] = pa;
unsigned int top = ALIGN_UP(KERNEL_SIZE, PAGE_SIZE) + ALIGN_UP(INIT_SIZE, PAGE_SIZE);
unsigned int kernel_pages = ALIGN_UP(KERNEL_SIZE, PAGE_SIZE) >> PAGE_WIDTH;
unsigned int init_pages = ALIGN_UP(INIT_SIZE, PAGE_SIZE) >> PAGE_WIDTH;
unsigned int i;
for (i = 0; i < kernel_pages; i++) {
void *pa = ofw_translate(KERNEL_START + (i << PAGE_WIDTH));
fix_overlap(KERNEL_START + (i << PAGE_WIDTH), &pa, "Kernel image", &top);
trans[i] = pa;
}
for (i = 0; i < init_pages; i++) {
void *pa = ofw_translate(INIT_START + (i << PAGE_WIDTH));
fix_overlap(INIT_START + (i << PAGE_WIDTH), &pa, "Init image", &top);
trans[kernel_pages + i] = pa;
if (i == 0) {
bootinfo.init.addr = (void *) ((kernel_pages + i) << PAGE_WIDTH);
bootinfo.init.size = INIT_SIZE;
}
}
fix_overlap(&real_mode, &real_mode_pa, "Bootstrap trampoline", &top);
fix_overlap(&trans, &trans_pa, "Translation table", &top);
fix_overlap(&bootinfo, &bootinfo_pa, "Boot info", &top);
printf("\nBooting the kernel...\n");
jump_to_kernel(bootinfo_pa, sizeof(bootinfo), trans_pa, KERNEL_SIZE, fb, real_mode_pa);
jump_to_kernel(bootinfo_pa, sizeof(bootinfo), trans_pa, (kernel_pages + init_pages) << PAGE_WIDTH, fb, real_mode_pa);
}
/boot/trunk/arch/ppc32/loader/_link.ld
23,6 → 23,9
*(COMMON); /* global variables */
. = ALIGN(4096);
*(.image);
*(.kernel_image);
. = ALIGN(4096);
*(.init_image);
}
}
/boot/trunk/arch/ppc32/loader/main.h
39,6 → 39,12
#define ALIGN_UP(addr, align) (((addr) + ((align) - 1)) & ~((align) - 1))
 
typedef struct {
void *addr;
unsigned int size;
} utask_t;
 
typedef struct {
utask_t init;
memmap_t memmap;
screen_t screen;
} bootinfo_t;
45,6 → 51,10
 
extern int _binary_____________kernel_kernel_bin_start;
extern int _binary_____________kernel_kernel_bin_end;
 
extern int _binary_____________uspace_init_init_start;
extern int _binary_____________uspace_init_init_end;
 
extern void start(void);
extern void bootstrap(void);
 
/boot/trunk/arch/ppc32/loader/Makefile
64,18 → 64,21
 
-include Makefile.depend
 
image.boot: depend $(OBJECTS) kernel.o
$(LD) -no-check-sections -N -T _link.ld $(OBJECTS) kernel.o -o $@
image.boot: depend $(OBJECTS) kernel.o init.o
$(LD) -no-check-sections -N -T _link.ld $(OBJECTS) kernel.o init.o -o $@
 
depend:
-makedepend $(DEFS) $(CFLAGS) -f - $(SOURCES) > Makefile.depend 2> /dev/null
 
clean:
-rm -f $(OBJECTS) image.boot kernel.o Makefile.depend
-rm -f $(OBJECTS) image.boot kernel.o init.o Makefile.depend
 
kernel.o: $(KERNEL)
$(OBJCOPY) -I binary -O elf32-powerpc -B powerpc:common --rename-section .data=.image $(KERNEL) $@
$(OBJCOPY) -I binary -O elf32-powerpc -B powerpc:common --rename-section .data=.kernel_image $(KERNEL) $@
 
init.o: $(INIT)
$(OBJCOPY) -I binary -O elf32-powerpc -B powerpc:common --rename-section .data=.init_image $(INIT) $@
 
%.o: %.S
$(CC) $(DEFS) $(CFLAGS) -D__ASM__ -c $< -o $@