@@ -422,19 +422,22 @@ def prepare_iso(args, kernel_bin, user_bins):
422
422
shutil .copy (os .path .join (limine_path , 'limine-cd.bin' ), iso_root )
423
423
shutil .copy (os .path .join (limine_path , 'limine-cd-efi.bin' ), iso_root )
424
424
425
- initramfs_root = os .path .join (BUILD_DIR , 'initramfs_root ' )
426
- initramfs_bin = os . path . join ( initramfs_root , 'usr' , 'bin' )
425
+ sysroot_dir = os .path .join (SYSROOT_DIR , 'system-root ' )
426
+ shutil . copytree ( BASE_FILES_DIR , sysroot_dir , dirs_exist_ok = True )
427
427
428
- if os .path .exists (initramfs_root ):
429
- shutil .rmtree (initramfs_root )
428
+ # dynamic linker (ld.so)
429
+ mlibc = os .path .join (get_userland_package (), "mlibc" )
430
+ # gcc libraries required for rust programs
431
+ gcc = os .path .join (get_userland_package (), "gcc" )
430
432
431
- sysroot_dir = os .path .join (SYSROOT_DIR , 'system-root' )
433
+ # FIXME
434
+ if "host-rust-prebuilt" in str (mlibc ):
435
+ shutil .copytree (mlibc , sysroot_dir , dirs_exist_ok = True )
436
+ shutil .copytree (gcc , sysroot_dir , dirs_exist_ok = True )
432
437
433
- if os .path .exists (sysroot_dir ):
434
- # copying the sysroot will auto-magically create the bin directory.
435
- shutil .copytree (sysroot_dir , initramfs_root )
436
- else :
437
- os .makedirs (initramfs_bin )
438
+ for file in user_bins :
439
+ bin_name = os .path .basename (file )
440
+ shutil .copy (file , os .path .join (sysroot_dir , "usr" , "bin" , bin_name ))
438
441
439
442
def find (path ) -> List [str ]:
440
443
_ , find_output , _ = run_command (['find' , '.' , '-type' , 'f' ],
@@ -447,40 +450,15 @@ def find(path) -> List[str]:
447
450
lambda x : remove_prefix (x , './' ), files_without_dot )
448
451
files = list (files_without_prefix )
449
452
450
- return files
451
-
452
- def cp (src , dest ):
453
- files = find (src )
454
-
455
- for line in files :
456
- file = os .path .join (src , line )
457
- dest_file = os .path .join (dest , line )
458
-
459
- os .makedirs (os .path .dirname (dest_file ), exist_ok = True )
460
- shutil .copy (file , dest_file )
461
-
462
- # dynamic linker (ld.so)
463
- mlibc = os .path .join (get_userland_package (), "mlibc" )
464
- # gcc libraries required for rust programs
465
- gcc = os .path .join (get_userland_package (), "gcc" )
466
-
467
- if "host-rust-prebuilt" in str (mlibc ):
468
- cp (mlibc , initramfs_root )
469
- cp (gcc , initramfs_root )
470
-
471
- cp (BASE_FILES_DIR , initramfs_root )
472
-
473
- for file in user_bins :
474
- bin_name = os .path .basename (file )
475
-
476
- shutil .copy (file , os .path .join (initramfs_bin , bin_name ))
453
+ files .append ("usr/lib/libiconv.so.2" )
454
+ return files
477
455
478
- files = find (initramfs_root )
456
+ files = find (sysroot_dir )
479
457
480
458
with open (os .path .join (iso_root , 'initramfs.cpio' ), 'wb' ) as initramfs :
481
459
cpio_input = '\n ' .join (files )
482
460
code , _ , _ = run_command (['cpio' , '-o' , '-v' ],
483
- cwd = initramfs_root ,
461
+ cwd = sysroot_dir ,
484
462
stdout = initramfs ,
485
463
stderr = subprocess .PIPE ,
486
464
input = cpio_input .encode ('utf-8' ))
@@ -529,7 +507,7 @@ def run_in_emulator(args, iso_path):
529
507
530
508
qemu_args = ['-cdrom' , iso_path ,
531
509
'-M' , 'q35' ,
532
- '-m' , '9G ' ,
510
+ '-m' , '9800M ' ,
533
511
'-smp' , '5' ,
534
512
'-serial' , 'stdio' ]
535
513
0 commit comments