merge
[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
41         if [ "${TARGET_OS}" == "linux-gnueabi" -o  "${TARGET_OS}" == "linux-uclibcgnueabi" ]; then
42                 echo "CONFIG_AEABI=y"                   >> ${S}/.config
43                 echo "CONFIG_OABI_COMPAT=y"             >> ${S}/.config
44         else
45                 echo "# CONFIG_AEABI is not set"        >> ${S}/.config
46                 echo "# CONFIG_OABI_COMPAT is not set"  >> ${S}/.config
47         fi
48
49         sed     -e '/CONFIG_AEABI/d' \
50                 -e '/CONFIG_OABI_COMPAT=/d' \
51                 '${WORKDIR}/defconfig' >>'${S}/.config'
52
53         yes '' | oe_runmake oldconfig
54
55 }
56
57 do_compile_prepend() {
58         if [ -n "${KERNEL_INITRAMFS_PATH}" -a "${ANGSTROM_MODE}" == "glibc" ]; then
59             if [ ! -f ${KERNEL_INITRAMFS_PATH} ]; then
60                 echo "${KERNEL_INITRAMFS_PATH} does not exist, you may need to bitbake it separately"
61                 exit 1
62             fi
63             cp ${KERNEL_INITRAMFS_PATH} usr/initramfs_data.cpio.gz
64         fi
65 }
66
67 do_deploy() {
68         install -d ${DEPLOY_DIR_IMAGE}
69         install -m 0644 arch/${ARCH}/boot/${KERNEL_IMAGETYPE} ${DEPLOY_DIR_IMAGE}/${KERNEL_FILENAME}
70         tar -cvzf ${DEPLOY_DIR_IMAGE}/modules-${PV}-${PR}-${MACHINE}.tgz -C ${D} lib
71         
72         #reflash.ctl is required to reflash using bootldr
73         # format:
74         # name file md5sumfile destination
75         echo "${MACHINE}-kernel-${DATETIME} ${KERNEL_FILENAME} - kernel" >> ${DEPLOY_DIR_IMAGE}/reflash.ctl
76         gen_haret_startup
77
78         if [ -n "${KERNEL_INITRAMFS_PATH}" -a "${ANGSTROM_MODE}" == "glibc" ]; then
79                 cp ${DEPLOY_DIR_IMAGE}/${KERNEL_FILENAME} ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-$(basename ${KERNEL_INITRAMFS_PATH} | awk -F. '{print $1}')-${PV}-${PR}-${MACHINE}.bin 
80         fi
81 }   
82    
83 do_deploy[dirs] = "${S}"
84
85 addtask deploy before do_package after do_install
86
87
88 gen_haret_startup() {
89         cat >${DEPLOY_DIR_IMAGE}/startup.txt <<EOF 
90 # This is startup file for HaRET, Linux bootloader for WinCE
91 # http://handhelds.org/wiki/HaRET
92
93 set kernel "${KERNEL_FILENAME}"
94
95 # Boot choices. Uncomment 'set' statements in exactly one section
96
97 ## Choice 1 - Boot from SD/MMC card
98 # Have 2 partition on a card:
99 # 1st - FAT with HaRET executable, this file and zImage above
100 # 2nd - EXT2 with rootfs tarball extracted
101 set cmdline "root=/dev/mmcblk0p2 rootdelay=10 console=ttyS0,115200n8 console=tty0"
102
103 ## Choice 2 - Boot from CF card, setup like above
104 #set cmdline "root=/dev/hda2 rootdelay=10 console=ttyS0,115200n8 console=tty0"
105
106 ## Choice 3 - Boot kernel with builtin interactive bootloader (initramfs-bootmenu-image)
107 # rootdelay is a wait before scanning for the available partitions
108 # if root= is also specified, interactive selection will be skipped and
109 # direct boot will happen.
110 #set cmdline "rootdelay=3 console=ttyS0,115200n8 console=tty0"
111
112 ## Choice 4 - Boot rootfs image as initramfs (works only for smaller images)
113 # have a cpio.gz file below together with zImage, no EXT2 partition required
114 #set initrd "<image>.rootfs.cpio.gz"
115 #set cmdline "rdinit=/sbin/init console=ttyS0,115200n8 console=tty0"
116
117 ## Choice 5 - Boot via NFS over USB networking (must be kernel-builtin
118 # or initramfs-*-image works too)
119 # 192.168.x.x - Server address (the other side)
120 # 192.168.y.y - Handheld's address
121 #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"
122
123 ## Choice 6 - Boot from MTD partition, for devices with lots of flash
124 #  to have both WinCE and Linux there. Note the value of root param,
125 #  that's how it should be, not "/dev/mtdblockN".
126 #set cmdline "root=mtdN console=ttyS0,115200n8 console=tty0"
127
128 bootlinux
129 EOF
130 }