3 if POSTBUILD == 'uboot'
4 boot_image_format = 'binary'
9 modules = [ 'boot/kernel.elf' ] + rd_init + [ 'boot/initrd.img' ]
13 # Collect binary references in the correct order.
16 foreach bin : rd_init_binaries
19 _newname = run_command(basename, bin[1], check: true).stdout().strip()
20 _oldname = run_command(basename, bin[0].full_path(), check: true).stdout().strip()
22 if CONFIG_COMPRESSED_INIT
23 _dep = custom_target(_newname + '.gz',
24 output: _newname + '.gz',
34 name_transform += 's:.*/@0@:@1@:;'.format(_oldname, _newname)
41 error('Could not find dependency ' + m)
46 boot_include_dirs = include_directories(
48 'arch'/BARCH/'include',
50 '../abi/arch'/BARCH/'include',
55 '-imacros', meson.source_root() / 'config.h',
58 '-DRELEASE=' + HELENOS_RELEASE,
59 '-DCOPYRIGHT=' + HELENOS_COPYRIGHT,
60 '-DNAME=' + HELENOS_NAME,
61 '-D__@0@_BITS__'.format(meson.get_cross_property('bits')),
64 boot_c_args = arch_boot_c_args + boot_defs + [
68 boot_link_args = arch_boot_link_args + [
71 '-T', meson.current_build_dir()/'_link.ld',
72 '-Wl,--no-gc-sections',
75 if cc.get_id() == 'clang'
77 '-fno-stack-protector',
79 # '-mllvm', '-asm-macro-max-nesting-depth=1000',
83 # Preprocess linker script using C preprocessor.
84 boot_ldscript = custom_target('_link.ld',
85 input: 'arch'/KARCH/'_link.ld.in',
90 '-I' + meson.current_source_dir()/'arch'/KARCH/'include',
101 # Create empty object file.
102 boot_empty_o = custom_target('empty.o',
114 boot_comps_tar = custom_target('components.tar',
116 output: 'components.tar',
117 command: [ tar, '--transform', name_transform ],
120 # Add .payload section to the empty object.
121 boot_comps_o = custom_target('components.o',
122 output: 'components.o',
123 input: [ boot_comps_tar, boot_empty_o ],
126 '--add-section', '.payload=@INPUT0@',
132 boot_image_name = 'image.boot'
133 boot_image_map_path = meson.current_build_dir()/boot_image_name + '.map'
135 boot_elf = executable(boot_image_name + '.elf', boot_src, boot_comps_o,
136 include_directories: boot_include_dirs,
137 implicit_include_directories: false,
139 link_args: boot_c_args + boot_link_args + [
140 '-Wl,-Map,' + boot_image_map_path,
142 link_depends: boot_ldscript,
148 if boot_image_format == 'elf'
149 boot_image = boot_elf
152 if boot_image_format == 'binary'
153 # Some platforms can't ELF.
154 boot_image = custom_target(boot_image_name + '.bin',
156 output: boot_image_name + '.bin',
157 command: [ objcopy, '-O', 'binary', '@INPUT@', '@OUTPUT@' ],
162 if POSTBUILD == 'raw'
163 POST_INPUT = boot_image
166 if POSTBUILD == 'grub'
170 if POSTBUILD == 'yaboot'
174 if POSTBUILD == 'silo'
178 if POSTBUILD == 'uboot'
179 IMAGE_NAME = 'HelenOS-' + HELENOS_RELEASE
181 POST_INPUT = custom_target('uboot-image',
182 output: 'uboot-image.bin',
189 '-ostype', UIMAGE_OS,