Skip to content

Commit 655a6da

Browse files
committed
nxp: document flash procedure and expose images in flake
1 parent bffe23e commit 655a6da

File tree

3 files changed

+76
-3
lines changed

3 files changed

+76
-3
lines changed

compulab/README.md

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,34 @@ 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+
# Or from a local checkout
35+
nix build .#packages.aarch64-linux.ucm-imx95-boot
36+
```
37+
38+
The boot image will be available at `./result/image/flash.bin`.
39+
40+
**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.
41+
42+
### Flashing to SD Card
43+
44+
Once built, you can flash the boot image to an SD card:
45+
46+
```bash
47+
# Write boot image to SD card at 32KB offset (adjust /dev/sdX to your SD card device)
48+
sudo dd if=./result/image/flash.bin of=/dev/sdX bs=1k seek=32 conv=fsync
49+
```
50+
51+
**Warning:** Double-check the device path to avoid overwriting the wrong disk!
52+
2653
### 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.
54+
- The configuration, including device-tree, kernel, and bootloader components, is optimized for the UCM-iMX95 SoM and EVK.
55+
- The generated NixOS image supports booting from SD card or eMMC, depending on the hardware configuration.
2956
- The boot components (OEI in TCM/DDR, SM, ATF, U-Boot) follow the standard NXP release layout for i.MX95 platforms.

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: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,41 @@ 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+

0 commit comments

Comments
 (0)