merge of '178eac00dc5aa8338d42e8e203633bec7817bbf6'
[vuplus_openembedded] / packages / linux / linux-handhelds-2.6.inc
1 SECTION = "kernel"
2 DESCRIPTION = "handhelds.org Linux kernel 2.6 for PocketPCs and other consumer handheld devices."
3 LICENSE = "GPL"
4
5 COMPATIBLE_HOST = "arm.*-linux"
6 COMPATIBLE_MACHINE ?= "(asus620|asus730|aximx50|aximx50v|eseries|h1910|h2200|h3600|h3800|h3900|h4000|h5000|htcalpine|htcapache|htcblueangel|htchermes|htchimalaya|htcsable|htcuniversal|htcwallaby|hx4700|ghi270|looxc550|jornada56x|magician|rx1950|rx3000)"
7
8 # SRC_URI *must* be overriden in includer, but this is a good reference
9 SRC_URI ?= "${HANDHELDS_CVS};module=linux/kernel26;tag=${@'K' + bb.data.getVar('PV',d,1).replace('.', '-')} \
10            file://24-hostap_cs_id.diff;patch=1 \
11            file://hrw-pcmcia-ids-r2.patch;patch=1 \
12            file://defconfig"
13
14 S = "${WORKDIR}/kernel26"
15
16 inherit kernel
17
18
19 K_MAJOR ?= "${@bb.data.getVar('PV',d,1).split('-')[0].split('.')[0]}"
20 K_MINOR ?= "${@bb.data.getVar('PV',d,1).split('-')[0].split('.')[1]}"
21 K_MICRO ?= "${@bb.data.getVar('PV',d,1).split('-')[0].split('.')[2]}"
22 HHV     ?= "${@bb.data.getVar('PV',d,1).split('-')[1].split('hh')[-1]}"
23
24 KERNEL_PRIORITY = "${@'%d' % (int(bb.data.getVar('K_MAJOR',d,1)) * 100000000 + int(bb.data.getVar('K_MINOR',d,1)) * 1000000 + int(bb.data.getVar('K_MICRO',d,1)) * 10000 + float(bb.data.getVar('HHV',d,1)))}"
25
26 KERNEL_FILENAME = "${KERNEL_IMAGETYPE}-${PV}-${PR}-${MACHINE}.bin"
27
28 do_configure() {
29
30         if [ `grep EXTRAVERSION Makefile | grep hh | awk '{print $3}' | sed s/-hh//` != ${HHV} ]; then
31                 die "-hh version mismatch"
32         fi
33
34         rm -f ${S}/.config
35
36         if [ ! -e ${WORKDIR}/defconfig ]; then
37                 die "No default configuration for ${MACHINE} available."
38         fi
39
40         if [ -n "${KERNEL_INITRAMFS_PATH}" -a "${ANGSTROM_MODE}" = "glibc" ]; then
41                 if [ ! -f ${KERNEL_INITRAMFS_PATH} ]; then
42                     echo "${KERNEL_INITRAMFS_PATH} does not exist, you may need to bitbake it separately"
43                     exit 1
44                 fi
45
46                 # Kernel expects non-compressed cpio
47                 gzip -d -c ${KERNEL_INITRAMFS_PATH} >${WORKDIR}/initramfs.cpio
48                 echo "CONFIG_INITRAMFS_SOURCE=\"${WORKDIR}/initramfs.cpio\"" >> ${S}/.config
49         fi
50
51         if [ "${TARGET_OS}" == "linux-gnueabi" -o  "${TARGET_OS}" == "linux-uclibcgnueabi" ]; then
52                 echo "CONFIG_AEABI=y"                   >> ${S}/.config
53                 echo "CONFIG_OABI_COMPAT=y"             >> ${S}/.config
54         else
55                 echo "# CONFIG_AEABI is not set"        >> ${S}/.config
56                 echo "# CONFIG_OABI_COMPAT is not set"  >> ${S}/.config
57         fi
58
59         sed     -e '/CONFIG_AEABI/d' \
60                 -e '/CONFIG_OABI_COMPAT=/d' \
61                 -e '/CONFIG_INITRAMFS_SOURCE=/d' \
62                 '${WORKDIR}/defconfig' >>'${S}/.config'
63
64         yes '' | oe_runmake oldconfig
65
66 }
67
68 do_deploy() {
69         install -d ${DEPLOY_DIR_IMAGE}
70         install -m 0644 arch/${ARCH}/boot/${KERNEL_IMAGETYPE} ${DEPLOY_DIR_IMAGE}/${KERNEL_FILENAME}
71         tar -cvzf ${DEPLOY_DIR_IMAGE}/modules-${PV}-${PR}-${MACHINE}.tgz -C ${D} lib
72         
73         #reflash.ctl is required to reflash using bootldr
74         # format:
75         # name file md5sumfile destination
76         echo "${MACHINE}-kernel-${DATETIME} ${KERNEL_FILENAME} - kernel" >> ${DEPLOY_DIR_IMAGE}/reflash.ctl
77         gen_haret_startup
78
79         if [ -n "${KERNEL_INITRAMFS_PATH}" -a "${ANGSTROM_MODE}" == "glibc" ]; then
80                 cp ${DEPLOY_DIR_IMAGE}/${KERNEL_FILENAME} ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-$(basename ${KERNEL_INITRAMFS_PATH} | awk -F. '{print $1}')-${PV}-${PR}-${MACHINE}.bin 
81         fi
82 }   
83    
84 do_deploy[dirs] = "${S}"
85
86 addtask deploy before do_package after do_install
87
88
89 gen_haret_startup() {
90         cat >${DEPLOY_DIR_IMAGE}/startup.txt <<EOF 
91 # This is startup file for HaRET, Linux bootloader for WinCE
92 # http://handhelds.org/wiki/HaRET
93
94 set kernel "${KERNEL_FILENAME}"
95
96 # Boot choices. Uncomment 'set' statements in exactly one section
97
98 ## Choice 1 - Boot from SD/MMC card
99 # Have 2 partition on a card:
100 # 1st - FAT with HaRET executable, this file and zImage above
101 # 2nd - EXT2 with rootfs tarball extracted
102 set cmdline "root=/dev/mmcblk0p2 rootdelay=10 console=ttyS0,115200n8 console=tty0"
103
104 ## Choice 2 - Boot from CF card, setup like above
105 #set cmdline "root=/dev/hda2 rootdelay=10 console=ttyS0,115200n8 console=tty0"
106
107 ## Choice 3 - Boot kernel with builtin interactive bootloader (initramfs-bootmenu-image)
108 # rootdelay is a wait before scanning for the available partitions
109 # if root= is also specified, interactive selection will be skipped and
110 # direct boot will happen.
111 #set cmdline "rootdelay=3 console=ttyS0,115200n8 console=tty0"
112
113 ## Choice 4 - Boot rootfs image as initramfs (works only for smaller images)
114 # have a cpio.gz file below together with zImage, no EXT2 partition required
115 #set initrd "<image>.rootfs.cpio.gz"
116 #set cmdline "rdinit=/sbin/init console=ttyS0,115200n8 console=tty0"
117
118 ## Choice 5 - Boot via NFS over USB networking (must be kernel-builtin
119 # or initramfs-*-image works too)
120 # 192.168.x.x - Server address (the other side)
121 # 192.168.y.y - Handheld's address
122 #set cmdline "root=/dev/nfs nfsroot=192.168.x.x:<nfs_path> ip=192.168.y.y:192.168.x.x:192.168.x.x:255.255.255.0:pda:usb0 console=ttyS0,115200n8 console=tty0"
123
124 ## Choice 6 - Boot from MTD partition, for devices with lots of flash
125 #  to have both WinCE and Linux there. Note the value of root param,
126 #  that's how it should be, not "/dev/mtdblockN".
127 #set cmdline "root=mtdN console=ttyS0,115200n8 console=tty0"
128
129 bootlinux
130 EOF
131 }