2 EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_install pkg_postinst
4 RESTRICT="binchecks strip primaryuri mirror"
6 DESCRIPTION="Bad ass kernel"
12 HOMEPAGE="http://www.zen-sources.org"
14 #Eclass functions only from here onwards ...
15 #==============================================================
17 if [[ -n ${KV_FULL} ]]; then
18 # we will set this for backwards compatibility.
21 # we know KV_FULL so lets stop here. but not without resetting S
22 S=${WORKDIR}/linux-${KV_FULL}
30 KV_MAJOR=$(get_version_component_range 1 ${OKV})
31 KV_MINOR=$(get_version_component_range 2 ${OKV})
32 KV_PATCH=$(get_version_component_range 3- ${OKV})
34 KV_PATCH=${KV_PATCH/[-_]*}
36 KERNEL_URI="mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/linux-${OKV}.tar.bz2"
39 RELEASE=${RELEASE/_rc/-rc}
40 RELEASETYPE=${RELEASE//[0-9]}
42 ZEN_REV=$(echo ${PR} | cut -b2)
43 ZEN_HOTFIX_REV=$(echo ${PR} | cut -b3)
45 #hackish, but should be obvious as to why this has been changed.
46 if [ "${PN}" == "zendisk-sources" ]; then
50 if [ "${PN}" == "zenrt-sources" ]; then
54 if [ "${PN}" == "zenmm-sources" ]; then
63 EXTRAVERSION="${RELEASE}${PATCHSET}${ZEN_REV}.${ZEN_HOTFIX_REV}"
65 KV_FULL=${OKV}${EXTRAVERSION}
67 S=${WORKDIR}/linux-${KV_FULL}
70 if [[ ${RELEASETYPE} == -rc ]]; then
71 OKV="${KV_MAJOR}.${KV_MINOR}.$((${KV_PATCH} - 1))"
72 KERNEL_URI="mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/testing/patch-${CKV//_/-}.bz2
73 mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/linux-${OKV}.tar.bz2"
74 PREPATCH="patch-${CKV//_/-}"
76 KERNEL_URI="mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/linux-${CKV//_/-}.tar.bz2"
78 ZEN_PATCH="${PV/_rc/-rc}${PATCHSET}${ZEN_REV}.patch${COMPRESSTYPE}"
79 if [ "${PN}" == "zendisk-sources" ]; then
80 ZEN_PATCH_URI="http://disktech.net/kernel/${ZEN_PATCH}"
82 ZEN_PATCH_URI="http://zen-sources.org/files/${ZEN_PATCH}"
84 KERNEL_URI="${KERNEL_URI} ${ZEN_PATCH_URI}"
85 if [[ ${ZEN_HOTFIX_REV} > 0 ]]; then
86 for ((i=1;i<=${ZEN_HOTFIX_REV};i+=1)); do
87 ZEN_HOTFIX_PATCH="${PV/_rc/-rc}${PATCHSET}${ZEN_REV}-hotfix${i}.patch${COMPRESSTYPE}"
88 if [ "${PN}" == "zendisk-sources" ]; then
89 ZEN_HOTFIX_URI="http://disktech.net/kernel/${ZEN_HOTFIX_PATCH}"
91 ZEN_HOTFIX_URI="http://zen-sources.org/files/${ZEN_HOTFIX_PATCH}"
93 KERNEL_URI="${KERNEL_URI} ${ZEN_HOTFIX_URI}"
96 SRC_URI="${KERNEL_URI}"
99 PROVIDE="virtual/linux-sources virtual/alsa"
105 #==============================================================
108 unpack linux-${OKV}.tar.bz2
109 [[ -n ${PREPATCH} ]] && unpack ${PREPATCH}.bz2
111 if [[ ${ZEN_HOTFIX_REV} > 0 ]]; then
112 for ((i=1;i<=${ZEN_HOTFIX_REV};i+=1)); do
113 HOTFIX_PATCH="${PV/_rc/-rc}${PATCHSET}${ZEN_REV}-hotfix${i}.patch${COMPRESSTYPE}"
114 unpack ${HOTFIX_PATCH}
117 if [[ -d "linux" ]]; then
118 mv linux linux-${KV_FULL} \
119 || die "Unable to move source tree to ${KV_FULL}."
120 elif [[ "${OKV}" != "${KV_FULL}" ]]; then
121 mv linux-${OKV} linux-${KV_FULL} \
122 || die "Unable to move source tree to ${KV_FULL}."
126 # remove all backup files
127 find . -iname "*~" -exec rm {} \; 2> /dev/null
129 # fix a problem on ppc where TOUT writes to /usr/src/linux breaking sandbox
130 # Failed patch my ass.
132 # -e 's|TOUT := .tmp_gas_check|TOUT := $(T).tmp_gas_check|' \
133 # "${S}"/arch/ppc/Makefile
136 unpack_set_extraversion() {
138 sed -i -e "s:^\(EXTRAVERSION =\).*:\1 ${EXTRAVERSION}:" Makefile
142 # Should be done after patches have been applied
143 # Otherwise patches that modify the same area of Makefile will fail
144 unpack_fix_install_path() {
146 sed -i -e 's:#export\tINSTALL_PATH:export\tINSTALL_PATH:' Makefile
150 #==============================================================
151 install_universal() {
152 #fix silly permissions in tarball
155 chmod -R a+r-w+X,u+w *
164 echo ">>> Copying sources ..."
166 mv ${WORKDIR}/linux* ${D}/usr/src
169 # pkg_postinst functions
170 #==============================================================
174 # if we have USE=symlink, then force K_SYMLINK=1
175 use symlink && K_SYMLINK=1
177 # if we are to forcably symlink, delete it if it already exists first.
178 if [[ ${K_SYMLINK} > 0 ]]; then
179 [[ -h ${ROOT}usr/src/linux ]] && rm ${ROOT}usr/src/linux
183 # if the link doesnt exist, lets create it
184 [[ ! -h ${ROOT}usr/src/linux ]] && MAKELINK=1
186 if [[ ${MAKELINK} == 1 ]]; then
188 ln -sf linux-${KV_FULL} linux
192 # Don't forget to make directory for sysfs
193 [[ ! -d ${ROOT}sys ]] && kernel_is 2 6 && mkdir ${ROOT}sys
195 # if K_EXTRAEINFO is set then lets display it now
196 if [[ -n ${K_EXTRAEINFO} ]]; then
197 echo ${K_EXTRAEINFO} | fmt |
198 while read -s ELINE; do einfo "${ELINE}"; done
201 # if K_EXTRAEWARN is set then lets display it now
202 if [[ -n ${K_EXTRAEWARN} ]]; then
203 echo ${K_EXTRAEWARN} | fmt |
204 while read -s ELINE; do ewarn "${ELINE}"; done
209 #==============================================================
212 if [[ -n ${PREPATCH} ]]; then
213 echo ">>> Applying -rc prepatch ... "
214 patch -p1 -s < ${WORKDIR}/${PREPATCH}
216 echo ">>> Applying ${PATCHSET} patch ... "
217 patch -p1 -s < ${WORKDIR}/${ZEN_PATCH/${COMPRESSTYPE}/}
218 if [[ ${ZEN_HOTFIX_REV} > 0 ]]; then
219 for ((i=1;i<=${ZEN_HOTFIX_REV};i+=1)); do
220 HOTFIX_PATCH="${PV/_rc/-rc}${PATCHSET}${ZEN_REV}-hotfix${i}.patch${COMPRESSTYPE}"
221 echo ">>> Applying -hotfix${i} ... "
222 patch -p1 -s < ${WORKDIR}/${HOTFIX_PATCH/${COMPRESSTYPE}/}
228 #==============================================================
229 zen-sources_src_unpack() {
234 unpack_set_extraversion
235 unpack_fix_install_path
240 zen-sources_src_compile() {
244 zen-sources_src_install() {
249 zen-sources_pkg_postinst() {
253 zen-sources_pkg_setup() {
255 echo ">>> Preparing to unpack ..."