@@ -164,30 +164,32 @@ static void kpf_ramdisk_bootprep(struct mach_header_64 *hdr)
164164 size_t nvram_proxy_data_len = 0 ;
165165 char * nvram_proxy_data = dt_prop (chosen , "nvram-proxy-data" , & nvram_proxy_data_len );
166166 if (!nvram_proxy_data ) panic ("invalid devicetree: no /chosen/nvram-proxy-data!" );
167- char * nvram_rootdev = memmem (nvram_proxy_data , nvram_proxy_data_len , "p1-fakefs-rootdev=" , 18 );
168- if (!nvram_rootdev )
169- panic ("p1-fakefs-rootdev is not found.\n"
170- "Please ensure that there is a fakefs.\n"
171- "If there is a fakefs, load it in palera1n 2.0.1 first.\n" );
172-
173- snprintf (BSDName , 16 , "%s" , & nvram_rootdev [18 ]);
174167
175168 size_t root_matching_len = 0 ;
176169 char * root_matching = dt_prop (chosen , "root-matching" , & root_matching_len );
177170 if (!root_matching ) panic ("invalid devicetree: no prop!" );
178171
172+ // this is required for root-on-md0
173+ snprintf (BSDName , 16 , "%s%" PRIu32 , disk_prefix () , 1 );
174+
179175 /* Don't root from fakefs during fakefs setup or force revert */
180- if ((palera1n_flags & (palerain_option_setup_rootful | palerain_option_force_revert )) == 0 )
181- snprintf (root_matching , root_matching_len ,
182- "<dict ID=\"0\"><key>IOProviderClass</key><string ID=\"1\">IOService</string><key>BSD Name</key><string ID=\"2\">%s</string></dict>" ,
183- BSDName );
184- else
176+ if ((palera1n_flags & (palerain_option_setup_rootful | palerain_option_force_revert )) == 0 ) {
177+ char * nvram_rootdev = memmem (nvram_proxy_data , nvram_proxy_data_len , "p1-fakefs-rootdev=" , 18 );
178+ if (!nvram_rootdev )
179+ panic ("p1-fakefs-rootdev is not found.\n"
180+ "Please ensure that there is a fakefs.\n"
181+ "If there is a fakefs, load it in palera1n 2.0.1 first.\n" );
182+
183+ snprintf (BSDName , 16 , "%s" , & nvram_rootdev [18 ]);
184+ snprintf (root_matching , root_matching_len ,
185+ "<dict ID=\"0\"><key>IOProviderClass</key><string ID=\"1\">IOService</string><key>BSD Name</key><string ID=\"2\">%s</string></dict>" ,
186+ BSDName );
187+ } else {
185188 printf ("KPF: rooting from original rootfs for fakefs setup or force revert\n" );
189+ }
186190 printf ("KPF: root BSD Name: %s\n" , BSDName );
187191 printf ("KPF: root_matching (raw): %s\n" , root_matching );
188192 } else {
189- // this is required for root-on-md0
190- snprintf (BSDName , 16 , "%s%" PRIu32 , disk_prefix () , 1 );
191193 printf ("KPF: root BSD Name unchanged\n" );
192194 }
193195
0 commit comments