mirror of
https://github.com/corda/corda.git
synced 2025-03-19 18:45:28 +00:00
write out bootimage directly from the bootimage-generator, eliminating one of the steps in a custom bootimage build
This commit is contained in:
parent
9cbd67ec61
commit
8c0ef382f8
13
makefile
13
makefile
@ -576,10 +576,7 @@ bootimage-generator-objects = \
|
||||
$(call cpp-objects,$(bootimage-generator-sources),$(src),$(build))
|
||||
bootimage-generator = $(build)/bootimage-generator
|
||||
|
||||
bootimage-bin = $(build)/bootimage.bin
|
||||
bootimage-object = $(build)/bootimage-bin.o
|
||||
|
||||
codeimage-bin = $(build)/codeimage.bin
|
||||
codeimage-object = $(build)/codeimage-bin.o
|
||||
|
||||
ifeq ($(bootimage),true)
|
||||
@ -910,14 +907,8 @@ $(static-library): $(vm-objects) $(classpath-objects) $(vm-heapwalk-objects) \
|
||||
$(ar) cru $(@) $(^)
|
||||
$(ranlib) $(@)
|
||||
|
||||
$(bootimage-bin): $(bootimage-generator)
|
||||
$(<) $(classpath-build) $(@) $(codeimage-object)
|
||||
|
||||
$(bootimage-object): $(bootimage-bin) $(converter)
|
||||
@echo "creating $(@)"
|
||||
$(converter) $(<) $(@) _binary_bootimage_bin_start \
|
||||
_binary_bootimage_bin_end $(platform) $(arch) $(pointer-size) \
|
||||
writable
|
||||
$(bootimage-object) $(codeimage-object): $(bootimage-generator)
|
||||
$(<) $(classpath-build) $(bootimage-object) $(codeimage-object)
|
||||
|
||||
executable-objects = $(vm-objects) $(classpath-objects) $(driver-object) \
|
||||
$(vm-heapwalk-objects) $(boot-object) $(vm-classpath-objects) \
|
||||
|
14
readme.txt
14
readme.txt
@ -557,19 +557,7 @@ Step 6: Build the boot and code images.
|
||||
$ ../build/linux-i386-bootimage/bootimage-generator stage2 \
|
||||
bootimage.bin codeimage.bin
|
||||
|
||||
Step 7: Make an object file out of the boot and code images.
|
||||
|
||||
$ ../build/linux-i386-bootimage/binaryToObject \
|
||||
bootimage.bin bootimage-bin.o \
|
||||
_binary_bootimage_bin_start _binary_bootimage_bin_end \
|
||||
linux i386 8 writable
|
||||
|
||||
$ ../build/linux-i386-bootimage/binaryToObject \
|
||||
codeimage.bin codeimage-bin.o \
|
||||
_binary_codeimage_bin_start _binary_codeimage_bin_end \
|
||||
linux i386 8 executable
|
||||
|
||||
Step 8: Write a driver which starts the VM and runs the desired main
|
||||
Step 7: Write a driver which starts the VM and runs the desired main
|
||||
method. Note the bootimageBin function, which will be called by the
|
||||
VM to get a handle to the embedded boot image. We tell the VM about
|
||||
this function via the "avian.bootimage" property.
|
||||
|
@ -1604,6 +1604,8 @@ writeBootImage2(Thread* t, OutputStream* bootimageOutput, OutputStream* codeOutp
|
||||
image->bootClassCount, image->stringCount, image->callCount,
|
||||
image->heapSize, image->codeSize);
|
||||
|
||||
Buffer bootimageData;
|
||||
|
||||
if (true) {
|
||||
{ BootImage targetImage;
|
||||
|
||||
@ -1620,13 +1622,13 @@ writeBootImage2(Thread* t, OutputStream* bootimageOutput, OutputStream* codeOutp
|
||||
#include "bootimage-fields.cpp"
|
||||
#undef THUNK_FIELD
|
||||
|
||||
bootimageOutput->writeChunk(&targetImage, sizeof(BootImage));
|
||||
bootimageData.write(&targetImage, sizeof(BootImage));
|
||||
}
|
||||
|
||||
bootimageOutput->writeChunk(bootClassTable, image->bootClassCount * sizeof(unsigned));
|
||||
bootimageOutput->writeChunk(appClassTable, image->appClassCount * sizeof(unsigned));
|
||||
bootimageOutput->writeChunk(stringTable, image->stringCount * sizeof(unsigned));
|
||||
bootimageOutput->writeChunk(callTable, image->callCount * sizeof(unsigned) * 2);
|
||||
bootimageData.write(bootClassTable, image->bootClassCount * sizeof(unsigned));
|
||||
bootimageData.write(appClassTable, image->appClassCount * sizeof(unsigned));
|
||||
bootimageData.write(stringTable, image->stringCount * sizeof(unsigned));
|
||||
bootimageData.write(callTable, image->callCount * sizeof(unsigned) * 2);
|
||||
|
||||
unsigned offset = sizeof(BootImage)
|
||||
+ (image->bootClassCount * sizeof(unsigned))
|
||||
@ -1636,13 +1638,13 @@ writeBootImage2(Thread* t, OutputStream* bootimageOutput, OutputStream* codeOutp
|
||||
|
||||
while (offset % TargetBytesPerWord) {
|
||||
uint8_t c = 0;
|
||||
bootimageOutput->write(c);
|
||||
bootimageData.write(&c, 1);
|
||||
++ offset;
|
||||
}
|
||||
|
||||
bootimageOutput->writeChunk(heapMap, pad(heapMapSize(image->heapSize), TargetBytesPerWord));
|
||||
bootimageData.write(heapMap, pad(heapMapSize(image->heapSize), TargetBytesPerWord));
|
||||
|
||||
bootimageOutput->writeChunk(heap, pad(image->heapSize, TargetBytesPerWord));
|
||||
bootimageData.write(heap, pad(image->heapSize, TargetBytesPerWord));
|
||||
|
||||
// fwrite(code, pad(image->codeSize, TargetBytesPerWord), 1, codeOutput);
|
||||
|
||||
@ -1653,6 +1655,13 @@ writeBootImage2(Thread* t, OutputStream* bootimageOutput, OutputStream* codeOutp
|
||||
// return false;
|
||||
// }
|
||||
|
||||
SymbolInfo bootimageSymbols[] = {
|
||||
SymbolInfo(0, "_binary_bootimage_bin_start"),
|
||||
SymbolInfo(bootimageData.length, "_binary_bootimage_bin_end")
|
||||
};
|
||||
|
||||
platform->writeObject(bootimageOutput, Slice<SymbolInfo>(bootimageSymbols, 2), Slice<const uint8_t>(bootimageData.data, bootimageData.length), Platform::Writable, TargetBytesPerWord);
|
||||
|
||||
compilationHandler.symbols.add(SymbolInfo(0, strdup("_binary_codeimage_bin_start")));
|
||||
compilationHandler.symbols.add(SymbolInfo(image->codeSize, strdup("_binary_codeimage_bin_end")));
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user