@@ -87,6 +87,10 @@ type LaunchConfig struct {
8787 // API
8888 APIPort int
8989
90+ // sd-stub
91+ sdStubExtraCmdline string
92+ sdStubExtraCmdlineConfig string
93+
9094 // filled by CNI invocation
9195 tapName string
9296 vmMAC string
@@ -319,7 +323,7 @@ func launchVM(config *LaunchConfig) error {
319323 "-no-reboot" ,
320324 "-boot" , fmt .Sprintf ("order=%s,reboot-timeout=5000" , bootOrder ),
321325 "-smbios" , fmt .Sprintf ("type=1,uuid=%s" , config .NodeUUID ),
322- "-smbios" , "type=11,value=io.systemd.stub.kernel-cmdline-extra=console=ttyS0" ,
326+ "-smbios" , fmt . Sprintf ( "type=11,value=io.systemd.stub.kernel-cmdline-extra=%s" , config . sdStubExtraCmdline ) ,
323327 "-chardev" , fmt .Sprintf ("socket,path=%s/%s.sock,server=on,wait=off,id=qga0" , config .StatePath , config .Hostname ),
324328 "-device" , "virtio-serial" ,
325329 "-device" , "virtserialport,chardev=qga0,name=org.qemu.guest_agent.0" ,
@@ -487,12 +491,14 @@ func launchVM(config *LaunchConfig) error {
487491 "-kernel" , config .UKIPath ,
488492 "-append" , config .KernelArgs ,
489493 )
494+ config .sdStubExtraCmdline += config .sdStubExtraCmdlineConfig
490495 case config .KernelImagePath != "" :
491496 args = append (args ,
492497 "-kernel" , config .KernelImagePath ,
493498 "-initrd" , config .InitrdPath ,
494499 "-append" , config .KernelArgs ,
495500 )
501+ config .sdStubExtraCmdline += config .sdStubExtraCmdlineConfig
496502 }
497503 }
498504
@@ -592,7 +598,12 @@ func Launch() error {
592598 defer httpServer .Shutdown (ctx ) //nolint:errcheck
593599
594600 // patch kernel args
595- config .KernelArgs = strings .ReplaceAll (config .KernelArgs , "{TALOS_CONFIG_URL}" , fmt .Sprintf ("http://%s/config.yaml" , httpServer .GetAddr ()))
601+ config .sdStubExtraCmdline = "console=ttyS0"
602+
603+ if strings .Contains (config .KernelArgs , "{TALOS_CONFIG_URL}" ) {
604+ config .KernelArgs = strings .ReplaceAll (config .KernelArgs , "{TALOS_CONFIG_URL}" , fmt .Sprintf ("http://%s/config.yaml" , httpServer .GetAddr ()))
605+ config .sdStubExtraCmdlineConfig = fmt .Sprintf (" talos.config=http://%s/config.yaml" , httpServer .GetAddr ())
606+ }
596607
597608 return withCNI (ctx , & config , func (config * LaunchConfig ) error {
598609 for {
0 commit comments