--- a/catalyst +++ a/catalyst @@ -131,6 +131,10 @@ def parse_config(myconfig): print "Icecream compiler cluster support enabled." conf_values["ICECREAM"]="1" + if "qemu" in string.split(conf_values["options"]): + print "Qemu support enabled." + conf_values["QEMU"]="1" + if "kerncache" in string.split(conf_values["options"]): print "Kernel cache support enabled." conf_values["KERNCACHE"]="1" --- a/modules/catalyst_support.py +++ a/modules/catalyst_support.py @@ -207,6 +207,7 @@ valid_config_file_values.append("KERNCACHE") valid_config_file_values.append("CCACHE") valid_config_file_values.append("DISTCC") valid_config_file_values.append("ICECREAM") +valid_config_file_values.append("QEMU") valid_config_file_values.append("ENVSCRIPT") valid_config_file_values.append("AUTORESUME") valid_config_file_values.append("FETCH") --- a/modules/generic_stage_target.py +++ a/modules/generic_stage_target.py @@ -138,6 +138,7 @@ class generic_stage_target(generic_target): self.set_dest_path() self.set_stage_path() self.set_target_path() + self.set_crossroot_path() self.set_controller_file() self.set_action_sequence() @@ -439,6 +440,10 @@ class generic_stage_target(generic_target): if not os.path.exists(self.settings["autoresume_path"]): os.makedirs(self.settings["autoresume_path"],0755) + def set_crossroot_path(self): + self.settings["crossroot_path"]=normpath(self.settings["storedir"]+\ + "/crossroot/") + def set_controller_file(self): self.settings["controller_file"]=normpath(self.settings["sharedir"]+\ "/targets/"+self.settings["target"]+"/"+self.settings["target"]+\ @@ -458,7 +463,7 @@ class generic_stage_target(generic_target): """ Default action sequence for run method """ self.settings["action_sequence"]=["unpack","unpack_snapshot",\ "config_profile_link","setup_confdir","portage_overlay",\ - "base_dirs","bind","chroot_setup","setup_environment",\ + "base_dirs","qemu_setup","bind","chroot_setup","setup_environment",\ "run_local","preclean","unbind","clean"] # if self.settings.has_key("TARBALL") or \ # not self.settings.has_key("FETCH"): @@ -1034,6 +1039,34 @@ class generic_stage_target(generic_target): "Could not backup /etc/portage/make.conf",env=self.env) touch(self.settings["autoresume_path"]+"chroot_setup") + def qemu_setup(self): + if not self.settings.has_key("QEMU"): + return + + if self.settings.has_key("AUTORESUME") \ + and os.path.exists(self.settings["autoresume_path"]+"qemu_setup"): + print "Resume point detected, skipping qemu_setup operation..." + else: + print "Setting up qemu..." + + if self.settings["crosscompile"]: + cmd("mkdir -p "+self.settings["crossroot_path"]) + cmd('USE="static static-libs -acl -nls -idn -ssl" emerge --oneshot --noreplace --quiet --root='+self.settings["crossroot_path"]+" app-arch/tar app-arch/bzip2 app-arch/gzip sys-apps/findutils sys-apps/sed sys-devel/make",\ + "Could not build static binaries",env=self.env) + + cmd("cp /usr/bin/qemu-static-"+self.settings["hostarch"]+" "+self.settings["chroot_path"]+\ + "usr/bin",\ + "Could not copy qemu-static-"+self.settings["hostarch"],env=self.env) + cmd("cp "+self.settings["sharedir"]+"/targets/support/qemu-binfmt "+self.settings["chroot_path"]+\ + "usr/bin/qemu-static-"+self.settings["hostarch"]+"-binfmt",\ + "Could not copy qemu-binfmt",env=self.env) + + touch(self.settings["autoresume_path"]+"qemu_setup") + + self.mounts.append("/crossroot") + self.mountmap["/crossroot"]=\ + self.settings["crossroot_path"] + def fsscript(self): if self.settings.has_key("AUTORESUME") \ and os.path.exists(self.settings["autoresume_path"]+"fsscript"): @@ -1090,6 +1123,13 @@ class generic_stage_target(generic_target): "clean script failed.",env=self.env) touch(self.settings["autoresume_path"]+"clean") + """ Clean up qemu """ + if self.settings.has_key("QEMU") and self.settings["crosscompile"]: + cmd("rm -f "+self.settings["stage_path"]+"/usr/bin/qemu-static-"+self.settings["hostarch"],\ + "Could not remove qemu-static-"+self.settings["hostarch"],env=self.env) + cmd("rm -f "+self.settings["stage_path"]+"/usr/bin/qemu-static-"+self.settings["hostarch"]+"-binfmt",\ + "Could not remove qemu-static-"+self.settings["hostarch"]+"-binfmt",env=self.env) + def empty(self): if self.settings.has_key("AUTORESUME") \ and os.path.exists(self.settings["autoresume_path"]+"empty"): --- a/modules/stage4_target.py +++ a/modules/stage4_target.py @@ -26,7 +26,7 @@ class stage4_target(generic_stage_target): def set_action_sequence(self): self.settings["action_sequence"]=["unpack","unpack_snapshot",\ "config_profile_link","setup_confdir","portage_overlay",\ - "bind","chroot_setup","setup_environment","build_packages",\ + "qemu_setup","bind","chroot_setup","setup_environment","build_packages",\ "build_kernel","bootloader","root_overlay","fsscript",\ "preclean","rcupdate","unmerge","unbind","remove","empty",\ "clean"]