Changeset 960f8476 in mainline
- Timestamp:
- 2008-05-30T14:22:58Z (17 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- afb1e35
- Parents:
- 136edca
- Location:
- boot
- Files:
-
- 3 added
- 2 deleted
- 10 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
boot/arch/arm32/loader/Makefile
r136edca r960f8476 33 33 # 34 34 35 BFD = elf32-littlearm36 35 BFD_NAME = elf32-littlearm 37 36 BFD_ARCH = arm … … 112 111 -rm -f _components.h _components.c _link.ld $(COMPONENT_OBJECTS) $(OBJECTS) image.boot Makefile.depend 113 112 114 _components.h _components.c _link.ld $(COMPONENT_OBJECTS): $(COMPONENTS) 115 ../../../tools/pack.py $(OBJCOPY) $(BFD_NAME) $(BFD ) $(BFD_ARCH) 4096$(COMPONENTS)113 _components.h _components.c _link.ld $(COMPONENT_OBJECTS): $(COMPONENTS) _link.ld.in 114 ../../../tools/pack.py $(OBJCOPY) $(BFD_NAME) $(BFD_ARCH) 4096 "unsigned int" $(COMPONENTS) 116 115 117 116 %.o: %.S -
boot/arch/arm32/loader/_link.ld.in
r136edca r960f8476 1 OUTPUT_FORMAT("elf32-littlearm") 2 ENTRY(start) 3 4 SECTIONS { 1 5 .boot 0x0: AT (0) { 2 6 *(BOOTSTRAP); … … 16 20 . = 0x4000; 17 21 *(PT); /* page table placed at 0x4000 */ 22 [[COMPONENTS]] 23 } 24 } -
boot/arch/ia64/loader/Makefile
r136edca r960f8476 33 33 # 34 34 35 BFD_NAME = elf64-ia64-little 36 BFD_ARCH = ia64 35 37 TARGET = ia64-pc-linux-gnu 36 38 TOOLCHAIN_DIR = /usr/local/ia64/bin … … 78 80 ../../../generic/string.c \ 79 81 ../../../genarch/balloc.c \ 82 _components.c \ 80 83 asm.S \ 81 84 boot.S … … 96 99 $(USPACEDIR)/app/klog/klog 97 100 98 99 101 OBJECTS := $(addsuffix .o,$(basename $(SOURCES))) 100 102 COMPONENT_OBJECTS := $(addsuffix .o,$(basename $(notdir $(COMPONENTS)))) … … 106 108 -include Makefile.depend 107 109 108 109 110 hello.efi: image.boot 110 111 make -C gefi/HelenOS PREFIX=$(GEFI_PREFIX) … … 114 115 115 116 image.boot: depend _components.h _link.ld $(COMPONENT_OBJECTS) $(OBJECTS) 116 $(LD) -Map boot.map -no-check-sections -N -T _link.ld $(COMPONENT_OBJECTS) $(OBJECTS) -o $@117 $(LD) -Map image.map -no-check-sections -N -T _link.ld $(COMPONENT_OBJECTS) $(OBJECTS) -o $@ 117 118 118 119 depend: … … 120 121 121 122 clean: 122 -rm -f _components.h _ link.ld $(COMPONENT_OBJECTS) $(OBJECTS) image.boot boot.disasm Makefile.depend123 -rm -f _components.h _components.c _link.ld $(COMPONENT_OBJECTS) $(OBJECTS) image.boot image.map image.disasm Makefile.depend 123 124 make -C gefi/HelenOS clean 124 125 125 _components.h _ link.ld $(COMPONENT_OBJECTS): $(COMPONENTS)126 . /pack $(IMAGE) $(OBJCOPY)$(COMPONENTS)126 _components.h _components.c _link.ld $(COMPONENT_OBJECTS): $(COMPONENTS) _link.ld.in 127 ../../../tools/pack.py $(OBJCOPY) $(BFD_NAME) $(BFD_ARCH) 16384 "unsigned long" $(COMPONENTS) 127 128 128 129 %.o: %.S … … 133 134 134 135 disasm: image.boot 135 $(OBJDUMP) -d image.boot > boot.disasm136 $(OBJDUMP) -d image.boot > image.disasm -
boot/arch/mips32/loader/Makefile
r136edca r960f8476 34 34 35 35 ifeq ($(IMAGE),binary) 36 BFD= binary36 LD_IN = binary 37 37 endif 38 38 ifeq ($(IMAGE),ecoff) 39 BFD = ecoff-littlemips39 LD_IN = ecoff 40 40 endif 41 41 BFD_NAME = elf32-tradlittlemips … … 109 109 110 110 clean: 111 -rm -f _components.h _components.c _link.ld $(COMPONENT_OBJECTS) $(OBJECTS) image.boot Makefile.depend111 -rm -f _components.h _components.c _link.ld _link.ld.in $(COMPONENT_OBJECTS) $(OBJECTS) image.boot Makefile.depend 112 112 113 _components.h _components.c _link.ld $(COMPONENT_OBJECTS): $(COMPONENTS) 114 ../../../tools/pack.py $(OBJCOPY) $(BFD_NAME) $(BFD) $(BFD_ARCH) 4096 $(COMPONENTS) 113 _components.h _components.c _link.ld $(COMPONENT_OBJECTS): $(COMPONENTS) _link.ld.in 114 ../../../tools/pack.py $(OBJCOPY) $(BFD_NAME) $(BFD_ARCH) 4096 "unsigned int" $(COMPONENTS) 115 116 _link.ld.in: _link.ld.in.$(LD_IN) 117 cp $< $@ 115 118 116 119 %.o: %.S -
boot/arch/mips32/loader/_link.ld.in.binary
r136edca r960f8476 1 OUTPUT_FORMAT("binary") 2 ENTRY(start) 3 4 SECTIONS { 1 5 .boot 0xbfc00000: AT (0) { 2 6 *(BOOTSTRAP); … … 13 17 *(COMMON); /* global variables */ 14 18 *(.reginfo); 19 [[COMPONENTS]] 20 } 21 } -
boot/arch/ppc32/loader/Makefile
r136edca r960f8476 33 33 # 34 34 35 BFD = elf32-powerpc36 35 BFD_NAME = elf32-powerpc 37 36 BFD_ARCH = powerpc:common … … 107 106 -rm -f _components.h _components.c _link.ld $(COMPONENT_OBJECTS) $(OBJECTS) image.boot Makefile.depend 108 107 109 _components.h _components.c _link.ld $(COMPONENT_OBJECTS): $(COMPONENTS) 110 ../../../tools/pack.py $(OBJCOPY) $(BFD_NAME) $(BFD ) $(BFD_ARCH) 4096$(COMPONENTS)108 _components.h _components.c _link.ld $(COMPONENT_OBJECTS): $(COMPONENTS) _link.ld.in 109 ../../../tools/pack.py $(OBJCOPY) $(BFD_NAME) $(BFD_ARCH) 4096 "unsigned int" $(COMPONENTS) 111 110 112 111 %.o: %.S -
boot/arch/ppc32/loader/_link.ld.in
r136edca r960f8476 1 OUTPUT_FORMAT("elf32-powerpc") 2 OUTPUT_ARCH(powerpc:common) 3 ENTRY(start) 4 5 SECTIONS { 1 6 .boot 0x10000000: AT (0) { 2 7 *(BOOTSTRAP); … … 12 17 *(.bss); /* uninitialized static variables */ 13 18 *(COMMON); /* global variables */ 19 [[COMPONENTS]] 20 } 21 } -
boot/arch/ppc64/loader/Makefile
r136edca r960f8476 33 33 # 34 34 35 BFD = elf64-powerpc36 35 BFD_NAME = elf64-powerpc 37 36 BFD_ARCH = powerpc:common64 … … 107 106 -rm -f _components.h _components.c _link.ld $(COMPONENT_OBJECTS) $(OBJECTS) image.boot Makefile.depend 108 107 109 _components.h _components.c _link.ld $(COMPONENT_OBJECTS): $(COMPONENTS) 110 ../../../tools/pack.py $(OBJCOPY) $(BFD_NAME) $(BFD ) $(BFD_ARCH) 4096$(COMPONENTS)108 _components.h _components.c _link.ld $(COMPONENT_OBJECTS): $(COMPONENTS) _link.ld.in 109 ../../../tools/pack.py $(OBJCOPY) $(BFD_NAME) $(BFD_ARCH) 4096 "unsigned long" $(COMPONENTS) 111 110 112 111 %.o: %.S -
boot/arch/ppc64/loader/_link.ld.in
r136edca r960f8476 1 OUTPUT_FORMAT("elf64-powerpc") 2 OUTPUT_ARCH(powerpc:common64) 3 ENTRY(start) 4 5 SECTIONS { 1 6 .boot 0x0000000010000000: AT (0) { 2 7 *(BOOTSTRAP); … … 14 19 *(.bss); /* uninitialized static variables */ 15 20 *(COMMON); /* global variables */ 21 [[COMPONENTS]] 22 } 23 24 /DISCARD/ : { 25 *(*); 26 } 27 } -
boot/arch/sparc64/loader/Makefile
r136edca r960f8476 33 33 # 34 34 35 BFD_NAME = elf64-sparc 36 BFD_ARCH = sparc 35 37 TARGET = sparc64-linux-gnu 36 38 TOOLCHAIN_DIR = /usr/local/sparc64/bin … … 64 66 SOURCES = \ 65 67 main.c \ 68 _components.c \ 66 69 ../../../generic/printf.c \ 67 70 ../../../generic/string.c \ … … 104 107 105 108 clean: 106 -rm -f _components.h _ link.ld $(COMPONENT_OBJECTS) $(OBJECTS) image.boot boot.disasm Makefile.depend109 -rm -f _components.h _components.c _link.ld $(COMPONENT_OBJECTS) $(OBJECTS) image.boot image.map image.disasm Makefile.depend 107 110 108 _components.h _ link.ld $(COMPONENT_OBJECTS): $(COMPONENTS)109 . /pack $(IMAGE) $(OBJCOPY)$(COMPONENTS)111 _components.h _components.c _link.ld $(COMPONENT_OBJECTS): $(COMPONENTS) _link.ld.in 112 ../../../tools/pack.py $(OBJCOPY) $(BFD_NAME) $(BFD_ARCH) 1 "unsigned long" $(COMPONENTS) 110 113 111 114 %.o: %.S … … 116 119 117 120 disasm: image.boot 118 $(OBJDUMP) -d image.boot > boot.disasm121 $(OBJDUMP) -d image.boot > image.disasm -
boot/tools/pack.py
r136edca r960f8476 37 37 def usage(prname): 38 38 "Print usage syntax" 39 print prname + " <OBJCOPY> <FORMAT> < OUTPUT_FORMAT> <ARCH> <ALIGNMENT>"39 print prname + " <OBJCOPY> <FORMAT> <ARCH> <ALIGNMENT> <UINTPTR>" 40 40 41 41 def main(): … … 44 44 return 45 45 46 if (not sys.argv[ 5].isdigit()):46 if (not sys.argv[4].isdigit()): 47 47 print "<ALIGNMENT> must be a number" 48 48 return 49 49 50 templatename = "_link.ld.in"51 workdir = os.getcwd()52 50 objcopy = sys.argv[1] 53 51 format = sys.argv[2] 54 output_format= sys.argv[3]55 a rch = sys.argv[4]56 align = int(sys.argv[5], 0)52 arch = sys.argv[3] 53 align = int(sys.argv[4], 0) 54 uintptr = sys.argv[5] 57 55 58 link = file("_link.ld", "w") 56 workdir = os.getcwd() 57 59 58 header = file("_components.h", "w") 60 59 data = file("_components.c", "w") 61 62 link.write("OUTPUT_FORMAT(\"" + output_format + "\")\n")63 link.write("OUTPUT_ARCH(" + arch + ")\n")64 link.write("ENTRY(start)\n\n")65 link.write("SECTIONS {\n")66 67 size = os.path.getsize(templatename)68 rd = 069 template = file(templatename, "r")70 71 while (rd < size):72 buf = template.read(4096)73 link.write(buf)74 rd += len(buf)75 76 template.close()77 78 link.write("\n")79 60 80 61 header.write("#ifndef ___COMPONENTS_H__\n") … … 86 67 87 68 cnt = 0 69 link = "" 88 70 for task in sys.argv[6:]: 89 71 basename = os.path.basename(task) … … 96 78 print task + " -> " + object 97 79 98 link.write("\t\t. = ALIGN(" + ("%d" % align) + ");\n") 99 link.write("\t\t*(." + plainname + "_image);\n\n") 80 if (align > 1): 81 link += "\t\t. = ALIGN(" + ("%d" % align) + ");\n" 82 83 link += "\t\t*(." + plainname + "_image);\n" 100 84 101 85 header.write("extern int " + symbol + "_start;\n") … … 103 87 header.write("#define " + macro + "_START ((void *) &" + symbol + "_start)\n") 104 88 header.write("#define " + macro + "_END ((void *) &" + symbol + "_end)\n") 105 header.write("#define " + macro + "_SIZE (( unsigned int) " + macro + "_END - (unsigned int) " + macro + "_START)\n\n")89 header.write("#define " + macro + "_SIZE ((" + uintptr + ") " + macro + "_END - (" + uintptr + ") " + macro + "_START)\n\n") 106 90 107 91 data.write("\tcomponents[" + ("%d" % cnt) + "].name = \"" + plainname + "\";\n") … … 119 103 os.chdir(workdir) 120 104 121 cnt = cnt +1105 cnt += 1 122 106 123 link.write("\t}\n")124 link.write("}\n")125 126 107 header.write("#define COMPONENTS " + ("%d" % cnt) + "\n\n") 127 108 header.write("typedef struct {\n") … … 129 110 header.write("\tvoid *start;\n") 130 111 header.write("\tvoid *end;\n") 131 header.write("\t unsigned intsize;\n")112 header.write("\t" + uintptr + " size;\n") 132 113 header.write("} component_t;\n\n") 133 114 header.write("extern void init_components(component_t *components);\n\n") … … 136 117 data.write("}\n") 137 118 138 link.close()139 119 header.close() 140 120 data.close() 121 122 linkname = "_link.ld" 123 link_in = file(linkname + ".in", "r") 124 template = link_in.read(os.path.getsize(linkname + ".in")) 125 link_in.close() 126 127 link_out = file(linkname, "w") 128 link_out.write(template.replace("[[COMPONENTS]]", link)) 129 link_out.close() 141 130 142 131 if __name__ == '__main__':
Note:
See TracChangeset
for help on using the changeset viewer.