meta-bsp/dm7080: merge into meta-dreambox
[opendreambox.git] / meta-dreambox / recipes-kernel / linux / linux-dreambox_3.2.bb
1 DEPENDS = "carl9170fw linux-firmware zd1211-firmware"
2
3 PATCHREV = "4e0356d04e89df800361b9252f990716f5523c6e"
4 PATCHLEVEL = "59"
5
6 SRC_URI = " \
7         ${KERNELORG_MIRROR}/linux/kernel/v3.x/linux-3.2.tar.bz2;name=kernel \
8         ${KERNELORG_MIRROR}/linux/kernel/v3.x/patch-3.2.${PATCHLEVEL}.xz;apply=yes;name=kernel-patch \
9         http://sources.dreamboxupdate.com/download/kernel-patches/${P}-${PATCHREV}.patch.bz2;name=dmm-patch \
10         http://download.filesystems.org/unionfs/unionfs-2.x/unionfs-2.5.11_for_3.2.2.diff.gz;name=unionfs \
11         file://0001-SCSI-sd-Use-SCSI-read-write-16-with-32-bit-LBA-drive.patch \
12         file://0002-add-crypto-api-xz-support.patch \
13         file://0003-add-XZ-compression-support-to-UBIFS.patch \
14         file://0004-block2mtd-add-possibility-to-change-the-writesize.patch \
15         file://0005-block2mtd-add-possibility-to-remove-block2mtd-device.patch \
16         file://0006-mtd-block2mtd-fix-recursive-call-of-mtd_writev.patch \
17         file://0007-mtd-block2mtd-throttle-writes-by-calling-balance_dir.patch \
18         file://0008-The-ubi-maintained-flag-must-be-set-earlier-to-preve.patch \
19         file://0009-fixed-partition-is-ubi-maintained-check.patch \
20         file://0010-MIPS-Refactor-clear_page-and-copy_page-functions.patch \
21         file://0011-add-memory-mapping-support-to-usbfs-used-by-sundtek-.patch \
22         file://0012-fadvise-dontneed-change.patch \
23         file://0013-fix-proc-cputype.patch \
24         file://0014-Staging-rtl8712-Remove-double-USB-device-IDs.patch \
25         file://0015-Staging-rtl8712-rtl8192u-move-USB-device-ID-within-s.patch \
26         file://0016-staging-r8712u-Fix-Smatch-warning.patch \
27         file://0017-CHROMIUM-make-3.82-hack-to-fix-differing-behaviour-b.patch \
28         file://0018-net-ipv4-ipconfig-really-display-the-BOOTP-DHCP-serv.patch \
29         file://0001-linuxtv-api-DMM-drivers-are-now-ready-for-linux-tv-a.patch \
30         file://0001-add-support-for-DM800SEv2-and-DM500HDv2-simplified-1.patch \
31         file://defconfig \
32 "
33
34 SRC_URI[kernel.md5sum] = "7ceb61f87c097fc17509844b71268935"
35 SRC_URI[kernel.sha256sum] = "c881fc2b53cf0da7ca4538aa44623a7de043a41f76fd5d0f51a31f6ed699d463"
36 SRC_URI[kernel-patch.md5sum] = "68696787e651422f02816d2c825f9a9c"
37 SRC_URI[kernel-patch.sha256sum] = "9dcb2e477923c8d1f662f2e8431a0ae06d0f13b6383fde30a051a3361ccd26b7"
38 SRC_URI[dmm-patch.md5sum] = "d17d65e9978343d540e0b60767a82286"
39 SRC_URI[dmm-patch.sha256sum] = "576356545de7f587d164d1cee2cb17b6c1ce3efbe2e01ff785c13ec2d544d220"
40 SRC_URI[unionfs.md5sum] = "06e7c9f6cafd49b72184be851116c511"
41 SRC_URI[unionfs.sha256sum] = "ce6ffa3c17a11dcca24196c11f6efc95c59b65a5b99958e73e8d4cc8e4b1f1ef"
42
43 S = "${WORKDIR}/linux-3.2"
44
45 RDEPENDS_kernel-module-carl9170 = "carl9170fw"
46 RDEPENDS_kernel-module-cifs = "kernel-module-arc4 kernel-module-ecb kernel-module-hmac kernel-module-md4"
47 RDEPENDS_kernel-module-mac80211 = "kernel-module-aes-generic kernel-module-arc4"
48 RDEPENDS_kernel-module-r8712u = "linux-firmware-rtl8192su"
49 RDEPENDS_kernel-module-rt2800usb = "linux-firmware-rt2800usb"
50 RDEPENDS_kernel-module-rt73usb = "linux-firmware-rt73usb"
51 RDEPENDS_kernel-module-zd1211rw = "zd1211-firmware"
52
53 do_configure_prepend() {
54         sed -e "/^SUBLEVEL = ${PATCHLEVEL}$/d" -i ${S}/Makefile
55 }
56
57 require linux.inc
58
59 PACKAGES_DYNAMIC = "kernel-*"
60
61 # By default, kernel.bbclass modifies package names to allow multiple kernels
62 # to be installed in parallel. We revert this change and rprovide the versioned
63 # package names instead, to allow only one kernel to be installed.
64 PKG_kernel-base = "kernel-base"
65 PKG_kernel-image = "kernel-image"
66 RPROVIDES_kernel-base = "kernel-${KERNEL_VERSION}"
67 RPROVIDES_kernel-image = "kernel-image-${KERNEL_VERSION}"
68
69 do_install_append() {
70         if [ "${KERNEL_IMAGETYPE}" = "vmlinux" ]; then
71                 # We want a stripped kernel that gets gzipped and booted from and
72                 # an unstripped version for debugging, which will get into the
73                 # kernel-vmlinux package. When booting vmlinux directly, work on a copy.
74                 if [ "${KERNEL_IMAGEDEST}" = "boot" ]; then
75                         install -m644 ${D}/boot/vmlinux-${KERNEL_VERSION} ${D}/boot/vmlinux.nostrip
76                 fi
77                 # Mark the kernel as executable, so it gets stripped during do_package.
78                 chmod +x ${D}/${KERNEL_IMAGEDEST}/vmlinux-${KERNEL_VERSION}
79         fi
80         echo "/boot/bootlogo.elf.gz filename=/boot/bootlogo.jpg" > ${D}/${KERNEL_IMAGEDEST}/autoexec.bat
81         echo "/boot/${KERNEL_IMAGETYPE}-${KERNEL_VERSION}.gz ${CMDLINE}" >> ${D}/${KERNEL_IMAGEDEST}/autoexec.bat
82 }
83
84 PACKAGES += "kernel-image-dbg"
85
86 FILES_kernel-image += "/${KERNEL_IMAGEDEST}/autoexec.bat"
87 FILES_kernel-image-dbg = "/${KERNEL_IMAGEDEST}/.debug"
88 FILES_kernel-vmlinux = "/boot/vmlinux-${KERNEL_VERSION}"
89
90 python populate_packages_prepend() {
91     import shutil
92     imagetype = d.getVar('KERNEL_IMAGETYPE', True)
93     if imagetype == "vmlinux":
94         pkgd = d.getVar('PKGD', True)
95         imagedest = d.getVar('KERNEL_IMAGEDEST', True)
96         version = d.getVar('KERNEL_VERSION', True)
97         os.system("gzip -9 %s/%s/vmlinux-%s" % (pkgd, imagedest, version))
98         if imagedest == "boot":
99             shutil.move("%s/boot/vmlinux.nostrip" % pkgd, "%s/boot/vmlinux-%s" % (pkgd, version))
100 }
101
102 pkg_preinst_kernel-image() {
103         if [ -z "$D" ] && mountpoint -q /${KERNEL_IMAGEDEST}; then mount -o remount,rw /${KERNEL_IMAGEDEST}; fi
104 }
105 pkg_prerm_kernel-image() {
106         if [ -z "$D" ] && mountpoint -q /${KERNEL_IMAGEDEST}; then mount -o remount,rw /${KERNEL_IMAGEDEST}; fi
107 }
108 pkg_postinst_kernel-image() {
109         if [ -z "$D" ] && mountpoint -q /${KERNEL_IMAGEDEST}; then
110                 if grep -q '\<root=/dev/mtdblock3\>' /proc/cmdline && grep -q '\<root=ubi0:rootfs\>' /boot/autoexec.bat; then
111                         sed -ie 's!${CMDLINE_UBI}!${CMDLINE_JFFS2}!' /boot/autoexec.bat;
112                 fi
113                 mount -o remount,ro /${KERNEL_IMAGEDEST};
114         fi
115 }
116 pkg_postrm_kernel-image() {
117         if [ -z "$D" ] && mountpoint -q /${KERNEL_IMAGEDEST}; then mount -o remount,ro /${KERNEL_IMAGEDEST}; fi
118 }
119
120 # Do not use update-alternatives!
121 pkg_postinst_kernel () {
122 }
123 pkg_postrm_kernel () {
124 }
125
126 CMDLINE_JFFS2 = "root=/dev/mtdblock3 rootfstype=jffs2 rw ${CMDLINE_CONSOLE}"
127 CMDLINE_UBI = "ubi.mtd=root root=ubi0:rootfs rootfstype=ubifs rw ${CMDLINE_CONSOLE}"
128 CMDLINE = "${@base_contains('IMAGE_FSTYPES', 'ubi.nfi', '${CMDLINE_UBI}', '${CMDLINE_JFFS2}', d)}"
129
130 COMPATIBLE_MACHINE = "^(dm500hd|dm500hdv2|dm800se|dm800sev2|dm7020hd|dm7020hdv2|dm8000)$"
131
132 LOCALVERSION = "-${MACHINE}"