Skip to contentSkip to conversation

Fix grub efi menu, kernel messages, and live image dosfsck

PATCH Applied Darren Hart 2 participants 6 messages Dec 16, 2011

lore
Share & tools
lore
#0 lore raw

cover Fix grub efi menu, kernel messages, and live image dosfsck

This series moves the live image EFI content to the /EFI/BOOT directory where it belongs per the specification. It also adds support for the efi_gop framebuffer. This allows grub to start on boot and the kernel to log messages to the physical console. Also correct some live image filesystem issues.

The following changes since commit 0eb139619301d0efee330932eba3617dcb39284e:

Patch Upstream Status Updates (2011-12-15 14:35:27 +0000)

are available in the git repository at:
git://git.yoctoproject.org/user-contrib/dvhart/oe-core dvhart/efi/dev
http://git.yoctoproject.org/cgit.cgi/user-contrib/dvhart/oe-core/log/?h=dvhart/efi/dev

Darren Hart (4):
grub-efi: Use /EFI/BOOT now that mkdosfs -d works with directories
grub-efi: Add efi_gop module to payload for physical console support
grub-efi: specify prefix so it can find grub.cfg
bootimg: Use dosfsck to clean up the generated live image

 meta/classes/bootimg.bbclass                  |    1 +
 meta/classes/grub-efi.bbclass                 |   18 +++---------------
 meta/recipes-bsp/grub/grub-efi-native_1.99.bb |    6 +++---
 3 files changed, 7 insertions(+), 18 deletions(-)
Signature · 1 line
1.7.6.4
#1 lore raw

PATCH 1/4 grub-efi: Use /EFI/BOOT now that mkdosfs -d works with directories

[Yocto 1783] prevented us from using a proper /EFI/BOOT path in the live images due to a bug in the -d patch for mkdosfs in dosfstools. With this now fixed, we can place the efi payload where it belongs per spec and the images will autoboot to the grub menu on EFI platforms.

---
 meta/classes/grub-efi.bbclass |   18 +++---------------
 1 files changed, 3 insertions(+), 15 deletions(-)
meta/classes/grub-efi.bbclass +3 -15
index 36b5831..762322b 100644
@@ -21,10 +21,8 @@ GRUB_TIMEOUT ?= "10"
 #FIXME: build this from the machine config
 GRUB_OPTS ?= "serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1"
 
-# FIXME: add EFI/BOOT to GRUB_HDDDIR once the mkdosfs subdir bug is resolved
-#        http://bugzilla.yoctoproject.org/show_bug.cgi?id=1783
 EFIDIR = "/EFI/BOOT"
-GRUB_HDDDIR = "${HDDDIR}"
+GRUB_HDDDIR = "${HDDDIR}${EFIDIR}"
 GRUB_ISODIR = "${ISODIR}${EFIDIR}"
 
 grubefi_populate() {
@@ -53,22 +51,12 @@ grubefi_populate() {
 
 grubefi_iso_populate() {
 	grubefi_populate ${GRUB_ISODIR}
-
-	# FIXUP the <EFIDIR> token in the config
-	# FIXME: This can be dropped once mkdosfs is fixed
-	sed -i "s@<EFIDIR>@${EFIDIR}@g" ${GRUB_ISODIR}/$(basename "${GRUBCFG}")
 }
 
 grubefi_hddimg_populate() {
 	grubefi_populate ${GRUB_HDDDIR}
-
-	# FIXUP the <EFIDIR> token in the config
-	# FIXME: This can be dropped once mkdosfs is fixed
-	sed -i "s@<EFIDIR>@@g" ${GRUB_HDDDIR}/$(basename "${GRUBCFG}")
 }
 
-# FIXME: The <EFIDIR> token can be replaced with ${EFIDIR} once the
-#        mkdosfs bug is resolved.
 python build_grub_cfg() {
     import sys
 
@@ -121,7 +109,7 @@ python build_grub_cfg() {
         bb.data.update_data(localdata)
 
         cfgfile.write('\nmenuentry \'%s\'{\n' % (label))
-        cfgfile.write('linux <EFIDIR>/vmlinuz LABEL=%s' % (label))
+        cfgfile.write('linux ${EFIDIR}/vmlinuz LABEL=%s' % (label))
 
         append = localdata.getVar('APPEND', True)
         initrd = localdata.getVar('INITRD', True)
@@ -131,7 +119,7 @@ python build_grub_cfg() {
         cfgfile.write('\n')
    
         if initrd:
-            cfgfile.write('initrd <EFIDIR>/initrd')
+            cfgfile.write('initrd ${EFIDIR}/initrd')
         cfgfile.write('\n}\n')
 
     cfgfile.close()
Signature · 1 line
1.7.6.4
#3 lore raw

PATCH 3/4 grub-efi: specify prefix so it can find grub.cfg

Specify /EFI/BOOT as the grub prefix so the grub efi payload can find the grub.cfg in the same directory. Ultimately, it might make more sense to install the grub tools and the grub-core modules to sysroot and make the grub-efi bbclass generate the image in the required format as part of the bootimg generation. However, bootimg is currently the only user, so make the correction here to resolve the immediate issue.

---
 meta/recipes-bsp/grub/grub-efi-native_1.99.bb |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
meta/recipes-bsp/grub/grub-efi-native_1.99.bb +2 -2
index c86cf50..9183812 100644
@@ -16,7 +16,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504"
 # FIXME: We should be able to optionally drop freetype as a dependency
 DEPENDS = "help2man-native"
 RDEPENDS_${PN} = "diffutils freetype"
-PR = "r1"
+PR = "r2"
 
 # Native packages do not normally rebuild when the target changes.
 # Ensure this is built once per HOST-TARGET pair.
@@ -58,7 +58,7 @@ EXTRA_OECONF = "--with-platform=efi --disable-grub-mkfont \
                 --target=${GRUB_TARGET} --enable-efiemu=no --program-prefix=''"
 
 do_mkimage() {
-	./grub-mkimage -p / -d ./grub-core/ \
+	./grub-mkimage -p /EFI/BOOT -d ./grub-core/ \
 		       -O ${GRUB_TARGET}-efi -o ./${GRUB_IMAGE} \
 	               boot linux fat serial part_msdos normal efi_gop
 }
Signature · 1 line
1.7.6.4
#2 lore raw

PATCH 2/4 grub-efi: Add efi_gop module to payload for physical console support

In reply to Darren Hart

Without the efi_gop module, the GRUB menu would work, but the Linux kernel messages would not be displayed to the physical console. Adding efi_gop causes grub to pass the proper information in the boot parameters pointer such that the Linux kernel can detect and use the EFI framebuffer.

---
 meta/recipes-bsp/grub/grub-efi-native_1.99.bb |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
meta/recipes-bsp/grub/grub-efi-native_1.99.bb +1 -1
index 40e618c..c86cf50 100644
@@ -60,7 +60,7 @@ EXTRA_OECONF = "--with-platform=efi --disable-grub-mkfont \
 do_mkimage() {
 	./grub-mkimage -p / -d ./grub-core/ \
 		       -O ${GRUB_TARGET}-efi -o ./${GRUB_IMAGE} \
-	               boot linux fat serial part_msdos normal
+	               boot linux fat serial part_msdos normal efi_gop
 }
 addtask mkimage after do_compile before do_install
 
Signature · 1 line
1.7.6.4
#4 lore raw

PATCH 4/4 bootimg: Use dosfsck to clean up the generated live image

In reply to Darren Hart

The generated filesystem has some errors that dosfsck is able to repair:

dosfsck 2.11, 12 Mar 2005, FAT32, LFN
Checking file /ldlinux.sys (LDLINUX.SYS)
Checking file /initrd (INITRD)
Checking file /syslinux.cfg (SYSLINUX.CFG)
Checking file /EFI (EFI)
Checking file /vmlinuz (VMLINUZ)
Checking file /rootfs.img (ROOTFS.IMG)
/vmlinuz
File size is 4144896 bytes, cluster chain length is > 4145152 bytes. Truncating file to 4144896 bytes.
Checking file /EFI/.. (..)
Checking file /EFI/BOOT (BOOT)
Checking file /EFI/. (.)
/EFI/..
Start (16022) does not point to .. (0)
/EFI/.
Start (0) does not point to parent (16022)
Checking file /EFI/BOOT/.. (..)
Checking file /EFI/BOOT/. (.)
Checking file /EFI/BOOT/initrd (INITRD)
Checking file /EFI/BOOT/grub.cfg (GRUB.CFG)
Checking file /EFI/BOOT/bootia32.efi (BOOTIA32.EFI)
Checking file /EFI/BOOT/vmlinuz (VMLINUZ)
Checking file /EFI/BOOT/rootfs.img (ROOTFS.IMG)
/EFI/BOOT/..
Start (16021) does not point to .. (16022)
/EFI/BOOT/.
Start (0) does not point to parent (16021)
/EFI/BOOT/vmlinuz
File size is 4144896 bytes, cluster chain length is > 4145152 bytes. Truncating file to 4144896 bytes.
Performing changes. /build/poky/fri2/tmp/deploy/images/core-image-minimal-fri2-noemgd-20111216000605.hddimg:
12 files, 26635/26828 clusters

Add a dosfsck command following the mkdosfs command to correct these.

CC Nitin A Kamble <[email protected]>
---
 meta/classes/bootimg.bbclass |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
meta/classes/bootimg.bbclass +1 -0
index 0d06351..8ec07a0 100644
@@ -109,6 +109,7 @@ build_hddimg() {
 
 		mkdosfs -n ${BOOTIMG_VOLUME_ID} -d ${HDDDIR} \
 		        -C ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hddimg $SIZE
+		dosfsck -a -l ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hddimg || true
 
 		if [ "${PCBIOS}" = "1" ]; then
 			syslinux_hddimg_install
Signature · 1 line
1.7.6.4
#5 lore raw
In reply to Darren Hart
Quoted 13 lines · Darren Hart

This series moves the live image EFI content to the /EFI/BOOT directory where it belongs per the specification. It also adds support for the efi_gop framebuffer. This allows grub to start on boot and the kernel to log messages to the physical console. Also correct some live image filesystem issues.

The following changes since commit 0eb139619301d0efee330932eba3617dcb39284e:

Patch Upstream Status Updates (2011-12-15 14:35:27 +0000)

are available in the git repository at:
git://git.yoctoproject.org/user-contrib/dvhart/oe-core dvhart/efi/dev
http://git.yoctoproject.org/cgit.cgi/user-contrib/dvhart/oe-core/log/?h=dvhart/efi/dev

Quoted 5 lines

Darren Hart (4):
grub-efi: Use /EFI/BOOT now that mkdosfs -d works with directories
grub-efi: Add efi_gop module to payload for physical console support
grub-efi: specify prefix so it can find grub.cfg
bootimg: Use dosfsck to clean up the generated live image

Merged to master, thanks.

Richard