Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 3398 → Rev 3399

/trunk/boot/arch/sparc64/Makefile.inc
37,6 → 37,7
cp arch/$(ARCH)/silo/README arch/$(ARCH)/silo/COPYING arch/$(ARCH)/silo/silo.conf $(TMP)/boot
cp arch/$(ARCH)/loader/image.boot $(TMP)/HelenOS/image.boot
gzip -f $(TMP)/HelenOS/image.boot
cp arch/$(ARCH)/loader/initrd.img $(TMP)/HelenOS/initrd.img
mkisofs -f -G $(TMP)/boot/isofs.b -B ... -r -o $(BASE)/image.iso $(TMP)/
 
depend:
/trunk/boot/arch/sparc64/loader/main.c
64,6 → 64,11
 
void bootstrap(void)
{
void *base = (void *) KERNEL_VIRTUAL_ADDRESS;
void *balloc_base;
unsigned int top = 0;
int i, j;
 
version_print();
init_components(components);
91,6 → 96,13
if (silo_ramdisk_image) {
silo_ramdisk_image += bootinfo.physmem_start;
silo_ramdisk_image -= 0x400000;
/* Install 1:1 mapping for the ramdisk. */
if (ofw_map((void *)((uintptr_t)silo_ramdisk_image),
(void *)((uintptr_t)silo_ramdisk_image),
silo_ramdisk_size, -1) != 0) {
printf("Failed to map ramdisk.\n");
halt();
}
}
printf("\nSystem info\n");
101,20 → 113,73
printf(" kernel entry point at %P\n", KERNEL_VIRTUAL_ADDRESS);
printf(" %P: boot info structure\n", &bootinfo);
unsigned int i;
for (i = 0; i < COMPONENTS; i++)
/*
* Figure out destination address for each component.
* In this phase, we don't copy the components yet because we want to
* to be careful not to overwrite anything, especially the components
* which haven't been copied yet.
*/
bootinfo.taskmap.count = 0;
for (i = 0; i < COMPONENTS; i++) {
printf(" %P: %s image (size %d bytes)\n", components[i].start,
components[i].name, components[i].size);
top = ALIGN_UP(top, PAGE_SIZE);
if (i > 0) {
if (bootinfo.taskmap.count == TASKMAP_MAX_RECORDS) {
printf("Skipping superfluous components.\n");
break;
}
bootinfo.taskmap.tasks[bootinfo.taskmap.count].addr =
base + top;
bootinfo.taskmap.tasks[bootinfo.taskmap.count].size =
components[i].size;
bootinfo.taskmap.count++;
}
top += components[i].size;
}
 
void * base = (void *) KERNEL_VIRTUAL_ADDRESS;
unsigned int top = 0;
j = bootinfo.taskmap.count - 1; /* do not consider ramdisk */
 
printf("\nCopying components\n");
bootinfo.taskmap.count = 0;
for (i = 0; i < COMPONENTS; i++) {
printf(" %s...", components[i].name);
if (silo_ramdisk_image) {
/* Treat the ramdisk as the last bootinfo task. */
if (bootinfo.taskmap.count == TASKMAP_MAX_RECORDS) {
printf("Skipping ramdisk.\n");
goto skip_ramdisk;
}
top = ALIGN_UP(top, PAGE_SIZE);
bootinfo.taskmap.tasks[bootinfo.taskmap.count].addr =
base + top;
bootinfo.taskmap.tasks[bootinfo.taskmap.count].size =
silo_ramdisk_size;
bootinfo.taskmap.count++;
printf("\nCopying ramdisk...");
/*
* Claim and map the whole ramdisk as it may exceed the area
* given to us by SILO.
*/
(void) ofw_claim_phys(base + top, silo_ramdisk_size);
(void) ofw_map(base + top, base + top, silo_ramdisk_size, -1);
/*
* FIXME If the source and destination overlap, it may be
* desirable to copy in reverse order, depending on how the two
* regions overlap.
*/
memcpy(base + top, (void *)((uintptr_t)silo_ramdisk_image),
silo_ramdisk_size);
printf("done.\n");
top += silo_ramdisk_size;
}
skip_ramdisk:
 
/*
* Now we can proceed to copy the components. We do it in reverse order
* so that we don't overwrite anything even if the components overlap
* with base.
*/
printf("\nCopying bootinfo tasks\n");
for (i = COMPONENTS - 1; i > 0; i--, j--) {
printf(" %s...", components[i].name);
 
/*
* At this point, we claim the physical memory that we are
* going to use. We should be safe in case of the virtual
122,30 → 187,34
* SPARC binding, should restrict its use of virtual memory
* to addresses from [0xffd00000; 0xffefffff] and
* [0xfe000000; 0xfeffffff].
*
* XXX We don't map this piece of memory. We simply rely on
* SILO to have it done for us already in this case.
*/
(void) ofw_claim_phys(bootinfo.physmem_start + base + top,
(void) ofw_claim_phys(bootinfo.physmem_start +
bootinfo.taskmap.tasks[j].addr,
ALIGN_UP(components[i].size, PAGE_SIZE));
memcpy(base + top, components[i].start, components[i].size);
if (i > 0) {
bootinfo.taskmap.tasks[bootinfo.taskmap.count].addr =
base + top;
bootinfo.taskmap.tasks[bootinfo.taskmap.count].size =
components[i].size;
bootinfo.taskmap.count++;
}
top += components[i].size;
memcpy((void *)bootinfo.taskmap.tasks[j].addr,
components[i].start, components[i].size);
printf("done.\n");
}
 
printf("\nCopying kernel...");
(void) ofw_claim_phys(bootinfo.physmem_start + base,
ALIGN_UP(components[0].size, PAGE_SIZE));
memcpy(base, components[0].start, components[0].size);
printf("done.\n");
 
/*
* Claim the physical memory for the boot allocator.
* Claim and map the physical memory for the boot allocator.
* Initialize the boot allocator.
*/
(void) ofw_claim_phys(bootinfo.physmem_start +
base + ALIGN_UP(top, PAGE_SIZE), BALLOC_MAX_SIZE);
balloc_init(&bootinfo.ballocs, ALIGN_UP(((uintptr_t) base) + top,
PAGE_SIZE));
balloc_base = base + ALIGN_UP(top, PAGE_SIZE);
(void) ofw_claim_phys(bootinfo.physmem_start + balloc_base,
BALLOC_MAX_SIZE);
(void) ofw_map(balloc_base, balloc_base, BALLOC_MAX_SIZE, -1);
balloc_init(&bootinfo.ballocs, (uintptr_t)balloc_base);
 
printf("\nCanonizing OpenFirmware device tree...");
bootinfo.ofw_root = ofw_tree_build();
/trunk/boot/arch/sparc64/loader/Makefile
114,8 → 114,8
 
-include Makefile.depend
 
image.boot: depend _components.h _link.ld $(COMPONENT_OBJECTS) initrd.o $(OBJECTS)
$(LD) -Map image.map -no-check-sections -N -T _link.ld $(COMPONENT_OBJECTS) initrd.o $(OBJECTS) -o $@
image.boot: depend _components.h _link.ld $(COMPONENT_OBJECTS) $(OBJECTS)
$(LD) -Map image.map -no-check-sections -N -T _link.ld $(COMPONENT_OBJECTS) $(OBJECTS) -o $@
 
depend:
-makedepend $(DEFS) $(CFLAGS) -f - $(SOURCES) > Makefile.depend 2> /dev/null
124,7 → 124,7
-for task in $(RD_TASKS) ; do \
rm -f $(USPACEDIR)/dist/sbin/`basename $$task` ; \
done
-rm -f _components.h _components.c _link.ld $(COMPONENT_OBJECTS) initrd.o $(OBJECTS) initrd.img image.boot image.map image.disasm Makefile.depend
-rm -f _components.h _components.c _link.ld $(COMPONENT_OBJECTS) $(OBJECTS) initrd.img image.boot image.map image.disasm Makefile.depend
 
_components.h _components.c _link.ld $(COMPONENT_OBJECTS) initrd.o: $(COMPONENTS) $(RD_TASKS) _link.ld.in
for task in $(RD_TASKS) ; do \
138,7 → 138,7
endif
../../../../tools/mkhord.py 16384 initrd.fs initrd.img
rm initrd.fs
../../../tools/pack.py $(OBJCOPY) $(BFD_NAME) $(BFD_ARCH) 1 "unsigned long" $(COMPONENTS) ./initrd.img
../../../tools/pack.py $(OBJCOPY) $(BFD_NAME) $(BFD_ARCH) 1 "unsigned long" $(COMPONENTS)
 
%.o: %.S
$(CC) $(DEFS) $(CFLAGS) -D__ASM__ -c $< -o $@
/trunk/boot/arch/sparc64/silo/silo.conf
1,3 → 1,4
timeout = 0
image = /HelenOS/image.boot.gz
label = HelenOS
initrd = /HelenOS/initrd.img