Skip to content

Commit e575f73

Browse files
committed
ccache: make awesome
1 parent 9c5b5b4 commit e575f73

File tree

1 file changed

+46
-47
lines changed

1 file changed

+46
-47
lines changed

README.adoc

Lines changed: 46 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -9205,48 +9205,6 @@ which gives:
92059205
uid=1000(user0) gid=1000(user0) groups=1000(user0)
92069206
....
92079207

9208-
=== ccache
9209-
9210-
We have link:https://buildroot.org/downloads/manual/manual.html#ccache[enabled ccached] builds by default.
9211-
9212-
`BR2_CCACHE_USE_BASEDIR=n` is used, which means that:
9213-
9214-
* absolute paths are used and GDB can find source files
9215-
* but builds are not reused across separated LKMC directories
9216-
9217-
ccache can considerably speed up builds when you:
9218-
9219-
* are switching between multiple configurations for a given package to bisect something out, as mentioned at: <<modify-kernel-config>>
9220-
* clean the build because things stopped working. We store the cache outside of this repository, so you can nuke away without fear
9221-
9222-
The default ccache environment variables are honored if you have them set, which we recommend you do. E.g., in your `.bashrc`:
9223-
9224-
....
9225-
export CCACHE_DIR=~/.ccache
9226-
export CCACHE_MAXSIZE="20G"
9227-
....
9228-
9229-
The choice basically comes down to:
9230-
9231-
* should I store my cache on my HD or SSD?
9232-
* how big is my build, and how many build configurations do I need to keep around at a time?
9233-
9234-
If you don't set it, the default is to use `~/.buildroot-ccache` with `5G`, which is a bit small for us.
9235-
9236-
I find it very relaxing to watch ccache at work with:
9237-
9238-
....
9239-
watch -n1 'make -C "$(./getvar buildroot_build_dir)" ccache-stats'
9240-
....
9241-
9242-
or if you have it installed on host and the environment variables exported simply with:
9243-
9244-
....
9245-
watch -n1 'ccache -s'
9246-
....
9247-
9248-
while a build is going on in another terminal and my cooler is humming. Especially when the hit count goes up ;-) The joys of system programming.
9249-
92509208
=== Add new Buildroot packages
92519209

92529210
First, see if you can't get away without actually adding a new package, for example:
@@ -9654,6 +9612,17 @@ cp config.example data/config
96549612

96559613
and then edit the `data/config` file to your needs.
96569614

9615+
=== Build the documentation
9616+
9617+
You don't need to depend on GitHub:
9618+
9619+
....
9620+
./build-doc
9621+
xdg-open out/README.html
9622+
....
9623+
9624+
Source: link:build-doc[]
9625+
96579626
=== Clean the build
96589627

96599628
You did something crazy, and nothing seems to work anymore?
@@ -9702,16 +9671,46 @@ Verify with:
97029671
ls "$(./getvar build_dir)"
97039672
....
97049673

9705-
=== Build the documentation
9674+
=== ccache
97069675

9707-
You don't need to depend on GitHub:
9676+
link:https://en.wikipedia.org/wiki/Ccache[ccache] <<benchmark-builds,might>> save you a lot of re-build when you decide to <<clean-the-build>> or create a new <<build-variants,build variant>>.
9677+
9678+
We have ccache enabled for everything we build by default.
9679+
9680+
However, you likely want to add the following to your `.bashrc` to take better advantage of `ccache`:
97089681

97099682
....
9710-
./build-doc
9711-
xdg-open out/README.html
9683+
export CCACHE_DIR=~/.ccache
9684+
export CCACHE_MAXSIZE="20G"
97129685
....
97139686

9714-
Source: link:build-doc[]
9687+
We cannot automate this because you have to decide:
9688+
9689+
* should I store my cache on my HD or SSD?
9690+
* how big is my build, and how many build configurations do I need to keep around at a time?
9691+
9692+
If you don't those variables it, the default is to use `~/.buildroot-ccache` with `5G`, which is a bit small for us.
9693+
9694+
To check if `ccache` is working, run this command while a build is running on another shell:
9695+
9696+
....
9697+
watch -n1 'make -C "$(./getvar buildroot_build_dir)" ccache-stats'
9698+
....
9699+
9700+
or if you have it installed on host and the environment variables exported simply with:
9701+
9702+
....
9703+
watch -n1 'ccache -s'
9704+
....
9705+
9706+
and then watch the miss or hit counts go up.
9707+
9708+
We have link:https://buildroot.org/downloads/manual/manual.html#ccache[enabled ccached] builds by default.
9709+
9710+
`BR2_CCACHE_USE_BASEDIR=n` is used for Buildroot, which means that:
9711+
9712+
* absolute paths are used and GDB can find source files
9713+
* but builds are not reused across separated LKMC directories
97159714

97169715
=== Simultaneous runs
97179716

0 commit comments

Comments
 (0)