meta-bsp/common: rename to meta-dreambox
[opendreambox.git] / meta-dreambox / recipes-bsp / dreambox-secondstage / dreambox-secondstage-base.inc
1 SUMMARY = "Dreambox second stage bootloader"
2 SECTION = "base"
3 LICENSE = "CLOSED"
4 PROVIDES = "virtual/bootloader"
5 PRIORITY = "required"
6
7 do_install() {
8         install -d ${D}${datadir}/${PN}
9         install -m 0644 secondstage-${MACHINE}-${PV}.bin ${D}${datadir}/${PN}/secondstage-${MACHINE}.bin
10 }
11
12 PACKAGES = "${PN} ${PN}-bin"
13
14 PACKAGE_ARCH := "${MACHINE_ARCH}"
15
16 RDEPENDS_${PN} = "mtd-utils-nandwrite mtd-utils-mtd-debug dreambox-buildimage"
17
18 FILES_${PN} = "${datadir}/${PN}/secondstage-${MACHINE}.bin"
19
20 pkg_postinst_${PN}() {
21 if [ -z "$D" ] && grep -q '\<${MACHINE}\>' /proc/stb/info/model; then
22         buildimage --arch=${MACHINE} --raw ${EXTRA_BUILDCMD} \
23                 --erase-block-size=`mtd_debug info /dev/mtd1 | grep '^mtd\.erasesize' | awk '{print $3}'` \
24                 --sector-size=`mtd_debug info /dev/mtd1 | grep '^mtd\.writesize' | awk '{print $3}'` \
25                 --boot-partition=${DREAMBOX_PART0_SIZE}:${datadir}/${PN}/secondstage-${MACHINE}.bin \
26                 > /var/tmp/secondstage.nand
27         mtd_debug erase /dev/mtd1 0 `mtd_debug info /dev/mtd1 | grep '^mtd\.size' | awk '{print $3}'`
28         nandwrite -m -n -o /dev/mtd1 /var/tmp/secondstage.nand
29         sync
30 fi
31 }