Re: [OE-core] [PATCH 1/2] grub_git: extend recipe for proper target deployment

2016-12-14 Thread Belal, Awais
Hi Ross,


>> +RDEPENDS_${PN}_class-target = "diffutils freetype"
> Does this really need to be class-target-specific?


Without the class-target override I get


ERROR: Nothing RPROVIDES 'diffutils-native' (but 
virtual:native:/data/amd_yocto/poky/meta/recipes-bsp/grub/grub_git.bb RDEPENDS 
on or otherwise requires it)


so I believe this is necessary in this case. Are you through your review? If 
so, just let me know and I'll send a v2 fixing the other DEPENDS issue you 
pointed out.


BR,
Awais

From: Burton, Ross 
Sent: Tuesday, December 13, 2016 7:17 PM
To: Belal, Awais
Cc: OE-core
Subject: Re: [OE-core] [PATCH 1/2] grub_git: extend recipe for proper target 
deployment


On 13 December 2016 at 11:19, Awais Belal 
mailto:awais_be...@mentor.com>> wrote:
+DEPENDS_class-target += "grub-native"

The native magic won't generate dependencies on itself, so this can just be 
DEPENDS.

+RDEPENDS_${PN}_class-target = "diffutils freetype"

Does this really need to be class-target-specific?

Ross
-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH 1/2] grub_git: extend recipe for proper target deployment

2016-12-13 Thread Burton, Ross
On 13 December 2016 at 11:19, Awais Belal  wrote:

> +DEPENDS_class-target += "grub-native"
>

The native magic won't generate dependencies on itself, so this can just be
DEPENDS.


> +RDEPENDS_${PN}_class-target = "diffutils freetype"
>

Does this really need to be class-target-specific?

Ross
-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH 1/2] grub_git: extend recipe for proper target deployment

2016-12-13 Thread Awais Belal
This extends the grub_git recipe so it can deploy grub
on the target boot disk just like grub-efi. Mainly
this copies stuff from the grub-efi recipe and then
adjusts some bits accordingly. This would allow
using the latest and greatest versions of grub
on the target.

Signed-off-by: Awais Belal 
---
 meta/recipes-bsp/grub/grub_git.bb | 60 +++
 1 file changed, 54 insertions(+), 6 deletions(-)

diff --git a/meta/recipes-bsp/grub/grub_git.bb 
b/meta/recipes-bsp/grub/grub_git.bb
index eb824cc..86fa208 100644
--- a/meta/recipes-bsp/grub/grub_git.bb
+++ b/meta/recipes-bsp/grub/grub_git.bb
@@ -3,11 +3,15 @@ require grub2.inc
 DEFAULT_PREFERENCE = "-1"
 DEFAULT_PREFERENCE_arm = "1"
 
+DEPENDS_class-target += "grub-native"
+RDEPENDS_${PN}_class-target = "diffutils freetype"
+
 FILESEXTRAPATHS =. "${FILE_DIRNAME}/grub-git:"
 
 PV = "2.00+${SRCPV}"
 SRCREV = "7a5b301e3adb8e054288518a325135a1883c1c6c"
 SRC_URI = "git://git.savannah.gnu.org/grub.git \
+   file://cfg \
file://0001-Disable-mfpmath-sse-as-well-when-SSE-is-disabled.patch \
file://autogen.sh-exclude-pc.patch \
file://0001-grub.d-10_linux.in-add-oe-s-kernel-name.patch \
@@ -19,29 +23,73 @@ COMPATIBLE_HOST = 
'(x86_64.*|i.86.*|arm.*|aarch64.*)-(linux.*|freebsd.*)'
 COMPATIBLE_HOST_armv7a = 'null'
 COMPATIBLE_HOST_armv7ve = 'null'
 
-inherit autotools gettext texinfo
+inherit autotools gettext texinfo deploy
 
 # configure.ac has code to set this automagically from the target tuple
 # but the OE freeform one (core2-foo-bar-linux) don't work with that.
-
 GRUBPLATFORM_arm = "uboot"
 GRUBPLATFORM_aarch64 = "efi"
 GRUBPLATFORM ??= "pc"
 
+CACHED_CONFIGUREVARS += "ac_cv_path_HELP2MAN="
 EXTRA_OECONF = "--with-platform=${GRUBPLATFORM} --disable-grub-mkfont 
--program-prefix="" \
 --enable-liblzma=no --enable-device-mapper=no 
--enable-libzfs=no"
-
+EXTRA_OECONF += "${@bb.utils.contains('GRUBPLATFORM', 'efi', 
'--enable-efiemu=no', '', d)}"
 EXTRA_OECONF += "${@bb.utils.contains('DISTRO_FEATURES', 'largefile', 
'--enable-largefile', '--disable-largefile', d)}"
 
-do_install_append () {
+# Determine the target arch for the grub modules
+python __anonymous () {
+import re
+target = d.getVar('TARGET_ARCH', True)
+platform = d.getVar('GRUBPLATFORM', True)
+if target == "x86_64":
+grubtarget = 'x86_64'
+grubimage = "bootx64." + platform
+elif re.match('i.86', target):
+grubtarget = 'i386'
+grubimage = "bootia32." + platform
+elif re.match('arm', target):
+grubtarget = 'arm'
+grubimage = "bootarm." + platform
+elif re.match('aarch64', target):
+grubtarget = 'arm64'
+grubimage = "bootaa64." + platform
+else:
+raise bb.parse.SkipPackage("grub is incompatible with target %s" % 
target)
+d.setVar("GRUB_TARGET", grubtarget)
+d.setVar("GRUB_IMAGE", grubimage)
+}
+
+do_install_class-native() {
+install -d ${D}${bindir}
+install -m 755 grub-mkimage ${D}${bindir}
+}
+
+do_install_append() {
 install -d ${D}${sysconfdir}/grub.d
 rm -rf ${D}${libdir}/charset.alias
 }
 
+GRUB_BUILDIN ?= "boot linux ext2 fat serial part_msdos part_gpt normal efi_gop 
iso9660 search"
+do_deploy() {
+# Search for the grub.cfg on the local boot media by using the
+# built in cfg file provided via this recipe
+grub-mkimage -c ../cfg -p /EFI/BOOT -d ./grub-core/ \
+   -O ${GRUB_TARGET}-${GRUBPLATFORM} -o ./${GRUB_IMAGE} \
+   ${GRUB_BUILDIN}
+install -m 644 ${B}/${GRUB_IMAGE} ${DEPLOYDIR}
+}
+
+do_deploy_class-native() {
+:
+}
+
+addtask deploy after do_install before do_build
+
 # debugedit chokes on bare metal binaries
 INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
 
-RDEPENDS_${PN} = "diffutils freetype"
-
 INSANE_SKIP_${PN} = "arch"
 INSANE_SKIP_${PN}-dbg = "arch"
+
+BBCLASSEXTEND = "native"
-- 
1.9.1

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core