diff --git a/xCAT-server/lib/xcat/plugins/mknb.pm b/xCAT-server/lib/xcat/plugins/mknb.pm index 01ddc5b95..baaac6e97 100644 --- a/xCAT-server/lib/xcat/plugins/mknb.pm +++ b/xCAT-server/lib/xcat/plugins/mknb.pm @@ -828,7 +828,7 @@ sub process_request { open($cfg, ">", "$tftpdir/xcat/xnba/nets/$net"); print $cfg "#!gpxe\n"; if ($invisibletouch) { - print $cfg 'imgfetch -n kernel http://${next-server}'.$portsuffix.'/tftpboot/xcat/genesis.kernel.' . "$arch xcatd=" . $xcatd_address . ":$xcatdport $consolecmdline BOOTIF=01-" . '${netX/machyp}' . "\n"; + print $cfg 'imgfetch -n kernel http://${next-server}'.$portsuffix.'/tftpboot/xcat/genesis.kernel.' . "$arch xcatd=" . $xcatd_address . ":$xcatdport $consolecmdline BOOTIF=01-" . '${netX/mac:hexhyp}' . "\n"; print $cfg 'imgfetch -n nbfs http://${next-server}'.$portsuffix . "$initrd_file\n"; } else { print $cfg 'imgfetch -n kernel http://${next-server}'.$portsuffix.'/tftpboot/xcat/nbk.' . "$arch xcatd=" . $xcatd_address . ":$xcatdport $consolecmdline\n"; diff --git a/xCAT-test/unit/mknb_exported_genesis.t b/xCAT-test/unit/mknb_exported_genesis.t index 5f523a9bf..3fd26df00 100644 --- a/xCAT-test/unit/mknb_exported_genesis.t +++ b/xCAT-test/unit/mknb_exported_genesis.t @@ -553,4 +553,32 @@ my $unsafe = xCAT_plugin::mknb::_select_genesis_source( ); is($unsafe, undef, 'unsupported architecture names cannot escape the image root'); +$::XCATROOT = "$tmpdir/openembedded-x86_64-xcatroot"; +prepare_export( + "$::XCATROOT/share/xcat/netboot/genesis-openembedded/x86_64", + 'openembedded x86_64 kernel', + 'openembedded x86_64 initramfs', + 'x86_64', +); +$xCAT::TableUtils::tftpdir = "$tmpdir/openembedded-x86_64-tftpboot"; +@responses = (); +xCAT_plugin::mknb::process_request( + { arg => ['x86_64'] }, + sub { push(@responses, @_); }, +); +ok( + !grep({ ref($_) eq 'HASH' && $_->{error} } @responses), + 'mknb installs an x86_64 OpenEmbedded export', +); +is( + read_file("$xCAT::TableUtils::tftpdir/xcat/genesis.kernel.x86_64"), + 'openembedded x86_64 kernel', + 'mknb publishes the OpenEmbedded x86_64 kernel', +); +like( + read_file("$xCAT::TableUtils::tftpdir/xcat/xnba/nets/192.0.2.0_24"), + qr{^imgfetch -n kernel \S+/xcat/genesis\.kernel\.x86_64 .* BOOTIF=01-\$\{netX/mac:hexhyp\}$}m, + 'the OpenEmbedded BIOS Genesis script takes BOOTIF from mac:hexhyp', +); + done_testing(); diff --git a/xCAT-test/unit/mknb_xcatd_address.t b/xCAT-test/unit/mknb_xcatd_address.t index 0a69dd2e0..281a1af8a 100644 --- a/xCAT-test/unit/mknb_xcatd_address.t +++ b/xCAT-test/unit/mknb_xcatd_address.t @@ -232,6 +232,20 @@ foreach my $relative_path ( ); } +my $bios_genesis = read_config( + "$xCAT::TableUtils::tftpdir/xcat/xnba/nets/192.168.144.0_20" +); +like( + $bios_genesis, + qr{^imgfetch -n kernel \S+/xcat/genesis\.kernel\.x86_64 .* BOOTIF=01-\$\{netX/mac:hexhyp\}$}m, + 'the BIOS Genesis script takes BOOTIF from mac:hexhyp', +); +unlike( + $bios_genesis, + qr/machyp/, + 'the BIOS Genesis script does not use the xNBA-only machyp setting', +); + use_reporter_address_maps(); prepare_tftpdir($tmpdir, 'tftpboot-x86-legacy', 'x86_64', 'legacy'); $responses = run_mknb('x86_64');