[hbbtv/youtubetv] Fixed hanup bug and segmentation fault on 3rd-party images.
[vuplus_openembedded] / recipes / linux / linux-dm7025.bb
1 DESCRIPTION = "Linux kernel for Dreambox DM7025"
2 LICENSE = "GPL"
3 PN = "linux-dm7025"
4 KV = "2.6.12"
5 PV = "2.6.12.6"
6 PR = "s11"
7
8 DEPENDS = "zlib-native zlib"
9
10 # note, the rX in the filename is *NOT* the packet revision - it's the patch revision.
11 SRC_URI += "${KERNELORG_MIRROR}/pub/linux/kernel/v2.6/linux-${PV}.tar.bz2 \
12         file://dm7025_defconfig \
13         http://sources.dreamboxupdate.com/download/kernel-patches/linuxmips-${KV}-dream-r6.patch.bz2;patch=1;pnum=1 \
14         http://sources.dreamboxupdate.com/download/kernel-patches/linux-${KV}-update_dvbapi-r1.patch.bz2;patch=1;pnum=1 \
15         http://sources.dreamboxupdate.com/download/kernel-patches/linux-2.6.12-dvb-multipid-r4.patch.bz2;patch=1;pnum=1 \
16         http://sources.dreamboxupdate.com/download/kernel-patches/linux-2.6.12-dvb-core-fix-several-locking-problems.patch.bz2;patch=1;pnum=1 \
17         http://sources.dreamboxupdate.com/download/kernel-patches/linux-2.6.12-dvbapi-pilot-rolloff-extension-r0.patch.bz2;patch=1;pnum=1 \
18         http://sources.dreamboxupdate.com/download/kernel-patches/linux-2.6.12-update-wireless.patch.bz2;patch=1;pnum=1 \
19         file://linux-2.6-trailing-whitespaces-in-params.patch;patch=1 \
20         file://linuxmips-2.6.12-gcc433-compile-fix.patch;patch=1;pnum=1 \
21         file://linuxmips-2.6.12-gcc44-compile-fixes.patch;patch=1;pnum=1 \
22         file://linuxmips-2.6.12-revert-fadvise-fix.patch;patch=1;pnum=1 \
23         file://linuxmips-2.6.12-add-cpu-feature-overrides.patch;patch=1;pnum=1 \
24         http://www.kernel.org/pub/linux/kernel/people/rml/inotify/v2.6/0.23/inotify-0.23-rml-2.6.12-15.patch;patch=1;pnum=1 \
25 #squashfs-lzma stuff
26         http://squashfs-lzma.org/dl/sqlzma3.2-r2b.tar.bz2 \
27         http://dreamboxupdate.com/download/kernel-patches/sqlzma2k-3.2-r2-2.6.12.6.patch.bz2 \
28         http://dreamboxupdate.com/download/patches/fix_lzma_squashfs_makefiles_for_oe-r3.patch.bz2 \
29         ${SOURCEFORGE_MIRROR}/squashfs/squashfs3.2-r2.tar.gz \
30         ${SOURCEFORGE_MIRROR}/sevenzip/lzma443.tar.bz2 \
31         file://${WORKDIR}/squashfs-lzma/kernel-patches/linux-2.6.12/squashfs3.2-patch;pnum=1;patch=1 \
32         file://linux-2.6.12-dvb-core-fix-frontend-shutdown-timeout.patch;patch=1;pnum=1 \
33 "
34
35 S = "${WORKDIR}/linux-${PV}"
36
37 inherit kernel
38
39 FILES_kernel-image = "/boot/vmlinux.gz /boot/autoexec.bat"
40
41 export OS = "Linux"
42 KERNEL_IMAGETYPE = "vmlinux"
43 KERNEL_OUTPUT = "vmlinux"
44 KERNEL_OBJECT_SUFFIX = "ko"
45
46 addtask munge after do_unpack before do_patch
47
48 do_munge () {
49         if [ -d ${WORKDIR}/squashfs3.2-r2 ]; then
50                 mv ${WORKDIR}/squashfs3.2-r2/* ${WORKDIR}
51                 rm -R ${WORKDIR}/squashfs3.2-r2
52                 for i in sqlzma1-443.patch sqlzma2u-3.2-r2.patch fix_lzma_squashfs_makefiles_for_oe-r3.patch; do
53                         echo "Applying $i"
54                         patch -d ${WORKDIR} -p1 < ${WORKDIR}/$i
55                 done
56         fi
57         CUR=`pwd`
58         cd ${WORKDIR}
59         install -d ${WORKDIR}/squashfs-lzma
60         for i in `find -maxdepth 1 | grep -v linux | xargs`; 
61         do
62                 case $i in
63                         ".");;
64                         "./squashfs-lzma");;
65                         "./temp");;
66                         "./image");;
67                         "./install");;
68                         "./dm7025_defconfig");;
69                         *)mv $i ${WORKDIR}/squashfs-lzma;;
70                 esac
71         done
72         cd $CUR
73 }
74
75 do_compile_prepend () {
76         if [ -f ${S}/.patched ];
77         then
78                 patch -R -d ${S} -p1 < ${WORKDIR}/squashfs-lzma/sqlzma2k-3.2-r2-2.6.12.6.patch
79                 rm ${S}/.patched
80         fi
81 }
82
83 do_compile_append () {
84         patch -d ${S} -p1 < ${WORKDIR}/squashfs-lzma/sqlzma2k-3.2-r2-2.6.12.6.patch
85         touch ${S}/.patched
86         oe_runmake -C ${WORKDIR}/squashfs-lzma KDir=${S} BUILD_CC="${CC}" BUILD_CXX="${CXX}" BUILD_LD="${LD}" BUILD_AR="${AR}" BUILD_LDFLAGS="${TARGET_LDFLAGS}" BUILD_CFLAGS="${TARGET_CFLAGS}" BUILD_CXXFLAGS="${TARGET_CXXFLAGS}"
87         for i in mksquashfs unsquashfs; 
88         do
89                 mv ${WORKDIR}/squashfs-lzma/squashfs-tools/$i ${WORKDIR}/squashfs-lzma/squashfs-tools/$i-${ARCH}
90         done
91         oe_runmake -C ${WORKDIR}/squashfs-lzma KDir=${S} clean
92         oe_runmake -C ${WORKDIR}/squashfs-lzma KDir=${S}
93         patch -R -d ${S} -p1 < ${WORKDIR}/squashfs-lzma/sqlzma2k-3.2-r2-2.6.12.6.patch
94         rm ${S}/.patched
95 }
96
97 do_configure_prepend () {
98         if [ "${@bb.data.getVar('DISTRO_VERSION', d, 1)}" == "1.4.0" ];
99         then
100                 cat ${WORKDIR}/dm7025_defconfig | grep -v "CONFIG_CMDLINE" > ${S}/.config
101                 echo "CONFIG_CMDLINE=\"console=null root=/dev/mtdblock3 rootfstype=jffs2 rw\"" >> ${S}/.config
102         else
103                 oe_machinstall -m 0644 ${WORKDIR}/dm7025_defconfig ${S}/.config
104         fi;
105         oe_runmake oldconfig
106 }
107
108 do_install_append () {
109         install -d ${D}/boot
110         install -m 0755 vmlinux ${D}/boot/vmlinux
111         echo "/flash/bootlogo.elf" > ${D}/boot/autoexec.bat
112         gzip ${D}/boot/vmlinux
113         echo "/flash/vmlinux.gz" >> ${D}/boot/autoexec.bat
114         for i in sqlzma.ko unlzma.ko; 
115         do 
116                 install -m 0644 ${WORKDIR}/squashfs-lzma/C/7zip/Compress/LZMA_C/kmod/$i ${D}/lib/modules/2.6.12.6/kernel/fs/squashfs
117         done;
118         install -d ${D}/usr/bin
119         for i in mksquashfs unsquashfs;
120         do
121                 install ${WORKDIR}/squashfs-lzma/squashfs-tools/$i-${ARCH} ${D}/usr/bin/$i
122         done;
123 }
124
125 PACKAGES_append = " unsquashfs mksquashfs"
126 FILES_mksquashfs = "/usr/bin/mksquashfs"
127 FILES_unsquashfs = "/usr/bin/unsquashfs"
128
129 do_stage_append() {
130         install ${WORKDIR}/squashfs-lzma/C/7zip/Compress/LZMA_Alone/lzma ${STAGING_BINDIR_NATIVE}
131         install ${WORKDIR}/squashfs-lzma/C/7zip/Compress/LZMA_C/lzmadec ${STAGING_BINDIR_NATIVE}
132         install ${WORKDIR}/squashfs-lzma/squashfs-tools/mksquashfs ${STAGING_BINDIR_NATIVE}
133         install ${WORKDIR}/squashfs-lzma/squashfs-tools/unsquashfs ${STAGING_BINDIR_NATIVE}
134 }
135
136 pkg_preinst_kernel-image () {
137         [ -z "$D" ] && mountpoint -q /boot && mount -o rw,remount /boot
138         true
139 }
140
141 pkg_postinst_kernel-image () {
142         [ -z "$D" ] && mountpoint -q /boot && mount -o ro,remount /boot
143         true
144 }
145
146 pkg_prerm_kernel-image () {
147         [ -z "$D" ] && mountpoint -q /boot && mount -o rw,remount /boot
148         true
149 }
150
151 pkg_postrm_kernel-image () {
152         [ -z "$D" ] && mountpoint -q /boot && mount -o ro,remount /boot
153         true
154 }