Update tree with local changes. Disable WiLink4 drivers in the image and enable the...
[openpandora.oe.git] / recipes / linux / linux.inc
1 DESCRIPTION = "Linux Kernel"
2 SECTION = "kernel"
3 LICENSE = "GPL"
4
5 inherit kernel
6
7 RPSRC = "http://www.rpsys.net/openzaurus/patches/archive"
8
9 # Enable OABI compat for people stuck with obsolete userspace
10 ARM_KEEP_OABI ?= "1"
11
12 # Specify the commandline for your device
13
14 # Boot from mmc
15 CMDLINE_at91sam9263ek = "mem=64M console=ttyS0,115200 root=/dev/mmcblk0p1 rootfstype=ext2 rootdelay=5"
16 # Boot from nfs
17 #CMDLINE_at91sam9263ek = "mem=64M console=ttyS0,115200 root=301 root=/dev/nfs nfsroot=172.20.3.1:/data/at91 ip=172.20.0.5:::255.255.0.0"
18
19 # Set the verbosity of kernel messages during runtime
20 # You can define CMDLINE_DEBUG in your local.conf or distro.conf to override this behaviour  
21 CMDLINE_DEBUG ?= '${@base_conditional("DISTRO_TYPE", "release", "quiet", "debug",d)}'
22 CMDLINE_append = " ${CMDLINE_DEBUG} "
23
24 # Support for binary device tree generation
25
26 FILES_kernel-devicetree = "/boot/devicetree*"
27
28 KERNEL_DEVICETREE_boc01 = "${WORKDIR}/boc01.dts"
29 KERNEL_DEVICETREE_mpc8313e-rdb = "arch/${ARCH}/boot/dts/mpc8313erdb.dts"
30 KERNEL_DEVICETREE_mpc8315e-rdb = "arch/${ARCH}/boot/dts/mpc8315erdb.dts"
31 KERNEL_DEVICETREE_mpc8323e-rdb = "arch/${ARCH}/boot/dts/mpc832x_rdb.dts"
32 KERNEL_DEVICETREE_kilauea = "arch/${ARCH}/boot/dts/kilauea.dts"
33 KERNEL_DEVICETREE_sequoia = "arch/${ARCH}/boot/dts/sequoia.dts"
34 KERNEL_DEVICETREE_canyonlands = "arch/${ARCH}/boot/dts/canyonlands.dts"
35
36 KERNEL_DEVICETREE_FLAGS = "-R 8 -S 0x3000"
37
38 python __anonymous () {
39
40     import bb
41     
42     devicetree = bb.data.getVar('KERNEL_DEVICETREE', d, 1) or ''
43     if devicetree:
44         depends = bb.data.getVar("DEPENDS", d, 1)
45         bb.data.setVar("DEPENDS", "%s dtc-native" % depends, d)
46         packages = bb.data.getVar("PACKAGES", d, 1)
47         bb.data.setVar("PACKAGES", "%s kernel-devicetree" % packages, d)
48 }
49
50 do_configure_prepend() {
51         echo "" > ${S}/.config
52
53         #
54         # logo support, if you supply logo_linux_clut224.ppm in SRC_URI, then it's going to be used
55         #
56         if [ -e ${WORKDIR}/logo_linux_clut224.ppm ]; then
57                 install -m 0644 ${WORKDIR}/logo_linux_clut224.ppm drivers/video/logo/logo_linux_clut224.ppm
58                 echo "CONFIG_LOGO=y"                    >> ${S}/.config
59                 echo "CONFIG_LOGO_LINUX_CLUT224=y"      >> ${S}/.config
60         fi
61
62         #
63         # oabi / eabi support
64         #
65         if [ "${TARGET_OS}" = "linux-gnueabi" -o  "${TARGET_OS}" = "linux-uclibcgnueabi" ]; then
66                 echo "CONFIG_AEABI=y"                   >> ${S}/.config
67                 if [ "${ARM_KEEP_OABI}" = "1" ] ; then
68                         echo "CONFIG_OABI_COMPAT=y"             >> ${S}/.config
69                 else
70                         echo "# CONFIG_OABI_COMPAT is not set"  >> ${S}/.config
71                 fi
72         else
73                 echo "# CONFIG_AEABI is not set"        >> ${S}/.config
74                 echo "# CONFIG_OABI_COMPAT is not set"  >> ${S}/.config
75         fi
76
77         # When enabling thumb for userspace we also need thumb support in the kernel
78         if [ "${ARM_INSTRUCTION_SET}" = "thumb" ] ; then
79             sed -i -e /CONFIG_ARM_THUMB/d ${WORKDIR}/defconfig 
80             echo "CONFIG_ARM_THUMB=y" >> ${S}/.config
81         fi
82
83         #
84         # endian support
85         #
86         if [ "${SITEINFO_ENDIANESS}" = "be" ]; then
87                 echo "CONFIG_CPU_BIG_ENDIAN=y"          >> ${S}/.config
88         fi
89
90         echo "CONFIG_CMDLINE=\"${CMDLINE}\"" >> ${S}/.config
91
92         sed -e '/CONFIG_AEABI/d' \
93             -e '/CONFIG_OABI_COMPAT=/d' \
94             -e '/CONFIG_CMDLINE=/d' \
95             -e '/CONFIG_CPU_BIG_ENDIAN/d' \
96             -e '/CONFIG_LOGO=/d' \
97             -e '/CONFIG_LOGO_LINUX_CLUT224=/d' \
98             -e '/CONFIG_LOCALVERSION/d' \
99             < '${WORKDIR}/defconfig' >>'${S}/.config'
100
101         #
102         # root-over-nfs-over-usb-eth support. Limited, but should cover some cases.
103         # Enable this by setting a proper CMDLINE_NFSROOT_USB.
104         #
105         if [ ! -z "${CMDLINE_NFSROOT_USB}" ]; then
106                 oenote "Configuring the kernel for root-over-nfs-over-usb-eth with CMDLINE ${CMDLINE_NFSROOT_USB}"
107                 sed -e '/CONFIG_INET/d' \
108                     -e '/CONFIG_IP_PNP=/d' \
109                     -e '/CONFIG_USB_GADGET=/d' \
110                     -e '/CONFIG_USB_GADGET_SELECTED=/d' \
111                     -e '/CONFIG_USB_ETH=/d' \
112                     -e '/CONFIG_NFS_FS=/d' \
113                     -e '/CONFIG_ROOT_NFS=/d' \
114                     -e '/CONFIG_CMDLINE=/d' \
115                     -i ${S}/.config
116                 echo "CONFIG_INET=y"                     >> ${S}/.config
117                 echo "CONFIG_IP_PNP=y"                   >> ${S}/.config
118                 echo "CONFIG_USB_GADGET=y"               >> ${S}/.config
119                 echo "CONFIG_USB_GADGET_SELECTED=y"      >> ${S}/.config
120                 echo "CONFIG_USB_ETH=y"                  >> ${S}/.config
121                 echo "CONFIG_NFS_FS=y"                   >> ${S}/.config
122                 echo "CONFIG_ROOT_NFS=y"                 >> ${S}/.config
123                 echo "CONFIG_CMDLINE=\"${CMDLINE_NFSROOT_USB}\"" >> ${S}/.config
124         fi
125         yes '' | oe_runmake oldconfig
126 }
127
128 do_configure_append_avr32() {
129         sed -i -e s:-mno-pic::g arch/avr32/Makefile
130 }
131
132 do_compile_append() {
133     if test "x${KERNEL_IMAGETYPE}" = "xuImage" ; then 
134         if test -e arch/${ARCH}/boot/compressed/vmlinux ; then
135             ${OBJCOPY} -O binary -R .note -R .comment -S arch/${ARCH}/boot/compressed/vmlinux linux.bin
136             uboot-mkimage -A ${UBOOT_ARCH} -O linux -T kernel -C none -a ${UBOOT_LOADADDRESS} -e ${UBOOT_ENTRYPOINT} -n "${DISTRO_NAME}/${PV}/${MACHINE}" -d linux.bin arch/${ARCH}/boot/uImage
137             rm -f linux.bin
138         else
139             ${OBJCOPY} -O binary -R .note -R .comment -S vmlinux linux.bin
140             rm -f linux.bin.gz
141             gzip -9 linux.bin
142             uboot-mkimage -A ${UBOOT_ARCH} -O linux -T kernel -C gzip -a ${UBOOT_LOADADDRESS} -e ${UBOOT_ENTRYPOINT} -n "${DISTRO_NAME}/${PV}/${MACHINE}" -d linux.bin.gz arch/${ARCH}/boot/uImage
143             rm -f linux.bin.gz
144         fi
145     fi
146 }
147
148 do_devicetree_image() {
149     if test -n "${KERNEL_DEVICETREE}" ; then
150         dtc -I dts -O dtb ${KERNEL_DEVICETREE_FLAGS} -o devicetree ${KERNEL_DEVICETREE}
151         install -m 0644 devicetree ${D}/boot/devicetree-${KERNEL_VERSION}
152         install -m 0644 devicetree ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGE_BASE_NAME}.dtb
153         cd ${DEPLOY_DIR_IMAGE}
154         rm -f ${KERNEL_IMAGE_SYMLINK_NAME}.dtb
155         ln -sf ${KERNEL_IMAGE_BASE_NAME}.dtb ${KERNEL_IMAGE_SYMLINK_NAME}.dtb
156     fi
157 }
158
159 addtask devicetree_image after do_deploy before do_package
160
161 pkg_postinst_kernel-devicetree () {
162         cd /${KERNEL_IMAGEDEST}; update-alternatives --install /${KERNEL_IMAGEDEST}/devicetree devicetree devicetree-${KERNEL_VERSION} ${KERNEL_PRIORITY} || true
163 }
164
165 pkg_postrm_kernel-devicetree () {
166         cd /${KERNEL_IMAGEDEST}; update-alternatives --remove devicetree devicetree-${KERNEL_VERSION} || true
167 }
168