Changeset 98975a8 in mainline
- Timestamp:
- 2019-08-17T12:49:43Z (5 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 5b586b9
- Parents:
- 643640a
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2019-06-28 16:06:30)
- git-committer:
- Jiří Zárevúcky <zarevucky.jiri@…> (2019-08-17 12:49:43)
- Files:
-
- 1 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
boot/Makefile.build
r643640a r98975a8 31 31 include Makefile.common 32 32 33 INCLUDES = -Igeneric/include -Iarch/$(KARCH)/include -Igenarch/include -I$(ROOT_PATH)/abi/arch/$(KARCH)/include -I$(ROOT_PATH)/abi/include34 OPTIMIZATION = 335 36 DEFS = -DBOOT -DRELEASE=$(RELEASE) "-DCOPYRIGHT=$(COPYRIGHT)" "-DNAME=$(NAME)" -D__$(BITS)_BITS__ -D__$(ENDIANESS)__37 38 LDFLAGS = -Wl,--fatal-warnings,--warn-common $(EXTRA_LDFLAGS)39 40 COMMON_CFLAGS = $(INCLUDES) -O$(OPTIMIZATION) -imacros $(CONFIG_HEADER) \41 -ffreestanding -nostdlib \42 -fexec-charset=UTF-8 -finput-charset=UTF-8 -fno-common \43 -fdebug-prefix-map=$(realpath $(ROOT_PATH))=. \44 -Wa,--fatal-warnings45 46 GCC_CFLAGS = -Wall -Wextra -Wno-unused-parameter -Wmissing-prototypes \47 -std=gnu99 -Werror-implicit-function-declaration -Wwrite-strings \48 -pipe49 50 CLANG_CFLAGS = -Wall -Wextra -Wno-unused-parameter -Wmissing-prototypes \51 -Werror-implicit-function-declaration -Wwrite-strings \52 -pipe -fno-stack-protector -fno-PIC53 54 ifeq ($(CONFIG_DEBUG),y)55 COMMON_CFLAGS += -Werror56 endif57 58 ifeq ($(CONFIG_LINE_DEBUG),y)59 COMMON_CFLAGS += -g60 endif61 62 ifeq ($(COMPILER),clang)63 CFLAGS = $(COMMON_CFLAGS) $(CLANG_CFLAGS) $(EXTRA_CFLAGS)64 else65 CFLAGS = $(COMMON_CFLAGS) $(GCC_CFLAGS) $(EXTRA_CFLAGS)66 endif67 68 OBJECTS := $(addsuffix .o,$(basename $(SOURCES)))69 DEPENDS := $(addsuffix .d,$(basename $(SOURCES)))70 71 33 ifeq ($(CONFIG_COMPRESSED_INIT),y) 72 34 COMPONENTS := $(addsuffix .gz, $(COMPONENTS)) … … 80 42 -include $(DEPENDS) 81 43 82 $(BOOT_OUTPUT): $(RAW) 83 $(OBJCOPY) -O $(BFD_OUTPUT) $< $@ 44 depend: $(PRE_DEPEND) 84 45 85 $(RAW): $(OBJECTS) $(LINK) 86 $(CC) $(CFLAGS) -Wl,-n $(LDFLAGS) -T $(LINK) -Wl,-M,-Map,$(MAP) -o $@ $(OBJECTS) 87 88 $(LINK): | depend 89 $(CC) $(DEFS) $(CFLAGS) -D__ASSEMBLER__ -D__LINKER__ -E -x c $(LINK).in | grep -v "^\#" > $(LINK) 90 91 %.o: %.s | depend 92 $(CC_JOB) -c -MD -MP $(DEFS) $(CFLAGS) 93 94 %.o: %.S | depend 95 $(CC_JOB) -c -MD -MP $(DEFS) $(CFLAGS) 96 97 %.o: %.c | depend 98 $(CC_JOB) -c -MD -MP $(DEFS) $(CFLAGS) 99 100 depend: $(PRE_DEPEND) 46 ../image.boot: ../build/dist/boot/image.boot 47 cp $< $@ 101 48 102 49 %.gz: % 103 50 gzip -n -k -9 -f $< 104 105 $(COMPS).tar: $(COMPONENTS)106 tar --mtime='2032-01-01 00:00:00' --group=0 --owner=0 --no-acls --no-selinux --no-xattrs --format=ustar --transform 's/.*\///g' -cvf $@ $^107 51 108 52 $(COMPS).o: $(COMPS).tar -
boot/Makefile.common
r643640a r98975a8 54 54 MKUIMAGE = $(TOOLS_PATH)/mkuimage.py 55 55 56 ifeq ($(PRECHECK),y)57 JOBFILE = $(TOOLS_PATH)/jobfile.py58 # NOTE: You must not change the order of arguments.59 CC_JOB = $(JOBFILE) $(JOB) $(CC) $< -o $@60 else61 CC_JOB = $(CC) $< -o $@62 endif63 64 56 DISTROOT = distroot 65 57 INITRD = initrd … … 102 94 BOOT_OUTPUT ?= $(ROOT_PATH)/image.boot 103 95 RAW ?= image.raw 104 JOB ?= image.job105 96 MAP ?= image.map 106 97 BUILD ?= Makefile.build -
boot/arch/abs32le/Makefile.inc
r643640a r98975a8 29 29 BOOT_OUTPUT = 30 30 RAW = 31 JOB =32 31 MAP = 33 32 BUILD = Makefile.empty -
boot/arch/amd64/Makefile.inc
r643640a r98975a8 27 27 # 28 28 29 POST_OUTPUT = $(ROOT_PATH)/image.iso30 29 BUILD = Makefile.empty 31 30 POSTBUILD = Makefile.empty 32 GRUB_LOADER = multiboot -
boot/arch/arm32/Makefile.inc
r643640a r98975a8 27 27 # 28 28 29 ifeq ($(MACHINE), gta02) 30 BOOT_OUTPUT = image.boot 31 POST_OUTPUT = $(ROOT_PATH)/uImage.bin 32 LADDR = 0x30008000 33 SADDR = 0x30008000 34 POSTBUILD = Makefile.uboot 35 endif 36 37 ifeq ($(MACHINE), $(filter $(MACHINE),beagleboardxm beaglebone)) 38 BOOT_OUTPUT = image.boot 39 POST_OUTPUT = $(ROOT_PATH)/uImage.bin 40 LADDR = 0x80000000 41 SADDR = 0x80000000 42 POSTBUILD = Makefile.uboot 43 endif 44 45 ifeq ($(MACHINE), raspberrypi) 46 BOOT_OUTPUT = image.boot 47 POST_OUTPUT = $(ROOT_PATH)/uImage.bin 48 LADDR = 0x00008000 49 SADDR = 0x00008000 50 POSTBUILD = Makefile.uboot 51 endif 52 53 BFD_NAME = elf32-littlearm 54 BFD_OUTPUT = $(BFD_NAME) 55 56 BITS = 32 57 ENDIANESS = LE 58 EXTRA_CFLAGS = -march=$(subst _,-,$(PROCESSOR_ARCH)) -mno-unaligned-access 59 60 SOURCES = \ 61 arch/$(BARCH)/src/asm.S \ 62 arch/$(BARCH)/src/eabi.S \ 63 arch/$(BARCH)/src/main.c \ 64 arch/$(BARCH)/src/mm.c \ 65 arch/$(BARCH)/src/putchar.c \ 66 $(COMPS).o \ 67 genarch/src/division.c \ 68 generic/src/memstr.c \ 69 generic/src/printf_core.c \ 70 generic/src/vprintf.c \ 71 generic/src/printf.c \ 72 generic/src/str.c \ 73 generic/src/version.c \ 74 generic/src/inflate.c \ 75 generic/src/gzip.c \ 76 generic/src/tar.c \ 77 generic/src/kernel.c \ 78 generic/src/payload.c 29 BUILD = Makefile.empty 30 POSTBUILD = Makefile.empty -
boot/meson.build
r643640a r98975a8 1 subdir('arch' / BARCH) 1 2 2 subdir('arch' / BARCH) 3 if BUILD 4 # Order matters. 5 modules = [ 'boot/kernel.elf' ] + rd_init + [ 'boot/initrd.img' ] 6 moddeps = [] 7 name_transform = '' 8 9 # Collect binary references in the correct order. 10 foreach m : modules 11 found = false 12 foreach bin : rd_init_binaries 13 if bin[1] == m 14 moddeps += bin[0] 15 found = true 16 17 _oldname = run_command(basename, bin[0].full_path(), check: true).stdout().strip() 18 _newname = run_command(basename, bin[1], check: true).stdout().strip() 19 20 name_transform += 's:.*/@0@:@1@:;'.format(_oldname, _newname) 21 break 22 endif 23 endforeach 24 25 if not found 26 error('Could not find dependency ' + m) 27 endif 28 endforeach 29 30 31 boot_include_dirs = include_directories( 32 'generic/include', 33 'arch'/BARCH/'include', 34 'genarch/include', 35 '../abi/arch'/BARCH/'include', 36 '../abi/include', 37 ) 38 39 boot_defs = [ 40 '-imacros', meson.source_root() / 'config.h', 41 '-D_HELENOS_SOURCE', 42 '-DBOOT', 43 '-DRELEASE=' + HELENOS_RELEASE, 44 '-DCOPYRIGHT=' + HELENOS_COPYRIGHT, 45 '-DNAME=' + HELENOS_NAME, 46 '-D__@0@_BITS__'.format(meson.get_cross_property('bits')), 47 ] 48 49 boot_c_args = arch_boot_c_args + boot_defs + [ 50 '-ffreestanding', 51 ] 52 53 boot_link_args = arch_boot_link_args + [ 54 '-nostdlib', 55 '-Wl,--nmagic', 56 '-T', meson.current_build_dir()/'_link.ld', 57 '-Wl,--no-gc-sections', 58 ] 59 60 if cc.get_id() == 'clang' 61 boot_c_args += [ 62 '-fno-stack-protector', 63 '-fno-PIC', 64 # '-mllvm', '-asm-macro-max-nesting-depth=1000', 65 ] 66 endif 67 68 # Preprocess linker script using C preprocessor. 69 boot_ldscript = custom_target('_link.ld', 70 input: 'arch'/KARCH/'_link.ld.in', 71 output: '_link.ld', 72 command: [ 73 cc.cmd_array(), 74 boot_c_args, 75 '-I' + meson.current_source_dir()/'arch'/KARCH/'include', 76 '-D__ASSEMBLER__', 77 '-D__LINKER__', 78 '-E', 79 '-P', 80 '-x', 'c', 81 '@INPUT@', 82 ], 83 capture: true, 84 ) 85 86 # Create empty object file. 87 boot_empty_o = custom_target('empty.o', 88 output: 'empty.o', 89 command: [ 90 cc.cmd_array(), 91 boot_c_args, 92 '-x', 'c', 93 '-c', 94 '-o', '@OUTPUT@', 95 '-', 96 ], 97 ) 98 99 boot_comps_tar = custom_target('components.tar', 100 input: moddeps, 101 output: 'components.tar', 102 command: [ tar, '--transform', name_transform ], 103 ) 104 105 # Add .payload section to the empty object. 106 boot_comps_o = custom_target('components.o', 107 output: 'components.o', 108 input: [ boot_comps_tar, boot_empty_o ], 109 command: [ 110 objcopy, 111 '--add-section', '.payload=@INPUT0@', 112 '@INPUT1@', 113 '@OUTPUT@', 114 ], 115 ) 116 117 boot_image_name = 'image.boot' 118 boot_image_map_path = meson.current_build_dir()/boot_image_name + '.map' 119 120 boot_elf = executable(boot_image_name + '.elf', boot_src, boot_comps_o, 121 include_directories: boot_include_dirs, 122 implicit_include_directories: false, 123 c_args: boot_c_args, 124 link_args: boot_c_args + boot_link_args + [ 125 '-Wl,-Map,' + boot_image_map_path, 126 ], 127 link_depends: boot_ldscript, 128 install: true, 129 install_dir: 'boot', 130 pie: false, 131 ) 132 133 if boot_image_format == 'elf' 134 boot_image = boot_elf 135 endif 136 137 if boot_image_format == 'binary' 138 # Some platforms can't ELF. 139 boot_image = custom_target(boot_image_name, 140 input: boot_elf, 141 output: boot_image_name, 142 command: [ objcopy, '-O', 'binary', '@INPUT@', '@OUTPUT@' ], 143 ) 144 endif 145 endif 146 147 if POSTBUILD == 'raw' 148 POST_INPUT = boot_image 149 endif 3 150 4 151 if POSTBUILD == 'grub' 5 152 subdir('grub') 6 153 endif 154 155 if POSTBUILD == 'uboot' 156 # TODO 157 error('unfinished') 158 endif 159 160 -
meson.build
r643640a r98975a8 19 19 mkarray = find_program('tools/mkarray_for_meson.sh') 20 20 objdump = find_program('objdump') 21 objcopy = find_program('objcopy') 21 22 sed = find_program('sed') 22 23 unzip = find_program('unzip') -
meson/arch/arm32/meson.build
r643640a r98975a8 22 22 arch_kernel_link_args = [ '-nostdlib', '-Wl,-z,max-page-size=0x1000' ] 23 23 arch_uspace_link_args = [ '-nostdlib', '-lgcc', '-Wl,-z,max-page-size=0x1000' ] 24 25 arch_boot_c_args = arch_kernel_c_args 26 arch_boot_link_args = arch_kernel_link_args 24 27 25 28 -
tools/ew.py
r643640a r98975a8 279 279 cmdline += ' -device scsi-cd,drive=cdrom' 280 280 elif cfg['image'] == 'image.boot': 281 cmdline += ' -kernel image.boot'281 cmdline += ' -kernel build/image.boot' 282 282 else: 283 283 cmdline += ' ' + cfg['image']
Note:
See TracChangeset
for help on using the changeset viewer.