@@ -422,19 +422,22 @@ def prepare_iso(args, kernel_bin, user_bins):
422422 shutil .copy (os .path .join (limine_path , 'limine-cd.bin' ), iso_root )
423423 shutil .copy (os .path .join (limine_path , 'limine-cd-efi.bin' ), iso_root )
424424
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 )
427427
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" )
430432
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 )
432437
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 ))
438441
439442 def find (path ) -> List [str ]:
440443 _ , find_output , _ = run_command (['find' , '.' , '-type' , 'f' ],
@@ -447,40 +450,15 @@ def find(path) -> List[str]:
447450 lambda x : remove_prefix (x , './' ), files_without_dot )
448451 files = list (files_without_prefix )
449452
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
477455
478- files = find (initramfs_root )
456+ files = find (sysroot_dir )
479457
480458 with open (os .path .join (iso_root , 'initramfs.cpio' ), 'wb' ) as initramfs :
481459 cpio_input = '\n ' .join (files )
482460 code , _ , _ = run_command (['cpio' , '-o' , '-v' ],
483- cwd = initramfs_root ,
461+ cwd = sysroot_dir ,
484462 stdout = initramfs ,
485463 stderr = subprocess .PIPE ,
486464 input = cpio_input .encode ('utf-8' ))
@@ -529,7 +507,7 @@ def run_in_emulator(args, iso_path):
529507
530508 qemu_args = ['-cdrom' , iso_path ,
531509 '-M' , 'q35' ,
532- '-m' , '9G ' ,
510+ '-m' , '9800M ' ,
533511 '-smp' , '5' ,
534512 '-serial' , 'stdio' ]
535513
0 commit comments