Skip to content

Commit fddec6d

Browse files
committed
document & pretty up
1 parent 84e4ed2 commit fddec6d

File tree

2 files changed

+80
-0
lines changed

2 files changed

+80
-0
lines changed

NIX.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Nix build environment
2+
3+
## Build in-tree with devShell
4+
5+
```console
6+
$ git clone [email protected]:charlottia/FrameworkEmbeddedController
7+
Cloning into 'FrameworkEmbeddedController'...
8+
remote: Enumerating objects: 270106, done.
9+
remote: Counting objects: 100% (15617/15617), done.
10+
remote: Compressing objects: 100% (515/515), done.
11+
remote: Total 270106 (delta 15232), reused 15336 (delta 15088), pack-reused 254489 (from 1)
12+
Receiving objects: 100% (270106/270106), 107.00 MiB | 8.00 MiB/s, done.
13+
Resolving deltas: 100% (207805/207805), done.
14+
$ cd FrameworkEmbeddedController
15+
$ ls
16+
baseboard cts libc pyproject.toml
17+
board DIR_METADATA LICENSE README.fmap
18+
BUILD.bazel docs Makefile README.md
19+
builtin driver Makefile.ide setup.py
20+
chip extra Makefile.rules test
21+
cmake firmware_builder.py Makefile.toolchain third_party
22+
CMakeLists.txt flake.lock navbar.md twister
23+
common flake.nix OWNERS unblocked_terms.txt
24+
core fuzz power util
25+
CPPLINT.cfg include PRESUBMIT.cfg west.yml
26+
crypto Kconfig pylintrc zephyr
27+
$ nix develop
28+
$ zmake -j8 build lotus
29+
Toolchain <zmake.toolchains.ZephyrToolchain object at 0x7ffff69b2750> selected by probe function.
30+
Building lotus in /home/kivikakk/g/FrameworkEmbeddedController/src/platform/ec/build/zephyr/lotus.
31+
Configuring lotus:ro.
32+
Configuring lotus:rw.
33+
Loading Zephyr default modules (Zephyr base (cached)).
34+
Loading Zephyr default modules (Zephyr base (cached)).
35+
'label' is marked as deprecated in 'properties:' in /nix/store/sgk2c9yi5frylgmp204aq61cjpai6m0l-source/dts/bindings/i2c/nuvoton,npcx-i2c-port.yaml for node /soc-if/io_i2c_ctrl0_port0.
36+
...
37+
/home/kivikakk/g/FrameworkEmbeddedController/build/zephyr/lotus/packer/source.dts:973.38-978.6: Warning (unique_unit_address): /soc-if/io_i2c_ctrl7_port0/ambient_f75303@4d: duplicate unit-address (also used in node /soc-if/io_i2c_ctrl7_port0/apu_f75303@4d)
38+
/home/kivikakk/g/FrameworkEmbeddedController/build/zephyr/lotus/packer/source.dts:979.38-984.6: Warning (unique_unit_address): /soc-if/io_i2c_ctrl7_port0/charger_f75303@4d: duplicate unit-address (also used in node /soc-if/io_i2c_ctrl7_port0/apu_f75303@4d)
39+
$ ls -l src/platform/ec/build/zephyr/lotus/output
40+
total 8332
41+
-rw-r--r-- 1 kivikakk users 524288 dets 7 17:02 ec.bin
42+
-rwxr-xr-x 1 kivikakk users 792 dets 7 17:02 npcx_monitor.bin
43+
-rwxr-xr-x 1 kivikakk users 4000556 dets 7 17:02 zephyr.ro.elf
44+
-rwxr-xr-x 1 kivikakk users 4000504 dets 7 17:02 zephyr.rw.elf
45+
$
46+
```
47+
48+
## Build working copy reproducibly
49+
50+
```console
51+
$ nix build .#lotus
52+
$ ls -l result
53+
lrwxrwxrwx 1 kivikakk users 49 dets 7 17:08 result -> /nix/store/2530fb2xcv4dnki6dsjbg11hydsbkvld-lotus
54+
$ ls -l result/
55+
total 8260
56+
-r--r--r-- 1 root root 524288 jaan 1 1970 ec.bin
57+
-r-xr-xr-x 1 root root 792 jaan 1 1970 npcx_monitor.bin
58+
-r-xr-xr-x 1 root root 3961164 jaan 1 1970 zephyr.ro.elf
59+
-r-xr-xr-x 1 root root 3961120 jaan 1 1970 zephyr.rw.elf
60+
```
61+
62+
(Or `.#azalea`.)
63+
64+
## Build commit (checkout not required)
65+
66+
```console
67+
$ nix build 'github:charlottia/FrameworkEmbeddedController?rev=84e4ed243f3d17f97b2dc89924d3c71aef8c2a28#lotus'
68+
$ ls -l result
69+
lrwxrwxrwx 1 kivikakk users 49 dets 7 17:10 result -> /nix/store/c32jydxf53vqgc99468b5fdqs1d1vdwn-lotus
70+
$ ls -l result/
71+
total 8260
72+
-r--r--r-- 1 root root 524288 jaan 1 1970 ec.bin
73+
-r-xr-xr-x 1 root root 792 jaan 1 1970 npcx_monitor.bin
74+
-r-xr-xr-x 1 root root 3961164 jaan 1 1970 zephyr.ro.elf
75+
-r-xr-xr-x 1 root root 3961120 jaan 1 1970 zephyr.rw.elf
76+
```

flake.nix

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,8 @@
197197
};
198198

199199
devShells.default = pkgs.mkShell {
200+
name = "EmbeddedController";
201+
200202
buildInputs = [
201203
zephyr-sdk
202204
pkgs.cmake
@@ -213,6 +215,8 @@
213215
];
214216

215217
shellHook = ''
218+
mkdir -p .repo
219+
216220
rm -rf src
217221
mkdir -p src/platform
218222
ln -fs ../.. src/platform/ec

0 commit comments

Comments
 (0)