Skip to content

Commit cdb4b23

Browse files
committed
Extend wendy_config partition to the SD card Jetson machine
The NVMe machine already gets a 64 MB FAT32 WENDYCONFIG partition that macOS auto-mounts. This extends the same to the SD card machine. The SD card variant required three fixes beyond simply adding the machine name: - The SD card partition layout lives in a single XML shared with the QSPI bootloader layout. This means the bootloader update tooling (BUP) also sees our partition and tries to include the FAT32 image in firmware update payloads. We exclude it from BUP explicitly so it remains in the SD flash image only. - The actual layout filename differs from what the machine config suggests, due to how the redundant AB layout naming works upstream. - The tegraflash hook that copies the FAT32 image into the build package was written NVMe-only and needed to handle the SD case.
1 parent b73bbec commit cdb4b23

File tree

4 files changed

+109
-57
lines changed

4 files changed

+109
-57
lines changed

conf/machine/jetson-orin-nano-devkit-wendyos.conf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,12 @@ IMAGE_FSTYPES:pn-tegra-initrd-flash-initramfs:tegra = "${TEGRA_INITRD_FLASH_INIT
3535

3636
# If you really need it, board param (but consider removing if unused):
3737
EMMC_SIZE = "0"
38+
39+
# Strip wendy-config.fat32.img from the BUP partition layout XML.
40+
# The BUP (bootloader update payload) is firmware-only; data partitions like
41+
# wendy_config must not be referenced there. TEGRA_BUPGEN_STRIP_IMG_NAMES
42+
# removes the <filename> element for listed files when generating
43+
# flash-stripped.xml.in, which is what doflash.sh uses for BUP signing.
44+
# wendy_config is still present with its filename in flash.xml.in for normal
45+
# SD card flashing via dosdcard.sh.
46+
TEGRA_BUPGEN_STRIP_IMG_NAMES:append = " wendy-config.fat32.img"
Lines changed: 93 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,38 @@
11
DEPENDS:append = " tegra-helper-scripts-native"
22
PATH =. "${STAGING_BINDIR_NATIVE}/tegra-flash:"
33

4-
# Override NVMe partition layout for WendyOS to:
5-
# 1. Remove "reserved" partition (between UDA and APP)
6-
# 2. Rename "permanet_user_storage" (p17) to "mender_data"
7-
# 3. Update mender_data size to 512MB (will auto-expand)
8-
# 4. Change allocation_attribute from 0x808 to 0x8 (allow expansion)
9-
# 5. Add partition type GUID for Linux filesystem
10-
#
11-
# This runs AFTER meta-mender-tegra's do_install:append which creates the _rootfs_ab.xml variant
4+
# Override partition layouts for WendyOS Jetson machines.
5+
# Runs AFTER meta-mender-tegra's do_install:append which injects DATAFILE into UDA.
126

137
do_install:append() {
14-
# Only apply to NVMe variants (both Nano and AGX use same T234 partition layout)
158
case "${MACHINE}" in
16-
jetson-orin-nano-devkit-nvme-wendyos|jetson-agx-orin-devkit-nvme-wendyos)
17-
;;
18-
*)
19-
return
20-
;;
21-
esac
229

23-
# Modify the _rootfs_ab.xml file created by meta-mender-tegra
24-
local layout_file="flash_l4t_t234_nvme_rootfs_ab.xml"
25-
local layout_path="${D}${datadir}/l4t-storage-layout/${layout_file}"
10+
jetson-orin-nano-devkit-nvme-wendyos|jetson-agx-orin-devkit-nvme-wendyos)
11+
# ------------------------------------------------------------------
12+
# NVMe: modify flash_l4t_t234_nvme_rootfs_ab.xml
13+
#
14+
# 1. Remove "reserved" partition (blocks expansion, not needed)
15+
# 2. Add "mender_data" (p17) after APP_b — persistent Mender store
16+
# 2.5. Add "wendy_config" (p16, 64 MB FAT32) before mender_data
17+
# 3. Remove DATAFILE from UDA (UDA kept for NVIDIA compat, not used)
18+
# ------------------------------------------------------------------
19+
local layout_file="flash_l4t_t234_nvme_rootfs_ab.xml"
20+
local layout_path="${D}${datadir}/l4t-storage-layout/${layout_file}"
2621

27-
if [ ! -f "${layout_path}" ]; then
28-
bbwarn "Layout file ${layout_file} not found at ${layout_path}, skipping WendyOS modifications"
29-
return
30-
fi
22+
if [ ! -f "${layout_path}" ]; then
23+
bbwarn "Layout file ${layout_file} not found at ${layout_path}, skipping WendyOS NVMe modifications"
24+
return
25+
fi
3126

32-
bbnote "wendyos: Modifying ${layout_file} to use mender_data partition..."
27+
bbnote "wendyos: Modifying ${layout_file} for NVMe (mender_data + wendy_config)..."
3328

34-
# 1. Remove the "reserved" partition (between UDA and APP)
35-
# This partition blocks expansion and is not needed
36-
nvflashxmlparse --remove --partitions-to-remove reserved \
37-
--output ${WORKDIR}/${layout_file}.tmp1 \
38-
${layout_path}
29+
# 1. Remove the "reserved" partition
30+
nvflashxmlparse --remove --partitions-to-remove reserved \
31+
--output ${WORKDIR}/${layout_file}.tmp1 \
32+
${layout_path}
3933

40-
# 2. Add new "mender_data" partition AFTER APP_b and BEFORE secondary_gpt
41-
# Insert the partition definition using sed
42-
sed -i '/<partition name="secondary_gpt"/i\
34+
# 2. Add "mender_data" AFTER APP_b and BEFORE secondary_gpt
35+
sed -i '/<partition name="secondary_gpt"/i\
4336
<partition name="mender_data" id="17" type="data">\
4437
<allocation_policy> sequential </allocation_policy>\
4538
<filesystem_type> basic </filesystem_type>\
@@ -52,11 +45,11 @@ do_install:append() {
5245
<filename> DATAFILE </filename>\
5346
<description> **WendyOS/Mender.** Data partition for persistent storage (home directories, user data, Mender state). Positioned after APP_b to allow expansion to fill remaining disk space. Auto-expands via mender-grow-data.service on first boot. UDA (p15) is kept for NVIDIA compatibility but not mounted by wendyos. </description>\
5447
</partition>' \
55-
${WORKDIR}/${layout_file}.tmp1
48+
${WORKDIR}/${layout_file}.tmp1
5649

57-
# 2.5. Add wendy_config partition (id=16) BEFORE mender_data (id=17)
58-
# 64 MB FAT32, Microsoft Basic Data GUID → macOS auto-mounts as /Volumes/WENDYCONFIG
59-
sed -i '/<partition name="mender_data" id="17"/i\
50+
# 2.5. Add wendy_config (id=16) BEFORE mender_data (id=17)
51+
# Microsoft Basic Data GUID → macOS auto-mounts as /Volumes/WENDYCONFIG
52+
sed -i '/<partition name="mender_data" id="17"/i\
6053
<partition name="wendy_config" id="16" type="data">\
6154
<allocation_policy> sequential </allocation_policy>\
6255
<filesystem_type> basic </filesystem_type>\
@@ -69,19 +62,72 @@ do_install:append() {
6962
<filename> wendy-config.fat32.img </filename>\
7063
<description> WendyOS first-boot config partition (FAT32, 64 MB). </description>\
7164
</partition>' \
72-
${WORKDIR}/${layout_file}.tmp1
65+
${WORKDIR}/${layout_file}.tmp1
7366

74-
# 3. Remove DATAFILE filename from UDA partition
75-
# Prevent flash error when dataimg is larger than UDA partition
76-
# UDA is not used by WendyOS (mender_data is used instead)
77-
# UDA is kept for NVIDIA compatibility but should not have pre-written content
78-
# The filename field causes flash tools to fail during signing
79-
sed -i '/<partition name="UDA"/,/<\/partition>/ {
80-
/<filename>/d
81-
}' ${WORKDIR}/${layout_file}.tmp1
67+
# 3. Remove DATAFILE from UDA (prevents flash error; UDA not mounted by WendyOS)
68+
sed -i '/<partition name="UDA"/,/<\/partition>/ {
69+
/<filename>/d
70+
}' ${WORKDIR}/${layout_file}.tmp1
8271

83-
# Install the modified layout
84-
install -m 0644 ${WORKDIR}/${layout_file}.tmp1 ${layout_path}
72+
install -m 0644 ${WORKDIR}/${layout_file}.tmp1 ${layout_path}
73+
bbnote "WendyOS: Successfully modified ${layout_file} for NVMe"
74+
;;
8575

86-
bbnote "WendyOS: Successfully added mender_data partition to ${layout_file}"
76+
jetson-orin-nano-devkit-wendyos)
77+
# ------------------------------------------------------------------
78+
# SD card: modify the SD template layout XML.
79+
#
80+
# With USE_REDUNDANT_FLASH_LAYOUT=1 and
81+
# PARTITION_LAYOUT_TEMPLATE_DEFAULT_SUPPORTS_REDUNDANT unset,
82+
# PARTITION_LAYOUT_TEMPLATE resolves to
83+
# flash_t234_qspi_sd_rootfs_ab.xml (not flash_t234_qspi_sd.xml).
84+
# Use ${PARTITION_LAYOUT_TEMPLATE} to follow the same variable that
85+
# the base recipe and meta-mender-tegra use.
86+
#
87+
# Add wendy_config (id=17, 64 MB FAT32) AFTER APP_b (id=2) in the
88+
# sdcard device block, immediately before secondary_gpt.
89+
# APP_b (id=2) is the last data partition on the SD card.
90+
# UDA (p15, mender data) is unaffected — no machine conf changes needed.
91+
# id=17 is the next free GPT slot after reserved (slot 16).
92+
# ------------------------------------------------------------------
93+
local layout_file="${PARTITION_LAYOUT_TEMPLATE}"
94+
local layout_path="${D}${datadir}/l4t-storage-layout/${layout_file}"
95+
96+
if [ ! -f "${layout_path}" ]; then
97+
bbwarn "Layout file ${layout_file} not found at ${layout_path}, skipping WendyOS SD modifications"
98+
return
99+
fi
100+
101+
bbnote "wendyos: Modifying ${layout_file} for SD (wendy_config)..."
102+
103+
cp "${layout_path}" "${WORKDIR}/${layout_file}.tmp1"
104+
105+
# Add wendy_config AFTER APP_b (id=2), before secondary_gpt.
106+
# The range APP_b-opening → first </partition> captures the APP_b
107+
# block exactly; a\ appends the new partition immediately after it.
108+
sed -i '/<partition name="APP_b" id="2"/,/<\/partition>/{
109+
/<\/partition>/a\
110+
<partition name="wendy_config" id="17" type="data">\
111+
<allocation_policy> sequential </allocation_policy>\
112+
<filesystem_type> basic </filesystem_type>\
113+
<size> 67108864 </size>\
114+
<file_system_attribute> 0 </file_system_attribute>\
115+
<allocation_attribute> 0x8 </allocation_attribute>\
116+
<partition_type_guid> EBD0A0A2-B9E5-4433-87C0-68B6B72699C7 </partition_type_guid>\
117+
<percent_reserved> 0 </percent_reserved>\
118+
<align_boundary> 16384 </align_boundary>\
119+
<filename> wendy-config.fat32.img </filename>\
120+
<description> WendyOS first-boot config partition (FAT32, 64 MB). </description>\
121+
</partition>
122+
}' \
123+
"${WORKDIR}/${layout_file}.tmp1"
124+
125+
install -m 0644 "${WORKDIR}/${layout_file}.tmp1" "${layout_path}"
126+
bbnote "WendyOS: Successfully added wendy_config to ${layout_file}"
127+
;;
128+
129+
*)
130+
return
131+
;;
132+
esac
87133
}

meta-tegra-extensions/recipes-bsp/wendy-config-partition/wendy-config-partition_1.0.bb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda
88

99
DEPENDS = "dosfstools-native"
1010

11-
COMPATIBLE_MACHINE = "(jetson-orin-nano-devkit-nvme-wendyos|jetson-agx-orin-devkit-nvme-wendyos)"
11+
COMPATIBLE_MACHINE = "(jetson-orin-nano-devkit-nvme-wendyos|jetson-agx-orin-devkit-nvme-wendyos|jetson-orin-nano-devkit-wendyos)"
1212

1313
inherit deploy nopackages
1414

recipes-core/images/wendyos-image.bbappend

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,32 +6,29 @@ EXTRA_IMAGEDEPENDS:append:tegra = " wendy-config-partition"
66

77
tegraflash_custom_post:append() {
88
if [ -f "external-flash.xml.in" ]; then
9-
# Get the actual DTB filename
9+
# NVMe: replace placeholders in the external partition layout XML
1010
DTB_NAME="$(basename ${KERNEL_DEVICETREE})"
11-
12-
# Replace placeholders with actual filenames
1311
sed -i \
1412
-e "s,DTB_FILE,${DTB_NAME}," \
1513
-e "s,DATAFILE,${IMAGE_LINK_NAME}.dataimg," \
1614
-e "s,APPFILE_b,${IMAGE_BASENAME}.ext4," \
1715
-e "s,APPFILE,${IMAGE_BASENAME}.ext4," \
1816
external-flash.xml.in
19-
2017
bbnote "Replaced placeholders in external-flash.xml.in"
2118
bbnote " DTB_FILE -> ${DTB_NAME}"
2219
bbnote " DATAFILE -> ${IMAGE_LINK_NAME}.dataimg"
2320
bbnote " APPFILE -> ${IMAGE_BASENAME}.ext4"
2421
else
25-
bberror "external-flash.xml.in not found in tegraflash_custom_post"
26-
bberror "Current directory: $(pwd)"
27-
bberror "Files present: $(ls -la)"
22+
# SD card: partition layout lives in flash.xml.in (the template XML);
23+
# placeholder replacement for that file is handled by the base bbclass.
24+
bbnote "No external-flash.xml.in (SD card machine — wendy_config is in template XML)"
2825
fi
2926

3027
# Copy wendy-config FAT32 image into the tegraflash package directory so
31-
# tegraparser_v2 can find it when processing external-flash.xml.in.
28+
# tegraparser_v2 can find it when processing the partition layout XML.
3229
# create_tegraflash_pkg never auto-includes files from DEPLOY_DIR_IMAGE
3330
# just because they are referenced in a partition layout XML — each file
34-
# must be copied explicitly.
31+
# must be copied explicitly. Required for both NVMe and SD card builds.
3532
if [ -f "${DEPLOY_DIR_IMAGE}/wendy-config.fat32.img" ]; then
3633
cp "${DEPLOY_DIR_IMAGE}/wendy-config.fat32.img" ./wendy-config.fat32.img
3734
bbnote "Copied wendy-config.fat32.img into tegraflash package"

0 commit comments

Comments
 (0)