Created
June 11, 2024 00:04
-
-
Save Lillecarl/b889a1028fc3eebc916aeced69bea21e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From d0c6fed42094faad439124960167d18d509317dc Mon Sep 17 00:00:00 2001 | |
From: Carl Hjerpe <carl.hjerpe@helicon.ai> | |
Date: Tue, 11 Jun 2024 02:01:55 +0200 | |
Subject: [PATCH] test | |
--- | |
modules/imx8/imx8mp-sdimage.nix | 68 +++++++++++++++++---------------- | |
1 file changed, 36 insertions(+), 32 deletions(-) | |
diff --git a/modules/imx8/imx8mp-sdimage.nix b/modules/imx8/imx8mp-sdimage.nix | |
index f3cf0b4..259a5ef 100644 | |
--- a/modules/imx8/imx8mp-sdimage.nix | |
+++ b/modules/imx8/imx8mp-sdimage.nix | |
@@ -1,17 +1,16 @@ | |
# SPDX-FileCopyrightText: 2023-2024 TII (SSRC) and the Ghaf contributors | |
# | |
# SPDX-License-Identifier: Apache-2.0 | |
-{ | |
- config, | |
- pkgs, | |
- modulesPath, | |
- ... | |
+{ config | |
+, pkgs | |
+, modulesPath | |
+, ... | |
}: { | |
imports = [ | |
(modulesPath + "/installer/sd-card/sd-image.nix") | |
]; | |
- disabledModules = [(modulesPath + "/profiles/all-hardware.nix")]; | |
+ disabledModules = [ (modulesPath + "/profiles/all-hardware.nix") ]; | |
sdImage = { | |
compressImage = false; | |
@@ -24,33 +23,38 @@ | |
${config.boot.loader.generic-extlinux-compatible.populateCmd} -c ${config.system.build.toplevel} -d ./files/boot | |
''; | |
- postBuildCommands = '' | |
- sdimage="$out/nixos.img" | |
- fwoffset=64 | |
- blocksize=512 | |
- fwsize=20400 | |
- rootoffset=20800 | |
+ postBuildCommands = /* bash */ '' | |
+ dd conv=notrunc if=${pkgs.imx8m-boot}/image/flash.bin of=$img bs=1K oseek=32 | |
+ ''; | |
+ firmwareSize = 20; | |
+ firmwarePartitionOffset = 32; | |
+ #postBuildCommands = '' | |
+ # sdimage="$out/nixos.img" | |
+ # fwoffset=64 | |
+ # blocksize=512 | |
+ # fwsize=20400 | |
+ # rootoffset=20800 | |
- sfdisk --list $img | grep Linux | |
- rootstart=$(sfdisk --list $img | grep Linux | awk '{print $3}') | |
- rootsize=$(sfdisk --list $img | grep Linux | awk '{print $5}') | |
- imagesize=$(((rootoffset + rootsize)*blocksize)) | |
- touch $sdimage | |
- truncate -s $imagesize $sdimage | |
- echo -e " | |
- label: dos | |
- label-id: 0x2178694e | |
- unit: sectors | |
- sector-size: 512 | |
+ # sfdisk --list $img | grep Linux | |
+ # rootstart=$(sfdisk --list $img | grep Linux | awk '{print $3}') | |
+ # rootsize=$(sfdisk --list $img | grep Linux | awk '{print $5}') | |
+ # imagesize=$(((rootoffset + rootsize)*blocksize)) | |
+ # touch $sdimage | |
+ # truncate -s $imagesize $sdimage | |
+ # echo -e " | |
+ # label: dos | |
+ # label-id: 0x2178694e | |
+ # unit: sectors | |
+ # sector-size: 512 | |
- start=$fwoffset, size=$fwsize, type=60 | |
- start=$rootoffset, size=$rootsize, type=83, bootable" > "$out/partition.txt" | |
- sfdisk -d $img | |
- sfdisk $sdimage < "$out/partition.txt" | |
- dd conv=notrunc if=${pkgs.imx8m-boot}/image/flash.bin of=$sdimage seek=$fwoffset | |
- dd conv=notrunc if=$img of=$sdimage seek=$rootoffset skip=$rootstart count=$rootsize | |
- sfdisk --list $sdimage | |
- rm -rf $out/sd-image | |
- ''; | |
+ # start=$fwoffset, size=$fwsize, type=60 | |
+ # start=$rootoffset, size=$rootsize, type=83, bootable" > "$out/partition.txt" | |
+ # sfdisk -d $img | |
+ # sfdisk $sdimage < "$out/partition.txt" | |
+ # dd conv=notrunc if=${pkgs.imx8m-boot}/image/flash.bin of=$sdimage seek=$fwoffset | |
+ # dd conv=notrunc if=$img of=$sdimage seek=$rootoffset skip=$rootstart count=$rootsize | |
+ # sfdisk --list $sdimage | |
+ # rm -rf $out/sd-image | |
+ #''; | |
}; | |
} | |
-- | |
2.44.1 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment