summaryrefslogtreecommitdiff
path: root/recipes/arm-kernel-shim/arm-kernel-shim_1.5.bb
blob: 76e26065cd00bbe14ddc2b2c914831b4ae5a69f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
DESCRIPTION = "ARM Kernel Shim"
SECTION = ""
PRIORITY = "optional"
HOMEPAGE = "http://wiki.buici.com/twiki/bin/view/Main/ApexBootloader"
LICENSE = "GPL"
PR = "r3"

COMPATIBLE_MACHINE = "(ixp4xx|nslu2|fsg3)"

SRC_URI = "ftp://ftp.buici.com/pub/arm/arm-kernel-shim/arm-kernel-shim-${PV}.tar.gz \
	   file://config-nslu2.h \
	   file://config-nas100d.h \
	   file://config-dsmg600.h \
	   file://config-fsg3.h"

SRC_URI[md5sum] = "d85eb707cbbf0c729019289df1fbc636"
SRC_URI[sha256sum] = "20fc8f095b2d6894e5fd8156c870686aced5edee964b0dd7163163327a7b32a7"

S = ${WORKDIR}/arm-kernel-shim-${PV}

inherit siteinfo

CMDLINE_CONSOLE = "console=${@bb.data.getVar("KERNEL_CONSOLE",d,1) or "ttyS0"}"

CMDLINE_ROOT_DSMG600 = "root=/dev/mtdblock2 rootfstype=jffs2 rootflags=noatime rw init=/linuxrc"
CMDLINE_ROOT_NAS100D = "root=/dev/mtdblock2 rootfstype=jffs2 rootflags=noatime rw init=/linuxrc"
CMDLINE_ROOT_NSLU2   = "root=/dev/mtdblock4 rootfstype=jffs2 rootflags=noatime rw init=/linuxrc"
# CMDLINE is passed correctly on the Freecom FSG-3 from the bootloader.

EXTRA_OEMAKE_append = " CROSS_COMPILE=${STAGING_DIR_NATIVE}${prefix_native}/bin/${HOST_PREFIX}"

oe_runmake() {
	mv ${S}/config.h ${S}/config.h.orig
	# NSLU2
	if [ ${SITEINFO_ENDIANESS} == "be" ] ; then
		sed -e 's|//#define FORCE_BIGENDIAN|#define FORCE_BIGENDIAN|' \
			${WORKDIR}/config-nslu2.h > ${S}/config.h
	else
		sed -e 's|//#define FORCE_LITTLEENDIAN|#define FORCE_LITTLEENDIAN|' \
			${WORKDIR}/config-nslu2.h > ${S}/config.h
	fi
	echo "#define COMMANDLINE \"${CMDLINE_CONSOLE} ${CMDLINE_ROOT_NSLU2} ${CMDLINE_DEBUG}\"" >> ${S}/config.h
	rm -f ${S}/main.o
	oenote make ${PARALLEL_MAKE} CROSS_COMPILE=${STAGING_DIR_NATIVE}${prefix_native}/bin/${TARGET_PREFIX} PACKAGE=arm-kernel-shim-nslu2
	make ${PARALLEL_MAKE} CROSS_COMPILE=${STAGING_DIR_NATIVE}${prefix_native}/bin/${TARGET_PREFIX} PACKAGE=arm-kernel-shim-nslu2 || die "oe_runmake failed"
	# NAS100d
	if [ ${SITEINFO_ENDIANESS} == "be" ] ; then
		sed -e 's|//#define FORCE_BIGENDIAN|#define FORCE_BIGENDIAN|' \
			${WORKDIR}/config-nas100d.h > ${S}/config.h
	else
		sed -e 's|//#define FORCE_LITTLEENDIAN|#define FORCE_LITTLEENDIAN|' \
			${WORKDIR}/config-nas100d.h > ${S}/config.h
	fi
	echo "#define COMMANDLINE \"${CMDLINE_CONSOLE} ${CMDLINE_ROOT_NAS100D} ${CMDLINE_DEBUG}\"" >> ${S}/config.h
	rm -f ${S}/main.o
	oenote make ${PARALLEL_MAKE} CROSS_COMPILE=${STAGING_DIR_NATIVE}${prefix_native}/bin/${TARGET_PREFIX} PACKAGE=arm-kernel-shim-nas100d
	make ${PARALLEL_MAKE} CROSS_COMPILE=${STAGING_DIR_NATIVE}${prefix_native}/bin/${TARGET_PREFIX} PACKAGE=arm-kernel-shim-nas100d || die "oe_runmake failed"
	# DSMG-600
	if [ ${SITEINFO_ENDIANESS} == "be" ] ; then
		sed -e 's|//#define FORCE_BIGENDIAN|#define FORCE_BIGENDIAN|' \
			${WORKDIR}/config-dsmg600.h > ${S}/config.h
	else
		sed -e 's|//#define FORCE_LITTLEENDIAN|#define FORCE_LITTLEENDIAN|' \
			${WORKDIR}/config-dsmg600.h > ${S}/config.h
	fi
	echo "#define COMMANDLINE \"${CMDLINE_CONSOLE} ${CMDLINE_ROOT_DSMG600} ${CMDLINE_DEBUG}\"" >> ${S}/config.h
	rm -f ${S}/main.o
	oenote make ${PARALLEL_MAKE} CROSS_COMPILE=${STAGING_DIR_NATIVE}${prefix_native}/bin/${TARGET_PREFIX} PACKAGE=arm-kernel-shim-dsmg600
	make ${PARALLEL_MAKE} CROSS_COMPILE=${STAGING_DIR_NATIVE}${prefix_native}/bin/${TARGET_PREFIX} PACKAGE=arm-kernel-shim-dsmg600 || die "oe_runmake failed"
	# FSG-3
	if [ ${SITEINFO_ENDIANESS} == "be" ] ; then
		sed -e 's|//#define FORCE_BIGENDIAN|#define FORCE_BIGENDIAN|' \
			${WORKDIR}/config-fsg3.h > ${S}/config.h
	else
		sed -e 's|//#define FORCE_LITTLEENDIAN|#define FORCE_LITTLEENDIAN|' \
			${WORKDIR}/config-fsg3.h > ${S}/config.h
	fi
	rm -f ${S}/main.o
	oenote make ${PARALLEL_MAKE} CROSS_COMPILE=${STAGING_DIR_NATIVE}${prefix_native}/bin/${TARGET_PREFIX} PACKAGE=arm-kernel-shim-fsg3
	make ${PARALLEL_MAKE} CROSS_COMPILE=${STAGING_DIR_NATIVE}${prefix_native}/bin/${TARGET_PREFIX} PACKAGE=arm-kernel-shim-fsg3 || die "oe_runmake failed"
	mv ${S}/config.h.orig ${S}/config.h
}

do_stage() {
	install -d ${STAGING_LOADER_DIR}
	cp ${S}/arm-kernel-shim-nslu2.bin ${STAGING_LOADER_DIR}/
	cp ${S}/arm-kernel-shim-nas100d.bin ${STAGING_LOADER_DIR}/
	cp ${S}/arm-kernel-shim-dsmg600.bin ${STAGING_LOADER_DIR}/
	cp ${S}/arm-kernel-shim-fsg3.bin ${STAGING_LOADER_DIR}/
}