diff options
-rw-r--r-- | recipes-kernel/linux/linux.inc | 330 |
1 files changed, 88 insertions, 242 deletions
diff --git a/recipes-kernel/linux/linux.inc b/recipes-kernel/linux/linux.inc index 6c26c24..493616c 100644 --- a/recipes-kernel/linux/linux.inc +++ b/recipes-kernel/linux/linux.inc | |||
@@ -6,265 +6,111 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=d7810fab7487fb0aad327b76f1be7cd7" | |||
6 | 6 | ||
7 | inherit kernel siteinfo | 7 | inherit kernel siteinfo |
8 | 8 | ||
9 | RPSRC = "http://www.rpsys.net/openzaurus/patches/archive" | ||
10 | |||
11 | # Enable OABI compat for people stuck with obsolete userspace | 9 | # Enable OABI compat for people stuck with obsolete userspace |
12 | ARM_KEEP_OABI ?= "1" | 10 | ARM_KEEP_OABI ?= "1" |
13 | 11 | ||
14 | # Quirk for udev greater or equal 141 | 12 | # Quirk for udev greater or equal 141 |
15 | UDEV_GE_141 ?= "0" | 13 | UDEV_GE_141 ?= "1" |
16 | |||
17 | # Specify the commandline for your device | ||
18 | |||
19 | # Boot from mmc | ||
20 | CMDLINE_at91sam9263ek = "mem=64M console=ttyS0,115200 root=/dev/mmcblk0p1 rootfstype=ext2 rootdelay=5" | ||
21 | # Boot from nfs | ||
22 | #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" | ||
23 | 14 | ||
24 | # Set the verbosity of kernel messages during runtime | 15 | # Set the verbosity of kernel messages during runtime |
25 | # You can define CMDLINE_DEBUG in your local.conf or distro.conf to override this behaviour | 16 | # You can define CMDLINE_DEBUG in your local.conf or distro.conf to override this behaviour |
26 | CMDLINE_DEBUG ?= '${@base_conditional("DISTRO_TYPE", "release", "quiet", "debug", d)}' | 17 | CMDLINE_DEBUG ?= '${@base_conditional("DISTRO_TYPE", "release", "quiet", "debug", d)}' |
27 | CMDLINE_append = " ${CMDLINE_DEBUG} " | 18 | CMDLINE_append = " ${CMDLINE_DEBUG}" |
28 | 19 | ||
29 | # Kernel bootlogo is distro-specific (default is OE logo). | 20 | # Set a variable in .configure |
30 | # Logo resolution (qvga, vga, ...) is machine-specific. | 21 | # $1 - Configure variable to be set |
31 | LOGO_SIZE ?= "." | 22 | # $2 - value [n/y/value] |
32 | 23 | kernel_configure_variable() { | |
33 | # Support for binary device tree generation | 24 | # Remove the config |
34 | 25 | CONF_SED_SCRIPT="$CONF_SED_SCRIPT /CONFIG_$1[ =]/d;" | |
35 | FILES_kernel-devicetree = "/boot/devicetree*" | 26 | if test "$2" = "n" |
36 | 27 | then | |
37 | KERNEL_DEVICETREE_boc01 = "${WORKDIR}/boc01.dts" | 28 | echo "# CONFIG_$1 is not set" >> ${S}/.config |
38 | KERNEL_DEVICETREE_calamari = "arch/${ARCH}/boot/dts/mpc8536ds.dts" | 29 | else |
39 | KERNEL_DEVICETREE_canyonlands = "arch/${ARCH}/boot/dts/canyonlands.dts" | 30 | echo "CONFIG_$1=$2" >> ${S}/.config |
40 | KERNEL_DEVICETREE_kilauea = "arch/${ARCH}/boot/dts/kilauea.dts" | 31 | fi |
41 | KERNEL_DEVICETREE_lite5200 = "arch/${ARCH}/boot/dts/lite5200.dts" | ||
42 | KERNEL_DEVICETREE_lsppchd = "arch/${ARCH}/boot/dts/kuroboxHD.dts" | ||
43 | KERNEL_DEVICETREE_lsppchg = "arch/${ARCH}/boot/dts/kuroboxHG.dts" | ||
44 | KERNEL_DEVICETREE_mpc8313e-rdb = "arch/${ARCH}/boot/dts/mpc8313erdb.dts" | ||
45 | KERNEL_DEVICETREE_mpc8315e-rdb = "arch/${ARCH}/boot/dts/mpc8315erdb.dts" | ||
46 | KERNEL_DEVICETREE_mpc8323e-rdb = "arch/${ARCH}/boot/dts/mpc832x_rdb.dts" | ||
47 | KERNEL_DEVICETREE_mpc8544ds = "arch/${ARCH}/boot/dts/mpc8544ds.dts" | ||
48 | KERNEL_DEVICETREE_mpc8641-hpcn = "arch/${ARCH}/boot/dts/mpc8641_hpcn.dts" | ||
49 | KERNEL_DEVICETREE_p1020rdb = "arch/${ARCH}/boot/dts/p1020rdb.dts" | ||
50 | KERNEL_DEVICETREE_p2020ds = "arch/${ARCH}/boot/dts/p2020ds.dts" | ||
51 | KERNEL_DEVICETREE_sequoia = "arch/${ARCH}/boot/dts/sequoia.dts" | ||
52 | KERNEL_DEVICETREE_tqm8540 = "arch/${ARCH}/boot/dts/tqm8540.dts" | ||
53 | KERNEL_DEVICETREE_xilinx-ml507 = "arch/${ARCH}/boot/dts/virtex440-ml507.dts" | ||
54 | |||
55 | KERNEL_DEVICETREE_FLAGS = "-R 8 -S 0x3000" | ||
56 | |||
57 | CORTEXA8FIXUP ?= "yes" | ||
58 | |||
59 | python __anonymous () { | ||
60 | |||
61 | import bb | ||
62 | |||
63 | devicetree = bb.data.getVar('KERNEL_DEVICETREE', d, 1) or '' | ||
64 | if devicetree: | ||
65 | depends = bb.data.getVar("DEPENDS", d, 1) | ||
66 | bb.data.setVar("DEPENDS", "%s dtc-native" % depends, d) | ||
67 | packages = bb.data.getVar("PACKAGES", d, 1) | ||
68 | bb.data.setVar("PACKAGES", "%s kernel-devicetree" % packages, d) | ||
69 | } | 32 | } |
70 | 33 | ||
71 | do_configure_prepend() { | 34 | do_configure_prepend() { |
72 | 35 | # Clean .config | |
73 | # Rename getline in ./scripts/unifdef.c | 36 | echo "" > ${S}/.config |
74 | # Kernels up to 2.6.29 are currently failing to build unifdef.c, | 37 | CONF_SED_SCRIPT="" |
75 | # clashing with exposed getline() from <stdio.h> | 38 | |
76 | # see https://patchwork.kernel.org/patch/11166/ | 39 | # oabi / eabi support |
77 | # committed in 2.6.29 (commit d15bd1067b1fcb2b7250d22bc0c7c7fea0b759f7) | 40 | if [ "${TARGET_OS}" = "linux-gnueabi" -o "${TARGET_OS}" = "linux-uclibceabi" ]; then |
78 | 41 | kernel_configure_variable AEABI y | |
79 | sed -i -e 's/getline/parseline/g' ${S}/scripts/unifdef.c | 42 | if [ "${ARM_KEEP_OABI}" = "1" ] ; then |
80 | 43 | kernel_configure_variable OABI_COMPAT y | |
81 | 44 | else | |
82 | echo "" > ${S}/.config | 45 | kernel_configure_variable OABI_COMPAT n |
83 | 46 | fi | |
84 | # | 47 | else |
85 | # logo support, if you supply logo_linux_clut224.ppm in SRC_URI, then it's going to be used | 48 | kernel_configure_variable AEABI n |
86 | # | 49 | kernel_configure_variable OABI_COMPAT n |
87 | if [ -e ${WORKDIR}/${LOGO_SIZE}/logo_linux_clut224.ppm ]; then | ||
88 | install -m 0644 ${WORKDIR}/${LOGO_SIZE}/logo_linux_clut224.ppm drivers/video/logo/logo_linux_clut224.ppm | ||
89 | echo "CONFIG_LOGO=y" >> ${S}/.config | ||
90 | echo "CONFIG_LOGO_LINUX_CLUT224=y" >> ${S}/.config | ||
91 | fi | ||
92 | |||
93 | # | ||
94 | # oabi / eabi support | ||
95 | # | ||
96 | if [ "${TARGET_OS}" = "linux-gnueabi" -o "${TARGET_OS}" = "linux-uclibceabi" ]; then | ||
97 | echo "CONFIG_AEABI=y" >> ${S}/.config | ||
98 | if [ "${ARM_KEEP_OABI}" = "1" ] ; then | ||
99 | echo "CONFIG_OABI_COMPAT=y" >> ${S}/.config | ||
100 | else | ||
101 | echo "# CONFIG_OABI_COMPAT is not set" >> ${S}/.config | ||
102 | fi | ||
103 | else | ||
104 | echo "# CONFIG_AEABI is not set" >> ${S}/.config | ||
105 | echo "# CONFIG_OABI_COMPAT is not set" >> ${S}/.config | ||
106 | fi | ||
107 | |||
108 | # When enabling thumb for userspace we also need thumb support in the kernel | ||
109 | if [ "${ARM_INSTRUCTION_SET}" = "thumb" ] ; then | ||
110 | sed -i -e /CONFIG_ARM_THUMB/d ${WORKDIR}/defconfig | ||
111 | echo "CONFIG_ARM_THUMB=y" >> ${S}/.config | ||
112 | fi | ||
113 | |||
114 | # Enable thumb2 fixup for specific issue in angstrom toolchains when used on A8 r1p[012] silicon | ||
115 | if [ "${CORTEXA8FIXUP}" = "yes" ] ; then | ||
116 | sed -i -e /CONFIG_ARM_ERRATA_430973/d ${WORKDIR}/defconfig | ||
117 | echo "CONFIG_ARM_ERRATA_430973=y" >> ${S}/.config | ||
118 | fi | ||
119 | |||
120 | # | ||
121 | # endian support | ||
122 | # | ||
123 | if [ "${SITEINFO_ENDIANNESS}" = "be" ]; then | ||
124 | echo "CONFIG_CPU_BIG_ENDIAN=y" >> ${S}/.config | ||
125 | fi | ||
126 | |||
127 | echo "CONFIG_CMDLINE=\"${CMDLINE}\"" >> ${S}/.config | ||
128 | |||
129 | sed -e '/CONFIG_AEABI/d' \ | ||
130 | -e '/CONFIG_OABI_COMPAT=/d' \ | ||
131 | -e '/CONFIG_CMDLINE=/d' \ | ||
132 | -e '/CONFIG_CPU_BIG_ENDIAN/d' \ | ||
133 | -e '/CONFIG_LOGO=/d' \ | ||
134 | -e '/CONFIG_LOGO_LINUX_CLUT224=/d' \ | ||
135 | -e '/CONFIG_LOCALVERSION/d' \ | ||
136 | -e '/CONFIG_LOCALVERSION_AUTO/d' \ | ||
137 | < '${WORKDIR}/defconfig' >>'${S}/.config' | ||
138 | |||
139 | echo 'CONFIG_LOCALVERSION=""' >>${S}/.config | ||
140 | echo '# CONFIG_LOCALVERSION_AUTO is not set' >>${S}/.config | ||
141 | |||
142 | # | ||
143 | # Udev quirks | ||
144 | # | ||
145 | |||
146 | # Newer versions of udev mandate that sysfs doesn't have deprecated entries | ||
147 | if [ "${UDEV_GE_141}" = "1" ] ; then | ||
148 | sed -e /CONFIG_SYSFS_DEPRECATED/d \ | ||
149 | -e /CONFIG_SYSFS_DEPRECATED_V2/d \ | ||
150 | -e /CONFIG_HOTPLUG/d \ | ||
151 | -e /CONFIG_UEVENT_HELPER_PATH/d \ | ||
152 | -e /CONFIG_UNIX/d \ | ||
153 | -e /CONFIG_SYSFS/d \ | ||
154 | -e /CONFIG_PROC_FS/d \ | ||
155 | -e /CONFIG_TMPFS/d \ | ||
156 | -e /CONFIG_INOTIFY_USER/d \ | ||
157 | -e /CONFIG_SIGNALFD/d \ | ||
158 | -e /CONFIG_TMPFS_POSIX_ACL/d \ | ||
159 | -e /CONFIG_BLK_DEV_BSG/d \ | ||
160 | -i '${S}/.config' | ||
161 | |||
162 | echo '# CONFIG_SYSFS_DEPRECATED is not set' >> ${S}/.config | ||
163 | echo '# CONFIG_SYSFS_DEPRECATED_V2 is not set' >> ${S}/.config | ||
164 | echo 'CONFIG_HOTPLUG=y' >> ${S}/.config | ||
165 | echo 'CONFIG_UEVENT_HELPER_PATH=""' >> ${S}/.config | ||
166 | echo 'CONFIG_UNIX=y' >> ${S}/.config | ||
167 | echo 'CONFIG_SYSFS=y' >> ${S}/.config | ||
168 | echo 'CONFIG_PROC_FS=y' >> ${S}/.config | ||
169 | echo 'CONFIG_TMPFS=y' >> ${S}/.config | ||
170 | echo 'CONFIG_INOTIFY_USER=y' >> ${S}/.config | ||
171 | echo 'CONFIG_SIGNALFD=y' >> ${S}/.config | ||
172 | echo 'CONFIG_TMPFS_POSIX_ACL=y' >> ${S}/.config | ||
173 | echo 'CONFIG_BLK_DEV_BSG=y' >> ${S}/.config | ||
174 | echo 'CONFIG_DEVTMPFS=y' >> ${S}/.config | ||
175 | echo 'CONFIG_DEVTMPFS_MOUNT=y' >> ${S}/.config | ||
176 | fi | ||
177 | |||
178 | # Newer inits like systemd need cgroup support | ||
179 | if [ "${KERNEL_ENABLE_CGROUPS}" = "1" ] ; then | ||
180 | sed -e /CONFIG_CGROUP_SCHED/d \ | ||
181 | -e /CONFIG_CGROUPS/d \ | ||
182 | -i '${S}/.config' | ||
183 | |||
184 | echo 'CONFIG_CGROUP_SCHED=y' >> ${S}/.config | ||
185 | echo 'CONFIG_CGROUPS=y' >> ${S}/.config | ||
186 | echo 'CONFIG_CGROUP_NS=y' >> ${S}/.config | ||
187 | echo 'CONFIG_CGROUP_FREEZER=y' >> ${S}/.config | ||
188 | echo 'CONFIG_CGROUP_DEVICE=y' >> ${S}/.config | ||
189 | echo 'CONFIG_CPUSETS=y' >> ${S}/.config | ||
190 | echo 'CONFIG_PROC_PID_CPUSET=y' >> ${S}/.config | ||
191 | echo 'CONFIG_CGROUP_CPUACCT=y' >> ${S}/.config | ||
192 | echo 'CONFIG_RESOURCE_COUNTERS=y' >> ${S}/.config | ||
193 | fi | ||
194 | |||
195 | # | ||
196 | # root-over-nfs-over-usb-eth support. Limited, but should cover some cases. | ||
197 | # Enable this by setting a proper CMDLINE_NFSROOT_USB. | ||
198 | # | ||
199 | if [ ! -z "${CMDLINE_NFSROOT_USB}" ]; then | ||
200 | oenote "Configuring the kernel for root-over-nfs-over-usb-eth with CMDLINE ${CMDLINE_NFSROOT_USB}" | ||
201 | sed -e '/CONFIG_INET/d' \ | ||
202 | -e '/CONFIG_IP_PNP=/d' \ | ||
203 | -e '/CONFIG_USB_GADGET=/d' \ | ||
204 | -e '/CONFIG_USB_GADGET_SELECTED=/d' \ | ||
205 | -e '/CONFIG_USB_ETH=/d' \ | ||
206 | -e '/CONFIG_NFS_FS=/d' \ | ||
207 | -e '/CONFIG_ROOT_NFS=/d' \ | ||
208 | -e '/CONFIG_CMDLINE=/d' \ | ||
209 | -i ${S}/.config | ||
210 | echo "CONFIG_INET=y" >> ${S}/.config | ||
211 | echo "CONFIG_IP_PNP=y" >> ${S}/.config | ||
212 | echo "CONFIG_USB_GADGET=y" >> ${S}/.config | ||
213 | echo "CONFIG_USB_GADGET_SELECTED=y" >> ${S}/.config | ||
214 | echo "CONFIG_USB_ETH=y" >> ${S}/.config | ||
215 | echo "CONFIG_NFS_FS=y" >> ${S}/.config | ||
216 | echo "CONFIG_ROOT_NFS=y" >> ${S}/.config | ||
217 | echo "CONFIG_CMDLINE=\"${CMDLINE_NFSROOT_USB}\"" >> ${S}/.config | ||
218 | fi | ||
219 | yes '' | oe_runmake oldconfig | ||
220 | |||
221 | # | ||
222 | # Activate CONFIG_LEGACY_PTYS | ||
223 | # | ||
224 | sed -e '/CONFIG_LEGACY_PTYS/d' -i ${S}/.config | ||
225 | echo "CONFIG_LEGACY_PTYS=y" >> ${S}/.config | ||
226 | } | ||
227 | |||
228 | do_configure_append() { | ||
229 | if test -e scripts/Makefile.fwinst ; then | ||
230 | sed -i -e "s:-m0644:-m 0644:g" scripts/Makefile.fwinst | ||
231 | fi | 50 | fi |
232 | } | ||
233 | 51 | ||
234 | # bitbake.conf only prepends PARALLEL make in tasks called do_compile, which isn't the case for compile_modules | 52 | # Set cmdline |
235 | # So explicitly enable it for that in here | 53 | kernel_configure_variable CMDLINE "\"${CMDLINE}\"" |
236 | EXTRA_OEMAKE = "${PARALLEL_MAKE} " | 54 | |
237 | 55 | # Localversion | |
238 | do_install_append() { | 56 | kernel_configure_variable LOCALVERSION "\"\"" |
239 | oe_runmake headers_install INSTALL_HDR_PATH=${D}${exec_prefix}/src/linux-${KERNEL_VERSION} ARCH=$ARCH | 57 | kernel_configure_variable LOCALVERSION_AUTO n |
240 | } | 58 | |
59 | # Udev quirks | ||
60 | # Newer versions of udev mandate that sysfs doesn't have deprecated entries | ||
61 | if [ "${UDEV_GE_141}" = "1" ] ; then | ||
62 | kernel_configure_variable SYSFS_DEPRECATED n | ||
63 | kernel_configure_variable SYSFS_DEPRECATED_V2 n | ||
64 | kernel_configure_variable HOTPLUG y | ||
65 | kernel_configure_variable UEVENT_HELPER_PATH "\"\"" | ||
66 | kernel_configure_variable UNIX y | ||
67 | kernel_configure_variable SYSFS y | ||
68 | kernel_configure_variable PROC_FS y | ||
69 | kernel_configure_variable TMPFS y | ||
70 | kernel_configure_variable INOTIFY_USER y | ||
71 | kernel_configure_variable SIGNALFD y | ||
72 | kernel_configure_variable TMPFS_POSIX_ACL y | ||
73 | kernel_configure_variable BLK_DEV_BSG y | ||
74 | kernel_configure_variable DEVTMPFS y | ||
75 | kernel_configure_variable DEVTMPFS_MOUNT y | ||
76 | fi | ||
241 | 77 | ||
242 | PACKAGES =+ "kernel-headers" | 78 | # Newer inits like systemd need cgroup support |
243 | FILES_kernel-headers = "${exec_prefix}/src/linux*" | 79 | if [ "${KERNEL_ENABLE_CGROUPS}" = "1" ] ; then |
80 | kernel_configure_variable CGROUP_SCHED y | ||
81 | kernel_configure_variable CGROUPS y | ||
82 | kernel_configure_variable CGROUP_NS y | ||
83 | kernel_configure_variable CGROUP_FREEZER y | ||
84 | kernel_configure_variable CGROUP_DEVICE y | ||
85 | kernel_configure_variable CPUSETS y | ||
86 | kernel_configure_variable PROC_PID_CPUSET y | ||
87 | kernel_configure_variable CGROUP_CPUACCT y | ||
88 | kernel_configure_variable RESOURCE_COUNTERS y | ||
89 | fi | ||
244 | 90 | ||
245 | do_devicetree_image() { | 91 | # root-over-nfs-over-usb-eth support. Limited, but should cover some cases |
246 | if test -n "${KERNEL_DEVICETREE}" ; then | 92 | # Enable this by setting a proper CMDLINE_NFSROOT_USB. |
247 | dtc -I dts -O dtb ${KERNEL_DEVICETREE_FLAGS} -o devicetree ${KERNEL_DEVICETREE} | 93 | if [ ! -z "${CMDLINE_NFSROOT_USB}" ]; then |
248 | install -d ${D}/boot | 94 | oenote "Configuring the kernel for root-over-nfs-over-usb-eth with CMDLINE ${CMDLINE_NFSROOT_USB}" |
249 | install -m 0644 devicetree ${D}/boot/devicetree-${KERNEL_VERSION} | 95 | kernel_configure_variable INET y |
250 | install -d ${DEPLOY_DIR_IMAGE} | 96 | kernel_configure_variable IP_PNP y |
251 | install -m 0644 devicetree ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGE_BASE_NAME}.dtb | 97 | kernel_configure_variable USB_GADGET y |
252 | package_stagefile_shell ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGE_BASE_NAME}.dtb | 98 | kernel_configure_variable USB_GADGET_SELECTED y |
253 | cd ${DEPLOY_DIR_IMAGE} | 99 | kernel_configure_variable USB_ETH y |
254 | rm -f ${KERNEL_IMAGE_SYMLINK_NAME}.dtb | 100 | kernel_configure_variable NFS_FS y |
255 | ln -sf ${KERNEL_IMAGE_BASE_NAME}.dtb ${KERNEL_IMAGE_SYMLINK_NAME}.dtb | 101 | kernel_configure_variable ROOT_NFS y |
256 | package_stagefile_shell ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGE_SYMLINK_NAME}.dtb | 102 | kernel_configure_variable ROOT_NFS y |
257 | fi | 103 | kernel_configure_variable CMDLINE "\"${CMDLINE_NFSROOT_USB}\"" |
258 | } | 104 | fi |
259 | 105 | ||
260 | addtask devicetree_image after do_install before do_package do_deploy | 106 | # Activate CONFIG_LEGACY_PTYS |
107 | kernel_configure_variable LEGACY_PTYS y | ||
261 | 108 | ||
262 | pkg_postinst_kernel-devicetree () { | 109 | # Keep this the last line |
263 | cd /${KERNEL_IMAGEDEST}; update-alternatives --install /${KERNEL_IMAGEDEST}/devicetree devicetree devicetree-${KERNEL_VERSION} ${KERNEL_PRIORITY} || true | 110 | # Remove all modified configs and add the rest to .config |
264 | } | 111 | sed -e "${CONF_SED_SCRIPT}" < '${WORKDIR}/defconfig' >> '${S}/.config' |
265 | 112 | ||
266 | pkg_postrm_kernel-devicetree () { | 113 | yes '' | oe_runmake oldconfig |
267 | cd /${KERNEL_IMAGEDEST}; update-alternatives --remove devicetree devicetree-${KERNEL_VERSION} || true | ||
268 | } | 114 | } |
269 | 115 | ||
270 | # Automatically depend on lzop-native if CONFIG_KERNEL_LZO is enabled | 116 | # Automatically depend on lzop-native if CONFIG_KERNEL_LZO is enabled |