Skip to contentSkip to conversation

aarch64 changes for meta layer

PATCH In review Naresh Bhat 1 participant 7 messages Mar 9, 2015 – Mar 13, 2015

lore
Share & tools
lore
#0 lore raw

cover aarch64 changes for meta layer

I am adding the support of aarch64 to LUV OS Distribution project. The luv-yocto project is based on poky distribution.

https://01.org/linux-uefi-validation

While adding support I find that these are the few meta layer changes, which I have been asked to upstream. If we merge these changes into openembedded-core it will be more helpful to maintain the minimum set patches at dependency projects like luv-yocto.

Changes since V0:[RFC series]
- Include all the chages suggested by Bernhard Reutner-Fischer
- Add grub recipe changes suggested by Burton Ross

Naresh Bhat (5):
bootimg: Add support to install Image
syslinux: Remove bootimg dependency for aarch64
bootimg: Skip iso image build for aarch64
grub: Update grub git recipe
grub-efi: Add support to install grubaa64 efi

 meta/classes/bootimg.bbclass      |   17 ++++++++++---
 meta/classes/grub-efi.bbclass     |   17 ++++++++-----
 meta/classes/syslinux.bbclass     |   11 ++++++++-
 meta/recipes-bsp/grub/grub_git.bb |   48 +++++++++++++++++++++++++++++++------
 4 files changed, 76 insertions(+), 17 deletions(-)
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/5 bootimg: Add support to install Image

Add support to install kernel image for aarch64

---
 meta/classes/bootimg.bbclass |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
meta/classes/bootimg.bbclass +9 -2
index b1c03ba..ed7b32f 100644
@@ -64,10 +64,17 @@ inherit ${EFI_CLASS}
 
 populate() {
 	DEST=$1
-	install -d ${DEST}
+
+	SRC_KERNEL_IMAGE=bzImage
+	DEST_KERNEL_IMAGE=vmlinuz
+
+	if [ "${TARGET_ARCH}" = "aarch64" ]; then
+		SRC_KERNEL_IMAGE=Image
+		DEST_KERNEL_IMAGE=Image
+	fi
 
 	# Install bzImage, initrd, and rootfs.img in DEST for all loaders to use.
-	install -m 0644 ${DEPLOY_DIR_IMAGE}/bzImage ${DEST}/vmlinuz
+	install -m 0644 -D ${STAGING_KERNEL_DIR}/${SRC_KERNEL_IMAGE} ${DEST}/${DEST_KERNEL_IMAGE}
 	
 	# initrd is made of concatenation of multiple filesystem images
 	if [ -n "${INITRD}" ]; then
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH 2/5 syslinux: Remove bootimg dependency for aarch64

In reply to Naresh Bhat

Remove the bootimg dependency as syslinux for aarch64. The reasons to skip the syslinux package
- syslinux package contains x86 assembly code. Hence compilation errors on aarch64.
- There is no BIOS on aarch64 to answer syscalls.

---
 meta/classes/syslinux.bbclass |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
meta/classes/syslinux.bbclass +10 -1
index d6498d9..2efb764 100644
@@ -17,7 +17,16 @@
 # ${SYSLINUX_SERIAL_TTY} - Set alternate console=tty... kernel boot argument
 # ${SYSLINUX_KERNEL_ARGS} - Add additional kernel arguments
 
-do_bootimg[depends] += "${MLPREFIX}syslinux:do_populate_sysroot \
+def boot_image_depends(bb, d):
+         import re
+         deps = bb.data.getVar('TARGET_PREFIX', d, True)
+         if re.search("(x86_64|i.86).*",deps):
+                 return "${MLPREFIX}syslinux"
+         if re.search("aarch64",deps):
+                 return ""
+RDEPENDS = "${@boot_image_depends(bb, d)}"
+
+do_bootimg[depends] += "${RDEPENDS}:do_populate_sysroot \
                         syslinux-native:do_populate_sysroot"
 
 SYSLINUXCFG  = "${S}/syslinux.cfg"
Signature · 1 line
1.7.9.5
#3 lore raw

PATCH 3/5 bootimg: Skip iso image build for aarch64

In reply to Naresh Bhat

To generate bootable ISO image the x86 architecture uses syslinux package (syslinux/isolinux.bin). We have already skip the syslinux package for aarch64. Hence skip the iso image build for aarch64.

---
 meta/classes/bootimg.bbclass |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
meta/classes/bootimg.bbclass +5 -1
index ed7b32f..d8c2a59 100644
@@ -265,7 +265,11 @@ python do_bootimg() {
     if d.getVar("EFI", True) == "1":
         bb.build.exec_func('build_efi_cfg', d)
     bb.build.exec_func('build_hddimg', d)
-    bb.build.exec_func('build_iso', d)
+
+    if d.getVar('TARGET_ARCH', True) == "aarch64":
+            return
+    else:
+            bb.build.exec_func('build_iso', d)
 }
 
 IMAGE_TYPEDEP_iso = "ext3"
Signature · 1 line
1.7.9.5
#4 lore raw

PATCH 4/5 grub: Update grub git recipe

In reply to Naresh Bhat

Update the grub git recipe with the following actions for native and target
- Base class extend to native
- do_configure_prepend
- do_install_append
- do_mkimage native
- do_deploy

---
 meta/recipes-bsp/grub/grub_git.bb |   48 +++++++++++++++++++++++++++++++------
 1 file changed, 41 insertions(+), 7 deletions(-)
meta/recipes-bsp/grub/grub_git.bb +41 -7
index 3ab675b..a5ab649 100644
@@ -8,6 +8,7 @@ DEFAULT_PREFERENCE_arm = "1"
 PV = "2.00+${SRCPV}"
 SRCREV = "87de66d9d83446ecddb29cfbdf7369102c8e209e"
 SRC_URI = "git://git.savannah.gnu.org/grub.git \
+           file://cfg \
            file://grub-2.00-fpmath-sse-387-fix.patch \
            file://autogen.sh-exclude-pc.patch \
            file://grub-2.00-add-oe-kernel.patch \
@@ -18,7 +19,7 @@ S = "${WORKDIR}/git"
 
 COMPATIBLE_HOST = '(x86_64.*|i.86.*|arm.*|aarch64.*)-(linux.*|freebsd.*)'
 
-inherit autotools gettext texinfo
+inherit autotools-brokensep gettext texinfo deploy
 
 PACKAGECONFIG ??= ""
 PACKAGECONFIG[grub-mount] = "--enable-grub-mount,--disable-grub-mount,fuse"
@@ -31,24 +32,57 @@ 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"
 
+export ac_cv_path_HELP2MAN=""
+
 do_configure_prepend() {
-    ( cd ${S}
-      ${S}/autogen.sh )
+      ./autogen.sh
+}
+
+do_install_append_class-native() {
+        install -m 755 -D grub-mkimage ${D}${bindir}
 }
 
-do_install_append () {
-    install -d ${D}${sysconfdir}/grub.d
- 
+do_install_append_class-target() {
+    # 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} \
+        boot linux ext2 fat serial part_msdos part_gpt \
+        normal efi_gop iso9660 search efinet tftp all_video chain \
+        gfxmenu jpeg gfxterm
+
+    install -m 0755 -D ${B}/${GRUB_IMAGE} ${D}${bindir}
+}
+
+GRUB_TARGET_aarch64 = "arm64"
+GRUB_IMAGE_aarch64 = "grubaa64.efi"
+
+do_mkimage_class-native() {
+        :
 }
 
+do_deploy() {
+    install -m 0755 -D ${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"
+RDEPENDS_${PN}_class-target = "diffutils freetype"
 FILES_${PN}-dbg += "${libdir}/${BPN}/*/.debug"
 
 INSANE_SKIP_${PN} = "arch"
 INSANE_SKIP_${PN}-dbg = "arch"
+
+DEPENDS_class-target += "grub-native"
+BBCLASSEXTEND = "native"
Signature · 1 line
1.7.9.5
#5 lore raw

PATCH 5/5 grub-efi: Add support to install grubaa64 efi

In reply to Naresh Bhat

Add support to install grubaa64.efi image. By default GRUB_IMAGE contains the bootia32.efi image. Depending on the architecture type the variable is being updated to either bootia64.efi or grubaa64.efi

---
 meta/classes/grub-efi.bbclass |   17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)
meta/classes/grub-efi.bbclass +11 -6
index 47bd35e..cded1a0 100644
@@ -31,15 +31,20 @@ efi_populate() {
 	# nested under a top level directory.
 	DEST=$1
 
-	install -d ${DEST}${EFIDIR}
-
 	GRUB_IMAGE="bootia32.efi"
-	if [ "${TARGET_ARCH}" = "x86_64" ]; then
+
+	case ${TARGET_ARCH} in
+		x86_64 )
 		GRUB_IMAGE="bootx64.efi"
-	fi
-	install -m 0644 ${DEPLOY_DIR_IMAGE}/${GRUB_IMAGE} ${DEST}${EFIDIR}
+		;;
+		aarch64 )
+		GRUB_IMAGE="grubaa64.efi"
+		;;
+	esac
+
+	install -m 0644 -D ${DEPLOY_DIR_IMAGE}/${GRUB_IMAGE} ${DEST}${EFIDIR}
 
-	install -m 0644 ${GRUBCFG} ${DEST}${EFIDIR}
+	install -m 0644 -D ${GRUBCFG} ${DEST}${EFIDIR}
 }
 
 efi_iso_populate() {
Signature · 1 line
1.7.9.5
#6 lore raw
In reply to Naresh Bhat

Hi,

Please, Ignore this series for review. I will resend the same series with few corrections. My apologies for noise.

Thanks and Regards
-Naresh

Quoted 32 lines · Naresh Bhat

I am adding the support of aarch64 to LUV OS Distribution project. The luv-yocto project is based on poky distribution.

https://01.org/linux-uefi-validation

While adding support I find that these are the few meta layer changes, which I have been asked to upstream. If we merge these changes into openembedded-core it will be more helpful to maintain the minimum set patches at dependency projects like luv-yocto.

Changes since V0:[RFC series]
- Include all the chages suggested by Bernhard Reutner-Fischer
- Add grub recipe changes suggested by Burton Ross

Naresh Bhat (5):
bootimg: Add support to install Image
syslinux: Remove bootimg dependency for aarch64
bootimg: Skip iso image build for aarch64
grub: Update grub git recipe
grub-efi: Add support to install grubaa64 efi

 meta/classes/bootimg.bbclass      |   17 ++++++++++---
 meta/classes/grub-efi.bbclass     |   17 ++++++++-----
 meta/classes/syslinux.bbclass     |   11 ++++++++-
 meta/recipes-bsp/grub/grub_git.bb |   48
+++++++++++++++++++++++++++++++------
 4 files changed, 76 insertions(+), 17 deletions(-)

--
1.7.9.5