# Copyright 2002-2007 Gentoo Foundation; Distributed under the GPL v2
# $Id: $
+ 09 Jan 2007; Chris Gianelloni <wolf31o2@gentoo.org> arch/alpha.py,
+ arch/amd64.py, arch/arm.py, arch/hppa.py, arch/ia64.py, arch/mips.py,
+ arch/ppc.py, arch/ppc64.py, arch/s390.py, arch/sh.py, arch/sparc.py,
+ arch/sparc64.py, arch/x86.py, modules/generic_stage_target.py,
+ targets/netboot/netboot-combine.sh, targets/support/bootloader-setup.sh,
+ targets/support/create-iso.sh, targets/support/functions.sh,
+ targets/support/netboot2-final.sh, targets/support/pre-kmerge.sh:
+ Added a patch from Mike Frysinger <vapier@gentoo.org> to support cbuild.
+
02 Jan 2007; Chris Gianelloni <wolf31o2@gentoo.org> README, arch/alpha.py,
arch/amd64.py, arch/arm.py, arch/hppa.py, arch/ia64.py, arch/mips.py,
arch/ppc.py, arch/ppc64.py, arch/s390.py, arch/sh.py, arch/sparc.py,
"abstract base class for all alpha builders"
def __init__(self,myspec):
builder.generic.__init__(self,myspec)
- self.settings["mainarch"]="alpha"
self.settings["CHROOT"]="chroot"
self.settings["CFLAGS"]="-mieee -pipe"
"abstract base class for all amd64 builders"
def __init__(self,myspec):
builder.generic.__init__(self,myspec)
- self.settings["mainarch"]="amd64"
self.settings["CHROOT"]="chroot"
class arch_amd64(generic_amd64):
"Abstract base class for all arm (little endian) builders"
def __init__(self,myspec):
builder.generic.__init__(self,myspec)
- self.settings["mainarch"]="arm"
self.settings["CHROOT"]="chroot"
self.settings["CFLAGS"]="-O2 -pipe"
self.settings["CXXFLAGS"]="-O1 -pipe"
"Abstract base class for all arm (big endian) builders"
def __init__(self,myspec):
builder.generic.__init__(self,myspec)
- self.settings["mainarch"]="arm"
self.settings["CHROOT"]="chroot"
self.settings["CFLAGS"]="-O2 -pipe"
self.settings["CXXFLAGS"]="-O1 -pipe"
"Abstract base class for all hppa builders"
def __init__(self,myspec):
builder.generic.__init__(self,myspec)
- self.settings["mainarch"]="hppa"
self.settings["CHROOT"]="chroot"
self.settings["CFLAGS"]="-O2 -pipe"
self.settings["CXXFLAGS"]="-O2 -pipe"
"builder class for ia64"
def __init__(self,myspec):
builder.generic.__init__(self,myspec)
- self.settings["mainarch"]="ia64"
self.settings["CHROOT"]="chroot"
self.settings["CFLAGS"]="-O2 -pipe"
self.settings["CFLAGS"]="-O2 -pipe"
"Abstract base class for all mips builders [Big-endian]"
def __init__(self,myspec):
builder.generic.__init__(self,myspec)
- self.settings["mainarch"]="mips"
self.settings["CHROOT"]="chroot"
self.settings["CHOST"]="mips-unknown-linux-gnu"
"Abstract base class for all mipsel builders [Little-endian]"
def __init__(self,myspec):
builder.generic.__init__(self,myspec)
- self.settings["mainarch"]="mips"
self.settings["CHROOT"]="chroot"
self.settings["CHOST"]="mipsel-unknown-linux-gnu"
"abstract base class for all ppc builders"
def __init__(self,myspec):
builder.generic.__init__(self,myspec)
- self.settings["mainarch"]="ppc"
self.settings["CHOST"]="powerpc-unknown-linux-gnu"
- if self.settings["hostarch"]=="ppc64":
+ if self.settings["buildarch"]=="ppc64":
if not os.path.exists("/bin/linux32"):
raise CatalystError,"required /bin/linux32 executable not found (\"emerge setarch\" to fix."
self.settings["CHROOT"]="linux32 chroot"
+ self.settings["crosscompile"] = False;
else:
self.settings["CHROOT"]="chroot"
"abstract base class for all ppc64 builders"
def __init__(self,myspec):
builder.generic.__init__(self,myspec)
- self.settings["mainarch"]="ppc64"
self.settings["CHROOT"]="chroot"
class arch_ppc64(generic_ppc64):
"abstract base class for all s390 builders"
def __init__(self,myspec):
builder.generic.__init__(self,myspec)
- self.settings["mainarch"]="s390"
self.settings["CHROOT"]="chroot"
class arch_s390(generic_s390):
"Abstract base class for all sh builders [Little-endian]"
def __init__(self,myspec):
builder.generic.__init__(self,myspec)
- self.settings["mainarch"]="sh"
self.settings["CHROOT"]="chroot"
class generic_sheb(builder.generic):
"Abstract base class for all sheb builders [Big-endian]"
def __init__(self,myspec):
builder.generic.__init__(self,myspec)
- self.settings["mainarch"]="sh"
self.settings["CHROOT"]="chroot"
class arch_sh(generic_sh):
"abstract base class for all sparc builders"
def __init__(self,myspec):
builder.generic.__init__(self,myspec)
- self.settings["mainarch"]="sparc"
- if self.settings["hostarch"]=="sparc64":
+ if self.settings["buildarch"]=="sparc64":
if not os.path.exists("/bin/linux32"):
raise CatalystError,"required /bin/linux32 executable not found (\"emerge setarch\" to fix.)"
self.settings["CHROOT"]="linux32 chroot"
+ self.settings["crosscompile"] = False;
else:
self.settings["CHROOT"]="chroot"
"abstract base class for all sparc64 builders"
def __init__(self,myspec):
builder.generic.__init__(self,myspec)
- self.settings["mainarch"]="sparc64"
self.settings["CHROOT"]="chroot"
class arch_sparc64(generic_sparc64):
"abstract base class for all x86 builders"
def __init__(self,myspec):
builder.generic.__init__(self,myspec)
- self.settings["mainarch"]="x86"
- if self.settings["hostarch"]=="amd64":
+ if self.settings["buildarch"]=="amd64":
if not os.path.exists("/bin/linux32"):
raise CatalystError,"required /bin/linux32 executable not found (\"emerge setarch\" to fix.)"
self.settings["CHROOT"]="linux32 chroot"
+ self.settings["crosscompile"] = False;
else:
self.settings["CHROOT"]="chroot"
self.valid_values.extend(["version_stamp","target","subarch",\
"rel_type","profile","snapshot","source_subpath","portage_confdir",\
- "cflags","cxxflags","ldflags","chost","hostuse","portage_overlay",\
+ "cflags","cxxflags","ldflags","cbuild","chost","hostuse","portage_overlay",\
"distcc_hosts","makeopts","pkgcache_path","kerncache_path"])
self.set_valid_build_kernel_vars(addlargs)
generic_target.__init__(self,myspec,addlargs)
- # map the mainarch we are running under to the mainarches we support for
- # building stages and LiveCDs. (for example, on amd64, we can build
- # stages for x86 or amd64.
- targetmap={
- "x86" : ["x86"],
- "amd64" : ["x86","amd64"],
- "sparc64" : ["sparc","sparc64"],
- "ia64" : ["ia64"],
- "alpha" : ["alpha"],
- "sparc" : ["sparc"],
- "sh" : ["sh"],
- "s390" : ["s390"],
- "ppc" : ["ppc"],
- "ppc64" : ["ppc","ppc64"],
- "hppa" : ["hppa"],
- "mips" : ["mips"],
- "arm" : ["arm"]
- }
-
- machinemap={
+ machinemap={
"i386" : "x86",
"i486" : "x86",
"i586" : "x86",
"i686" : "x86",
"x86_64" : "amd64",
+ "sparc" : "sparc",
"sparc64" : "sparc64",
"ia64" : "ia64",
"alpha" : "alpha",
- "sparc" : "sparc",
"sh2" : "sh",
"sh3" : "sh",
"sh4" : "sh",
"s390" : "s390",
"ppc" : "ppc",
"ppc64" : "ppc64",
- "parisc" : "hppa",
- "parisc64" : "hppa",
+ "powerpc" : "powerpc",
+ "powerpc64" : "powerpc64",
+ "parisc" : "parisc",
+ "parisc64" : "parisc",
+ "hppa" : "hppa",
+ "hppa64" : "hppa",
"mips" : "mips",
"mips64" : "mips",
"arm" : "arm",
"armv5b" : "arm"
}
- mymachine=os.uname()[4]
- if not machinemap.has_key(mymachine):
- raise CatalystError, "Unknown machine type "+mymachine
-
- self.settings["hostarch"]=machinemap[mymachine]
- self.archmap={}
- self.subarchmap={}
+ if self.settings.has_key("chost"):
+ hostmachine = self.settings["chost"].split("-")[0]
+ else:
+ hostmachine = os.uname()[4]
+ if not machinemap.has_key(hostmachine):
+ raise CatalystError, "Unknown host machine type "+hostmachine
+ self.settings["hostarch"] = machinemap[hostmachine]
+ if self.settings.has_key("cbuild"):
+ buildmachine = self.settings["cbuild"].split("-")[0]
+ else:
+ buildmachine = os.uname()[4]
+ if not machinemap.has_key(buildmachine):
+ raise CatalystError, "Unknown build machine type "+buildmachine
+ self.settings["buildarch"] = machinemap[buildmachine]
+ self.settings["crosscompile"] = (self.settings["hostarch"] != self.settings["buildarch"])
+ self.archmap = {}
+ self.subarchmap = {}
- for x in targetmap[self.settings["hostarch"]]:
- try:
- fh=open(self.settings["sharedir"]+"/arch/"+x+".py")
- # This next line loads the plugin as a module and assigns it to
- # archmap[x]
- self.archmap[x]=imp.load_module(x,fh,"arch/"+x+".py",(".py","r",imp.PY_SOURCE))
- # This next line registers all the subarches supported in the
- # plugin
- self.archmap[x].register(self.subarchmap)
- fh.close()
-
- except IOError:
- msg("Can't find "+x+".py plugin in "+self.settings["sharedir"]+"/arch/")
+ x = self.settings["hostarch"]
+ try:
+ fh = open(self.settings["sharedir"]+"/arch/"+x+".py")
+ # this next line loads the plugin as a module and assigns it to archmap[x]
+ self.archmap[x] = imp.load_module(x,fh,"arch/"+x+".py",(".py","r",imp.PY_SOURCE))
+ # this next line registers all the subarches supported in the plugin
+ self.archmap[x].register(self.subarchmap)
+ fh.close()
+ except IOError:
+ msg("Can't find "+x+".py plugin in "+self.settings["sharedir"]+"/arch/")
# Call arch constructor, pass our settings
try:
self.arch=self.subarchmap[self.settings["subarch"]](self.settings)
- except:
+ except:
print "Invalid subarch: "+self.settings["subarch"]
print "Choose one of the following:",
for x in self.subarchmap:
sys.exit(2)
print "Using target:",self.settings["target"]
- # self.settings["mainarch"] should now be set by our arch constructor,
- # so we print a nice informational message:
- if self.settings["mainarch"]==self.settings["hostarch"]:
+ # print a nice informational message:
+ if self.settings["buildarch"]==self.settings["hostarch"]:
print "Building natively for",self.settings["hostarch"]
-
+ elif self.settings["crosscompile"]:
+ print "Cross-compiling on",self.settings["buildarch"],"for different machine type",\
+ self.settings["hostarch"]
else:
- print "Building on",self.settings["hostarch"],"for alternate machine type",\
- self.settings["mainarch"]
+ print "Building on",self.settings["buildarch"],"for alternate personality type",\
+ self.settings["hostarch"]
+
# This should be first to be set as other set_ options depend on this
self.set_spec_prefix()
# for the chroot:
self.env["CCACHE_DIR"]="/var/tmp/ccache"
+ def override_cbuild(self):
+ if self.makeconf.has_key("CBUILD"):
+ self.settings["CBUILD"]=self.makeconf["CBUILD"]
+
def override_chost(self):
if self.makeconf.has_key("CHOST"):
self.settings["CHOST"]=self.makeconf["CHOST"]
def chroot_setup(self):
self.makeconf=read_makeconf(self.settings["chroot_path"]+"/etc/make.conf")
- self.override_chost()
+ self.override_cbuild()
+ self.override_chost()
self.override_cflags()
self.override_cxxflags()
self.override_ldflags()
cmd("mv "+self.settings["chroot_path"]+"/etc/hosts "+self.settings["chroot_path"]+\
"/etc/hosts.bck", "Could not backup /etc/hosts",env=self.env)
cmd("cp /etc/hosts "+self.settings["chroot_path"]+"/etc/hosts", "Could not copy /etc/hosts",env=self.env)
- #self.override_chost()
+ #self.override_cbuild()
+ #self.override_chost()
#self.override_cflags()
#self.override_cxxflags()
#self.override_ldflags()
if self.settings.has_key("LDFLAGS"):
myf.write('LDFLAGS="'+self.settings["LDFLAGS"]+'"\n')
myf.write("# This should not be changed unless you know exactly what you are doing. You\n# should probably be using a different stage, instead.\n")
+ if self.settings.has_key("CBUILD"):
+ myf.write('CBUILD="'+self.settings["CBUILD"]+'"\n')
myf.write('CHOST="'+self.settings["CHOST"]+'"\n')
# Figure out what our USE vars are for building
self.purge()
for x in self.settings["action_sequence"]:
- print "Running action sequence: "+x
+ print "--- Running action sequence: "+x
sys.stdout.flush()
try:
apply(getattr(self,x))
# First install the boot package that we need
booter=""
-case ${clst_mainarch} in
+case ${clst_hostarch} in
alpha)
booter=""
;;
create_normal_loop ${clst_chroot_path}/tmp/staging/initrd-${kname} ${clst_target_path} initrd-${kname}.igz
rm -r ${clst_chroot_path}/tmp/staging/initrd-${kname}
- case ${clst_mainarch} in
+ case ${clst_hostarch} in
alpha)
# Until aboot is patched this is broken currently.
# please use catalyst 1.1.5 or older
;;
sparc*)
#TEST TEST TEST TEST
- #elftoaout -o /netboot-${kname}.${clst_mainarch} /usr/src/linux/vmlinux
- #elftoaout -o /netboot-${kname}.${clst_mainarch} /${kname}
- #piggy=${clst_mainarch/sparc/piggyback}
- #${piggy} /netboot-${kname}.${clst_mainarch} /usr/src/linux/System.map /initrd-${kname}.igz
+ #elftoaout -o /netboot-${kname}.${clst_hostarch} /usr/src/linux/vmlinux
+ #elftoaout -o /netboot-${kname}.${clst_hostarch} /${kname}
+ #piggy=${clst_hostarch/sparc/piggyback}
+ #${piggy} /netboot-${kname}.${clst_hostarch} /usr/src/linux/System.map /initrd-${kname}.igz
;;
x86)
mknbi-linux \
default_append_line="root=/dev/ram0 init=/linuxrc ${cmdline_opts} ${custom_kopts} cdroot"
-case ${clst_mainarch} in
+case ${clst_hostarch} in
alpha)
# NO SOFTLEVEL SUPPORT YET
acfg=$1/etc/aboot.conf
## START RUNSCRIPT
# Check for our CD ISO creation tools
-case ${clst_mainarch} in
+case ${clst_hostarch} in
mips)
cdmaker="sgibootcd"
cdmakerpkg="sys-boot/sgibootcd"
then
case ${clst_livecd_type} in
gentoo-*)
- case ${clst_mainarch} in
+ case ${clst_hostarch} in
alpha)
clst_iso_volume_id="Gentoo Linux - Alpha"
;;
fi
# Here we actually create the ISO images for each architecture
-case ${clst_mainarch} in
+case ${clst_hostarch} in
alpha)
case ${clst_fstype} in
zisofs)
;;
esac
}
+
+run_crossdev() {
+ crossdev ${clst_CHOST}
+}
# Any post-processing necessary for each architecture can be done here. This
# may include things like sparc's elftoaout, x86's PXE boot, etc.
-case ${clst_mainarch} in
+case ${clst_hostarch} in
alpha)
sleep 0
;;
# Setup case structure for livecd_type
case ${clst_livecd_type} in
gentoo-release-minimal | gentoo-release-universal)
- case ${clst_mainarch} in
+ case ${clst_hostarch} in
amd64|x86)
sed -i 's/initramfs_data.cpio.gz /initramfs_data.cpio.gz -r 1024x768 /' /usr/share/genkernel/genkernel
;;
sed -e "s/@@MYDATE@@/${clst_netboot2_builddate}/g" \
-e "s/@@RELVER@@/${clst_version_stamp}/g" \
${clst_root_path}usr/share/genkernel/netboot/linuxrc.x \
- > ${clst_root_path}usr/share/genkernel/${clst_mainarch}/linuxrc
+ > ${clst_root_path}usr/share/genkernel/${clst_hostarch}/linuxrc
echo ">>> Copying support files to ${clst_root_path} ..."
cp -pPRf ${clst_root_path}usr/share/genkernel/netboot/misc/* \
${clst_merge_path}
echo ">>> Copying busybox config ..."
- cp -f ${clst_root_path}usr/share/genkernel/${clst_mainarch}/nb-busybox.cf \
- ${clst_root_path}usr/share/genkernel/${clst_mainarch}/busy-config
+ cp -f ${clst_root_path}usr/share/genkernel/${clst_hostarch}/nb-busybox.cf \
+ ${clst_root_path}usr/share/genkernel/${clst_hostarch}/busy-config
;;
esac