@@ -40,6 +40,7 @@ def parse_args():
4040 # If using FW_PAYLOAD, set these args for rootfs and opensbi
4141 parser .add_argument ("--boot_device" , type = str , required = False , default = "vda" , help = "Options: vda, vdaX or initramfs" )
4242 parser .add_argument ("--dt_no_virtio_devices" , action = "store_true" , help = "Don't patch DT to add virtio device nodes" )
43+ parser .add_argument ("--extra_bootargs" , type = str , default = "" , help = "Extra kernel command line arguments" )
4344
4445 # Only used for initramfs
4546 parser .add_argument ("--rootfs_bin" , type = str , required = False , help = "Path to initramfs" )
@@ -114,7 +115,7 @@ def main():
114115 opensbi_addr = int (args .opensbi_dst [idx ], 16 )
115116 opensbi_bytes = read_bin_file (args .opensbi_bin )
116117
117- if args .rootfs_dst and args .rootfs_bin :
118+ if args .rootfs_dst and args .rootfs_bin and os . path . exists ( args . rootfs_bin ) :
118119 rootfs_addr = int (args .rootfs_dst [idx ], 16 )
119120 rootfs_bytes = read_bin_file (args .rootfs_bin )
120121
@@ -139,10 +140,13 @@ def main():
139140 if args .boot_device [:len ("vda" )] == "vda" :
140141 bootargs += f" root=/dev/{ args .boot_device } "
141142 elif args .boot_device == "initramfs" :
142- bootargs += f" initrd={ args .rootfs_dst [idx ]} ,{ len (rootfs_bytes )} "
143+ if os .path .exists (args .rootfs_bin ):
144+ bootargs += f" initrd={ args .rootfs_dst [idx ]} ,{ len (rootfs_bytes )} "
143145 else :
144146 print ("Unsupported rootfs type" )
145147 exit (1 )
148+ if args .extra_bootargs :
149+ bootargs += f" { args .extra_bootargs } "
146150 fdt .setprop (chosen_offset , "bootargs" , bytes (bootargs , encoding = "utf-8" ) + b'\0 ' )
147151
148152 memory_node = fdt .path_offset ("/memory@400030000000" , libfdt .QUIET_NOTFOUND )
@@ -205,7 +209,7 @@ def main():
205209 print (f"Writing OpenSBI to 0x{ opensbi_addr :x} " )
206210 chip .noc_write (0 , l2cpu_noc_x , l2cpu_noc_y , opensbi_addr , opensbi_bytes )
207211
208- if args .rootfs_dst and args .rootfs_bin :
212+ if args .rootfs_dst and args .rootfs_bin and os . path . exists ( args . rootfs_bin ) :
209213 print (f"Writing rootfs to 0x{ rootfs_addr :x} " )
210214 chip .noc_write (0 , l2cpu_noc_x , l2cpu_noc_y , rootfs_addr , rootfs_bytes )
211215
0 commit comments