Make it optional to adjust your elves

dlmalloc
alexis 2022-04-10 18:14:40 -06:00
parent e582d0c49d
commit 0e8d64add7
5 changed files with 35 additions and 12 deletions

View File

@ -11,6 +11,14 @@ meson . build --cross-file meson_cross.txt
meson compile -C build
```
The build script accepts arguments of the form `option=value` and will pass
these to meson. Useful options include:
| Option | Default | Description |
|------------------|---------|-------------|
| `board` | icm68k | Board whose superfs should be built. |
| `adjust_objects` | true | After in-place relocation, adjust offets in the object files to match. This simplifies debugging. |
A6 boots through a specially constructed FAT filesystem image, called the
"superfs" (supervisor filesystem). It is loaded into the 68k boot address
(zero), and contains all the operating system files, with executables relocated

View File

@ -17,6 +17,12 @@ for use in embedded M68k computers. Some characteristics:
- Loadable kernel modules
- Applications load from ELF files, with dynamic linking/relocation
## Compiling
There is more documentation on compiling [here](0-DOCS/Building.md). The tl;dr
is: you need a m68k gcc toolchain called `m68k-elf-*` on your path, then build
using meson. A helper script to run all the meson commands is at `./build.sh`.
## Documentation
The documentation takes the form of Markdown files located in this source

View File

@ -5,9 +5,9 @@ BDIR=build
meson . "$BDIR" --cross-file meson_cross.txt
if [[ x"$1" != x ]]; then
meson configure -D board="$1" "$BDIR"
fi
for arg in "$@"; do
meson configure -D"$arg" "$BDIR"
done
meson compile -C "$BDIR"

View File

@ -48,6 +48,7 @@ add_project_link_arguments(gcc_info['LIBGCC_A'], language: ['c', 'cpp'])
strip = find_program('strip', required: true)
board = get_option('board')
adjust_objects = get_option('adjust_objects')
foreach n: [true, false]
add_project_arguments([
@ -85,6 +86,19 @@ subdir('exe_a6')
# Finally, pack it all up
srec_fn = 'superfs_' + board + '.srec'
superfs_args = [
'--db', dex_builder.full_path(),
'--strip', strip.full_path(),
'@SOURCE_ROOT@/superfs_' + board,
'-t',
'-m', board + '.map',
'--sort-map', 'address',
]
if adjust_objects
superfs_args += '-a'
endif
superfs_srec = custom_target(
srec_fn,
output: srec_fn,
@ -92,14 +106,6 @@ superfs_srec = custom_target(
command: [
prog_python,
'@SOURCE_ROOT@/toolchain/run_superfs_builder.py',
'--db', dex_builder.full_path(),
'--strip', strip.full_path(),
'@SOURCE_ROOT@/superfs_' + board,
'-t',
'-m', board + '.map',
'--sort-map', 'address',
'-a',
'@OUTPUT@',
],
] + superfs_args + ['@OUTPUT@'],
build_always: true,
)

View File

@ -2,3 +2,6 @@ option('board', type: 'string', value: 'icm68k',
description: 'Name of the board whose superfs should be built. ' +
'For a given BOARD, there must be a superfs_BOARD directory.'
)
option('adjust_objects', type: 'boolean', value: true,
description: 'After in-place relocation, adjust the object files to match.')