@@ -169,24 +169,32 @@ static void kpf_ramdisk_bootprep(struct mach_header_64 *hdr, palerain_option_t p
169
169
uint32_t partid = 1 ;
170
170
/* have SSV and rootful */
171
171
if ((palera1n_flags & (palerain_option_rootful | palerain_option_ssv )) == (palerain_option_rootful | palerain_option_ssv )) {
172
- dt_node_t * fstab = dt_find (gDeviceTree , "fstab" );
173
- if (!fstab ) panic ("invalid devicetree: no fstab!" ); /* iOS 12 and below should not have SSV */
174
- size_t max_fs_entries_len = 0 ;
175
- size_t root_matching_len = 0 ;
176
- uint32_t * max_fs_entries = dt_prop (fstab , "max_fs_entries" , & max_fs_entries_len );
177
- if (!max_fs_entries ) panic ("invalid devicetree: no prop!" );
178
- uint32_t * patch = (uint32_t * )max_fs_entries ;
179
- printf ("fstab max_fs_entries: %016" PRIx64 ": %08x\n" , (uint64_t )max_fs_entries , patch [0 ]);
180
- dt_node_t * baseband = dt_find (gDeviceTree , "baseband" );
181
- if (baseband ) partid = patch [0 ] + 1U ;
182
- else partid = patch [0 ];
183
- if (socnum == 0x7000 || socnum == 0x7001 ) partid -- ;
184
- partid += fakefs_offset ;
185
172
dt_node_t * chosen = dt_find (gDeviceTree , "chosen" );
186
173
if (!chosen ) panic ("invalid devicetree: no device!" );
174
+ size_t nvram_proxy_data_len = 0 ;
175
+ char * nvram_proxy_data = dt_prop (chosen , "nvram-proxy-data" , & nvram_proxy_data_len );
176
+ if (!nvram_proxy_data ) panic ("invalid devicetree: no /chosen/nvram-proxy-data!" );
177
+ char * nvram_rootdev = memmem (nvram_proxy_data , nvram_proxy_data_len , "p1-fakefs-rootdev=" , 18 );
178
+ if (nvram_rootdev ) snprintf (BSDName , 16 , "%s" , & nvram_rootdev [18 ]);
179
+
180
+ size_t root_matching_len = 0 ;
187
181
char * root_matching = dt_prop (chosen , "root-matching" , & root_matching_len );
188
182
if (!root_matching ) panic ("invalid devicetree: no prop!" );
189
- snprintf (BSDName , 16 , "%s%" PRIu32 , disk_prefix (), partid );
183
+ if (!nvram_rootdev ) {
184
+ dt_node_t * fstab = dt_find (gDeviceTree , "fstab" );
185
+ if (!fstab ) panic ("invalid devicetree: no fstab!" ); /* iOS 12 and below should not have SSV */
186
+ size_t max_fs_entries_len = 0 ;
187
+ uint32_t * max_fs_entries = dt_prop (fstab , "max_fs_entries" , & max_fs_entries_len );
188
+ if (!max_fs_entries ) panic ("invalid devicetree: no prop!" );
189
+ uint32_t * patch = (uint32_t * )max_fs_entries ;
190
+ printf ("fstab max_fs_entries: %016" PRIx64 ": %08x\n" , (uint64_t )max_fs_entries , patch [0 ]);
191
+ dt_node_t * baseband = dt_find (gDeviceTree , "baseband" );
192
+ if (baseband ) partid = patch [0 ] + 1U ;
193
+ else partid = patch [0 ];
194
+ if (socnum == 0x7000 || socnum == 0x7001 ) partid -- ;
195
+ partid += fakefs_offset ;
196
+ snprintf (BSDName , 16 , "%s%" PRIu32 , disk_prefix (), partid );
197
+ }
190
198
/* Don't root from fakefs during fakefs setup or force revert */
191
199
if ((palera1n_flags & (palerain_option_setup_rootful | palerain_option_force_revert )) == 0 )
192
200
snprintf (root_matching , root_matching_len ,
0 commit comments