# Linux Kernel Module Cheat

#### 24.10.4. gem5 config.ini

The `m5out/config.ini` file, contains a very good high level description of the system:

    less $(./getvar --arch arm --emulator gem5 m5out_dir)"

That file contains a tree representation of the system, sample excerpt:

    [root]
    type=Root
    children=system
    full_system=true

    [system]
    type=ArmSystem
    children=cpu cpu_clk_domain
    auto_reset_addr_64=false
    semihosting=Null

    [system.cpu]
    type=AtomicSimpleCPU
    children=dstage2_mmu dtb interrupts isa istage2_mmu itb tracer
    branchPred=Null

    [system.cpu_clk_domain]
    type=SrcClockDomain
    clock=500

Each node has:

- a list of child nodes, e.g. `system` is a child of `root`, and both `cpu` and `cpu_clk_domain` are children of `system`

- a list of parameters, e.g. `system.semihosting` is `Null`, which means that Semihosting was turned off

  - the `type` parameter shows is present on every node, and it maps to a `Python` object that inherits from `SimObject`.

    For example, `AtomicSimpleCPU` maps is defined at src/cpu/simple/AtomicSimpleCPU.py.

Set custom configs with the `--param` option of `fs.py`, e.g. we can make gem5 wait for GDB to connect with:

    fs.py --param 'system.cpu[0].wait_for_remote_gdb = True'

More complex settings involving new classes however require patching the config files, although it is easy to hack this up. See for example: patches/manual/gem5-semihost.patch.

Modifying the `config.ini` file manually does nothing since it gets overwritten every time.

- gem5 config.dot