Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 37176 Details for
Bug 59991
new eclass - xnu.eclass
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
xnu.eclass initial submisison
xnu.eclass (text/plain), 5.76 KB, created by
Kito (RETIRED)
on 2004-08-10 14:07:26 UTC
(
hide
)
Description:
xnu.eclass initial submisison
Filename:
MIME Type:
Creator:
Kito (RETIRED)
Created:
2004-08-10 14:07:26 UTC
Size:
5.76 KB
patch
obsolete
># Copyright 1999-2004 Gentoo Foundation ># Distributed under the terms of the GNU General Public License v2 ># $Header: ># ># xnu.eclass is based on kswap.sh v1.0.0b5 2003/06/09 1125 -7 gmt ># written by jean-pierre mouilleseaux ># http://opendarwin.org/~jpm/naughty/darwin/kswap.sh ># jpm@opendarwin.org ># ># this eclass provides the functions to simplify booting from an ># alternative mach_kernel without having to overwrite the currently ># booted kernel (which is very bad, mmk?) > >ECLASS=xnu >INHERITED="$INHERITED $ECLASS" >EXPORT_FUNCTIONS src_unpack src_compile src_install pkg_postrm > ># to prevent errors if theres no sources in /usr/src ># we set KV and re-set it later on as well. >[ -z "${KV}" ] && KV=${PV} > >HOMEPAGE="http://www.opendarwin.org/ http://www.gentoo.org/" >LICENSE="GPL-2" >IUSE="" >#SLOT="${KV}" >SLOT="0" > >DEPEND="=sys-darwin/bootstrap_cmds-44 > =sys-darwin/Libstreams-23 > =sys-darwin/cctools-495.8 > =sys-darwin/kext_tools-42 > " > > >## ># Variables and Constants >#================================================================= > ># Grab kernel version from KV >KV_MAJOR=$(echo ${KV} | cut -d. -f1) >KV_MINOR=$(echo ${KV} | cut -d. -f2) >KV_PATCH=$(echo ${KV} | cut -d. -f3) >KV_PATCH=${KV_PATCH/[-_]*/} > >RKV_MAJOR=$(uname -v | cut -d - -f2 | cut -d . -f1) >RKV_MINOR=$(uname -v | cut -d - -f2 | cut -d . -f2) >RKV_PATCH=$(uname -v | cut -d - -f2 | cut -d . -f1) > >RKV=${RKV_MAJOR}"."${RKV_MINOR}"."${RKV_PATCH} > >KERNEL_STABLE="mach_kernel" >KERNEL_DEV="mach_kernel-${KV}" > >KERNEL="" > >#powerpc >BOOTFILE_BASE="" > >#x86 >DEFAULT_TABLE="/private/Drivers/i386/System.config/Default.table" > >PERMS="" >PERMS_644='-rw-r--r--' > >COMMA="," >SLASH="/" > >## ># Custom functions >#================================================================= >kernel_check() { > > # make sure kernel of interest exists > if [ ! -f ${SLASH}${KERNEL} ]; then > echo "error:" ${SLASH}${KERNEL} "does not exist" > exit 1 > fi > > # verify kernel file is owned by root > if [ ! -O ${SLASH}${KERNEL} ]; then > echo "error:" ${SLASH}${KERNEL} "is not owned by root" > echo "setting ownership to root..." > chown root ${SLASH}${KERNEL} > fi > > # check kernel file permissions > if [ `ls -l ${SLASH}${KERNEL} | awk '{print $1}'` != ${PERMS_644} ]; then > echo "error:" ${SLASH}${KERNEL} "does not have the proper permissions of 644" > echo "setting permissions to 644" > chmod 644 ${SLASH}${KERNEL} > fi >} > ># ># function to tell OF which kernel to boot on powerpc ># >set_bootfile() { > BOOTFILE_BASE=`nvram boot-device | awk -F , '{print $1}' | awk '{print $2}'` > > if [ ! BOOTFILE_BASE ] ; then > echo "error: bootfile_base = <null>" > exit 1 > fi; > > nvram boot-file=${BOOTFILE_BASE}${COMMA}${KERNEL} > nvram -p | grep boot-file > einfo "========================================================================" > echo > einfo "active kernel upon reboot: ${KERNEL}" > echo > einfo "If you have problems booting, reset your pram by holding down" > einfo "command-option-p-r through 3 boot chimes, this will revert to the default" > einfo "kernel." > echo > einfo "========================================================================" > >} > ># ># default boot action for i386 ># >set_defaulttable() { > KERNEL=`echo ${KERNEL} | sed "s/^\///"` > `cp ${DEFAULT_TABLE} ${DEFAULT_TABLE}.old` > `sed "s/^\"Kernel\" = \"[a-z_0-9A-Z.\-]*\"/\"Kernel\" = \"${KERNEL}\"/" ${DEFAULT_TABLE} > ${DEFAULT_TABLE}.new` > `mv ${DEFAULT_TABLE}.new ${DEFAULT_TABLE}` >} > >## ># install gentoo xnu >## >gentookernel () { > KERNEL=${KERNEL_DEV} > > kernel_check > > if [ `uname -p` == "powerpc" ]; then > set_bootfile > elif [ `uname -p` == "i386" ]; then > set_defaulttable > else > echo "error: xnu will currently only run on powerpc and x86 hardware." > exit 1 > fi; >} > >## ># install default xnu >## >defaultkernel () { > KERNEL=${KERNEL_STABLE} > > einfo "========================================================================" > echo > einfo " Reverting back to stable kernel" > echo > einfo "========================================================================" > > kernel_check > > if [ `uname -p` == "powerpc" ]; then > set_bootfile > elif [ `uname -p` == "i386" ]; then > set_defaulttable > fi >} > >## ># install xnu sources >## >xnusources() { > cd ${S} > dodir /usr/src > einfo ">>> Copying sources..." > cp -R ${S} ${D}/usr/src/xnu-${PV} > #if [ ! -h ${D}/usr/src/xnu ] > #then > # ln -sf ${D}/usr/src/xnu-${KV} ${D}/usr/src/xnu > #fi >} > >## ># common functions >#================================================================= > >xnu_src_unpack() { > > cd ${WORKDIR} > unpack xnu-${PV}.tar.gz > > cd ${S}/makedefs > sed -i -e 's:^export RELPATH = .*:export RELPATH = /usr/bin/relpath:' MakeInc.cmd > sed -i -e 's:^SEG_HACK = .*:SEG_HACK = /usr/bin/seg_hack:' MakeInc.cmd > sed -i -e 's:^DECOMMENT = .*:DECOMMENT = /usr/bin/decomment:' MakeInc.cmd > > cd ${S}/libsa/conf > sed -i -e 's|/usr/local/lib|/usr/lib|g' Makefile.template > > cd ${S}/config > sed -i -e 's|/usr/local/bin|/usr/bin|g' Makefile >} > >xnu_src_compile() { > cd ${S} > emake installhdrs RC_OS=macos || die "xnu headers failed" > emake RC_OS=macos || die "xnu build failed" >} > >xnu_src_install() { > cd ${S}/BUILD/obj/RELEASE_PPC/ > # this can overwrite the running kernel..BAD IDEA, needs to be fixed > cp mach_kernel /mach_kernel-${KV} > if [ ${PV} == ${RKV} ]; then > einfo "Apple...we have a problem....Installing Gentoo xnu kernel" > einfo "Moooooo.....Roooooooaaaaaaar" > gentookernel > else > KERNEL=${KERNEL_DEV} > kernel_check > NVCOMMAND=`nvram boot-device | awk -F , '{print $1}' | awk '{print $2}'` > einfo "You are running a different version of xnu than this one," > einfo "this is NOT reccomended. If you really want to boot this kernel type" > echo > einfo " nvram boot-file=${NVCOMMAND}${COMMA}${KERNEL}" > echo > einfo "and reboot... then start praying to his royal steveness" > fi > xnusources >} > >xnu_pkg_postrm() { > defaultkernel > # we should probably clean up /usr/include and the System.Framework in the future > rm -rf /usr/src/xnu-${PV} >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 59991
: 37176