@@ -67,6 +67,7 @@ construct_timeline (void)
67
67
size_t i , j , k ;
68
68
struct pass_data * data ;
69
69
struct activity * activity ;
70
+ const char * first_kernel_message ;
70
71
71
72
for (i = 0 ; i < NR_TEST_PASSES ; ++ i ) {
72
73
data = & pass_data [i ];
@@ -217,14 +218,30 @@ construct_timeline (void)
217
218
strstr (data -> events [k ].message , "libvirt XML:" ));
218
219
219
220
#if defined(__aarch64__ )
220
- #define FIRST_KERNEL_MESSAGE "Booting Linux on physical CPU"
221
221
#define FIRST_FIRMWARE_MESSAGE "UEFI firmware starting"
222
222
#else
223
223
#define SGABIOS_STRING "\033[1;256r\033[256;256H\033[6n"
224
- #define FIRST_KERNEL_MESSAGE "Probing EDD"
225
224
#define FIRST_FIRMWARE_MESSAGE SGABIOS_STRING
226
225
#endif
227
226
227
+ /* Try to determine the first message that the kernel prints. */
228
+ #if defined(__aarch64__ )
229
+ first_kernel_message = "Booting Linux on physical CPU" ;
230
+ #else
231
+ first_kernel_message = "Probing EDD" ;
232
+ for (j = 0 ; j < data -> nr_events ; ++ j )
233
+ if (data -> events [j ].source == GUESTFS_EVENT_APPLIANCE &&
234
+ strstr (data -> events [j ].message , first_kernel_message ))
235
+ goto found_first_kernel_message ;
236
+ first_kernel_message = "Linux version " ;
237
+ for (j = 0 ; j < data -> nr_events ; ++ j )
238
+ if (data -> events [j ].source == GUESTFS_EVENT_APPLIANCE &&
239
+ strstr (data -> events [j ].message , first_kernel_message ))
240
+ goto found_first_kernel_message ;
241
+ error (EXIT_FAILURE , 0 , "could not determine first message printed by the kernel" );
242
+ found_first_kernel_message :
243
+ #endif
244
+
228
245
/* For the libvirt backend, find the overhead of libvirt. */
229
246
FIND_OPTIONAL ("libvirt:overhead" , 0 ,
230
247
data -> events [j ].source == GUESTFS_EVENT_LIBRARY &&
@@ -244,7 +261,7 @@ construct_timeline (void)
244
261
data -> events [j ].source == GUESTFS_EVENT_APPLIANCE &&
245
262
strstr (data -> events [j ].message , FIRST_FIRMWARE_MESSAGE ),
246
263
data -> events [k ].source == GUESTFS_EVENT_APPLIANCE &&
247
- strstr (data -> events [k ].message , FIRST_KERNEL_MESSAGE ));
264
+ strstr (data -> events [k ].message , first_kernel_message ));
248
265
249
266
#if defined(__i386__ ) || defined(__x86_64__ )
250
267
/* SGABIOS (option ROM). */
@@ -261,7 +278,7 @@ construct_timeline (void)
261
278
data -> events [j ].source == GUESTFS_EVENT_APPLIANCE &&
262
279
strstr (data -> events [j ].message , "SeaBIOS (version" ),
263
280
data -> events [k ].source == GUESTFS_EVENT_APPLIANCE &&
264
- strstr (data -> events [k ].message , FIRST_KERNEL_MESSAGE ));
281
+ strstr (data -> events [k ].message , first_kernel_message ));
265
282
#endif
266
283
267
284
#if defined(__i386__ ) || defined(__x86_64__ )
@@ -276,23 +293,23 @@ construct_timeline (void)
276
293
/* Find where we run the guest kernel. */
277
294
FIND ("kernel" , LONG_ACTIVITY ,
278
295
data -> events [j ].source == GUESTFS_EVENT_APPLIANCE &&
279
- strstr (data -> events [j ].message , FIRST_KERNEL_MESSAGE ),
296
+ strstr (data -> events [j ].message , first_kernel_message ),
280
297
data -> events [k ].source == GUESTFS_EVENT_CLOSE );
281
298
282
299
/* Kernel startup to userspace. */
283
300
FIND ("kernel:overhead" , 0 ,
284
301
data -> events [j ].source == GUESTFS_EVENT_APPLIANCE &&
285
- strstr (data -> events [j ].message , FIRST_KERNEL_MESSAGE ),
302
+ strstr (data -> events [j ].message , first_kernel_message ),
286
303
data -> events [k ].source == GUESTFS_EVENT_APPLIANCE &&
287
304
strstr (data -> events [k ].message , "supermin:" ) &&
288
305
strstr (data -> events [k ].message , "starting up" ));
289
306
290
307
/* The time taken to get into start_kernel function. */
291
- FIND ("kernel:entry" , 0 ,
308
+ FIND_OPTIONAL ("kernel:entry" , 0 ,
292
309
data -> events [j ].source == GUESTFS_EVENT_APPLIANCE &&
293
- strstr (data -> events [j ].message , FIRST_KERNEL_MESSAGE ),
310
+ strstr (data -> events [j ].message , first_kernel_message ),
294
311
data -> events [k ].source == GUESTFS_EVENT_APPLIANCE &&
295
- strstr (data -> events [k ].message , "Linux version" ));
312
+ strstr (data -> events [k ].message , "Linux version " ));
296
313
297
314
#if defined(__i386__ ) || defined(__x86_64__ )
298
315
/* Alternatives patching instructions (XXX not very accurate we
0 commit comments