Skip to content

Commit 2e85ae1

Browse files
authored
Merge pull request #1662 from NixOS/nxp-docs
nxp: document flashing better
2 parents bffe23e + 8b72f74 commit 2e85ae1

File tree

3 files changed

+88
-3
lines changed

3 files changed

+88
-3
lines changed

compulab/README.md

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,35 @@ Boot ROM initializes the SoC and loads OEI, which runs in TCM to perform early s
2323
}
2424
```
2525

26+
### Building Boot Images
27+
28+
The boot image for flashing to SD cards can be built directly from the flake:
29+
30+
```bash
31+
# Build boot image for UCM-iMX95
32+
nix build github:NixOS/nixos-hardware#packages.aarch64-linux.ucm-imx95-boot
33+
```
34+
35+
The boot image will be available at `./result/image/flash.bin`.
36+
37+
**Note:** These packages target `aarch64-linux`. If you're on a different architecture (e.g., x86_64-linux), you'll need remote builders configured for aarch64-linux.
38+
39+
### Flashing to SD Card
40+
41+
Once built, you can flash the boot image to an SD card:
42+
43+
```bash
44+
# Write boot image to SD card at 32KB offset (adjust /dev/sdX to your SD card device)
45+
sudo dd if=./result/image/flash.bin of=/dev/sdX bs=1k seek=32 conv=fsync
46+
```
47+
48+
**Warning:** Double-check the device path to avoid overwriting the wrong disk!
49+
2650
### Notes
27-
- The configuration, including device-tree, kernel, and bootloader components, is optimized for the UCM-iMX95 SoM and EVK.
28-
- The generated NixOS image supports booting from SD card or eMMC, depending on the hardware configuration.
51+
- The configuration, including device-tree, kernel, and bootloader components, is optimized for the UCM-iMX95 SoM and EVK.
52+
- The generated NixOS image supports booting from SD card or eMMC, depending on the hardware configuration.
2953
- The boot components (OEI in TCM/DDR, SM, ATF, U-Boot) follow the standard NXP release layout for i.MX95 platforms.
54+
55+
### Upstream Documentation
56+
- [NXP i.MX95 EVK U-Boot Documentation](https://docs.u-boot.org/en/latest/board/nxp/imx95_evk.html)
57+
- [CompuLab UCM-iMX95 Product Page](https://www.compulab.com/products/computer-on-modules/ucm-imx95-nxp-i-mx-95-som-system-on-module/)

flake.nix

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,11 +462,19 @@
462462

463463
# Add packages
464464
packages = eachSystem (
465-
pkgs: _system: {
465+
pkgs: system:
466+
{
466467
run-tests = pkgs.callPackage ./tests/run-tests.nix {
467468
inherit self;
468469
};
469470
}
471+
// pkgs.lib.optionalAttrs (system == "aarch64-linux") {
472+
# Boot images for NXP i.MX boards (aarch64-linux only)
473+
ucm-imx95-boot = (pkgs.callPackage ./compulab/ucm-imx95/bsp/ucm-imx95-boot.nix { }).imx95-boot;
474+
imx93-boot = (pkgs.callPackage ./nxp/imx93-evk/bsp/imx93-boot.nix { }).imx93-boot;
475+
imx8mp-boot = (pkgs.callPackage ./nxp/imx8mp-evk/bsp/imx8mp-boot.nix { }).imx8m-boot;
476+
imx8mq-boot = (pkgs.callPackage ./nxp/imx8mq-evk/bsp/imx8mq-boot.nix { }).imx8m-boot;
477+
}
470478
);
471479

472480
# Add checks for `nix run .#run-tests`

nxp/README.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,52 @@ Code snippet example that enables 'imx8mp-evk/imx8mq-evk/imx93-evk' configuratio
3838
}
3939
```
4040

41+
### 2.3 Building Boot Images
42+
43+
Boot images for flashing to SD cards can be built directly from the flake:
44+
45+
```bash
46+
# Build boot image for i.MX8MP EVK
47+
nix build github:NixOS/nixos-hardware#packages.aarch64-linux.imx8mp-boot
48+
49+
# Build boot image for i.MX8MQ EVK
50+
nix build github:NixOS/nixos-hardware#packages.aarch64-linux.imx8mq-boot
51+
52+
# Build boot image for i.MX93 EVK
53+
nix build github:NixOS/nixos-hardware#packages.aarch64-linux.imx93-boot
54+
55+
# Or from a local checkout
56+
nix build .#packages.aarch64-linux.imx8mp-boot
57+
```
58+
59+
The boot image will be available at `./result/image/flash.bin`.
60+
61+
**Note:** These packages target `aarch64-linux`. If you're on a different architecture (e.g., x86_64-linux), you'll need remote builders configured for aarch64-linux.
62+
63+
### 2.4 Flashing to SD Card
64+
65+
Once built, you can flash the boot image to an SD card:
66+
67+
```bash
68+
# For i.MX8MP and i.MX93 (32KB offset):
69+
sudo dd if=./result/image/flash.bin of=/dev/sdX bs=1k seek=32 conv=fsync
70+
71+
# For i.MX8MQ (33KB offset):
72+
sudo dd if=./result/image/flash.bin of=/dev/sdX bs=1k seek=33 conv=fsync
73+
```
74+
75+
**Note:** Different i.MX processors require different offsets. i.MX8MP and i.MX93 use 32KB (seek=32), while i.MX8MQ uses 33KB (seek=33).
76+
77+
**Warning:** Double-check the device path to avoid overwriting the wrong disk!
78+
79+
## 3. Upstream Documentation
80+
81+
### U-Boot Board Documentation
82+
- [NXP i.MX8MP EVK U-Boot Documentation](https://docs.u-boot.org/en/latest/board/nxp/imx8mp_evk.html)
83+
- [NXP i.MX8MQ EVK U-Boot Documentation](https://docs.u-boot.org/en/latest/board/nxp/imx8mq_evk.html)
84+
- [NXP i.MX93 11x11 EVK U-Boot Documentation](https://docs.u-boot.org/en/latest/board/nxp/imx93_11x11_evk.html)
85+
- [NXP i.MX95 EVK U-Boot Documentation](https://docs.u-boot.org/en/latest/board/nxp/imx95_evk.html)
86+
87+
### Additional Resources
88+
- [NXP i.MX 8M Series TF-A Documentation](https://trustedfirmware-a.readthedocs.io/en/latest/plat/imx8m.html)
89+

0 commit comments

Comments
 (0)