[gnu-efi] Add "modelist.efi" into package.

Peter Jones pjones at fedoraproject.org
Fri Sep 10 20:18:58 UTC 2010


commit c7f23443b7e5c6cb9a28c4b5d93d0e4abcad759c
Author: Peter Jones <pjones at redhat.com>
Date:   Fri Sep 10 16:18:33 2010 -0400

    Add "modelist.efi" into package.

 gnu-efi-3.0e-modelist.patch |  120 +++++++++++++++++++++++++++++++++++++++++++
 gnu-efi.spec                |   16 ++++--
 2 files changed, 132 insertions(+), 4 deletions(-)
---
diff --git a/gnu-efi-3.0e-modelist.patch b/gnu-efi-3.0e-modelist.patch
new file mode 100644
index 0000000..393f1fa
--- /dev/null
+++ b/gnu-efi-3.0e-modelist.patch
@@ -0,0 +1,120 @@
+From cd8986077a785053abee62a3faf0708759625f7a Mon Sep 17 00:00:00 2001
+From: Peter Jones <pjones at redhat.com>
+Date: Fri, 10 Sep 2010 16:04:38 -0400
+Subject: [PATCH] Add "modelist" test app.
+
+This lists video modes the GOP driver is showing us.
+---
+ apps/Makefile   |    2 +-
+ apps/modelist.c |   86 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 87 insertions(+), 1 deletions(-)
+ create mode 100644 apps/modelist.c
+
+diff --git a/apps/Makefile b/apps/Makefile
+index 2baf64d..6b50e4f 100644
+--- a/apps/Makefile
++++ b/apps/Makefile
+@@ -38,7 +38,7 @@ LDFLAGS		+= -T $(LDSCRIPT) -shared -Bsymbolic -L../lib -L../gnuefi $(CRTOBJS)
+ LOADLIBES	= -lefi -lgnuefi $(shell $(CC) $(ARCH3264) -print-libgcc-file-name)
+ FORMAT		= efi-app-$(ARCH)
+ 
+-TARGETS = t.efi t2.efi t3.efi t4.efi t5.efi t6.efi printenv.efi t7.efi route80h.efi
++TARGETS = t.efi t2.efi t3.efi t4.efi t5.efi t6.efi printenv.efi t7.efi route80h.efi modelist.efi
+ 
+ all:	$(TARGETS)
+ 
+diff --git a/apps/modelist.c b/apps/modelist.c
+new file mode 100644
+index 0000000..0f6e75d
+--- /dev/null
++++ b/apps/modelist.c
+@@ -0,0 +1,86 @@
++#include <efi.h>
++#include <efilib.h>
++
++extern EFI_GUID GraphicsOutputProtocol;
++
++static void
++print_modes(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop)
++{
++	int i, imax;
++	EFI_STATUS rc;
++
++	imax = gop->Mode->MaxMode;
++
++	Print(L"GOP reports MaxMode %d\n", imax);
++	for (i = 0; i < imax; i++) {
++		EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *info;
++		UINTN SizeOfInfo;
++		rc = uefi_call_wrapper(gop->QueryMode, 4, gop, i, &SizeOfInfo,
++					&info);
++		if (EFI_ERROR(rc)) {
++			CHAR16 Buffer[64];
++			StatusToString(Buffer, rc);
++			Print(L"%d: Bad response from QueryMode: %s (%d)\n",
++				i, Buffer, rc);
++			continue;
++		}
++		Print(L"%d: %dx%d ", i, info->HorizontalResolution,
++			info->VerticalResolution);
++		switch(info->PixelFormat) {
++			case PixelRedGreenBlueReserved8BitPerColor:
++				Print(L"RGBR");
++				break;
++			case PixelBlueGreenRedReserved8BitPerColor:
++				Print(L"BGRR");
++				break;
++			case PixelBitMask:
++				Print(L"R:%08x G:%08x B:%08x X:%08x",
++					info->PixelInformation.RedMask,
++					info->PixelInformation.GreenMask,
++					info->PixelInformation.BlueMask,
++					info->PixelInformation.ReservedMask);
++				break;
++			case PixelBltOnly:
++				Print(L"(blt only)");
++				break;
++			default:
++				Print(L"(Invalid pixel format)");
++				break;
++		}
++		Print(L" pitch %d\n", info->PixelsPerScanLine);
++	}
++}
++
++static EFI_STATUS
++SetWatchdog(UINTN seconds)
++{
++	EFI_STATUS rc;
++	rc = uefi_call_wrapper(BS->SetWatchdogTimer, 4, seconds, 0x1ffff,
++				0, NULL);
++	if (EFI_ERROR(rc)) {
++		CHAR16 Buffer[64];
++		StatusToString(Buffer, rc);
++		Print(L"Bad response from QueryMode: %s (%d)\n", Buffer, rc);
++	}
++	return rc;
++}
++
++EFI_STATUS
++efi_main (EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *systab)
++{
++	EFI_STATUS rc;
++	EFI_GRAPHICS_OUTPUT_PROTOCOL *gop;
++
++	InitializeLib(image_handle, systab);
++
++	SetWatchdog(10);
++
++	rc = LibLocateProtocol(&GraphicsOutputProtocol, (void **)&gop);
++	if (EFI_ERROR(rc))
++		return rc;
++
++	print_modes(gop);
++
++	SetWatchdog(0);
++	return EFI_SUCCESS;
++}
+-- 
+1.7.2.3
+
diff --git a/gnu-efi.spec b/gnu-efi.spec
index 9c96cab..31e770b 100644
--- a/gnu-efi.spec
+++ b/gnu-efi.spec
@@ -1,7 +1,7 @@
 Summary: Development Libraries and headers for EFI
 Name: gnu-efi
 Version: 3.0e
-Release: 11%{?dist}
+Release: 12%{?dist}
 Group: Development/System
 License: GPLv2+
 URL: ftp://ftp.hpl.hp.com/pub/linux-ia64
@@ -12,8 +12,9 @@ Patch2: gnu-efi-3.0e-ignore-gnu-stack.patch
 Patch3: gnu-efi-3.0e-add-uefi-2.x-boot-services.patch
 Patch4: gnu-efi-3.0e-add-pciio.patch
 Patch5: gnu-efi-3.0e-route80h.patch
+Patch6: gnu-efi-3.0e-modelist.patch
 # "git am" doesn't like ms-dos formatted text-files.
-#Patch6: gnu-efi-3.0e-add-pciio-2.patch
+#Patch7: gnu-efi-3.0e-add-pciio-2.patch
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 ExclusiveArch: i686 x86_64 ia64
 BuildRequires: git
@@ -47,18 +48,25 @@ make PREFIX=%{_prefix} LIBDIR=%{_libdir} INSTALLROOT=%{buildroot} install
 mkdir -p %{buildroot}/%{_libdir}/gnuefi
 mv %{buildroot}/%{_libdir}/*.lds %{buildroot}/%{_libdir}/*.o %{buildroot}/%{_libdir}/gnuefi
 
-make -C apps clean
+make -C apps clean route80h.efi modelist.efi
+mkdir -p %{buildroot}/boot/efi/EFI/redhat/
+mv apps/{route80h.efi,modelist.efi} %{buildroot}/boot/efi/EFI/redhat/
 
 %clean
 rm -rf %{buildroot}
 
 %files
 %defattr(-,root,root,-)
-%doc README.* ChangeLog apps
+%doc README.* ChangeLog
 %{_includedir}/efi
 %{_libdir}/*
+%dir /boot/efi/EFI/redhat/
+%attr(0644,root,root) /boot/efi/EFI/redhat/*.efi
 
 %changelog
+* Fri Sep 10 2010 Peter Jones <pjones at redhat.com> - 3.0e-12
+- Add "modelist.efi" test utility in apps/
+
 * Mon Jul 26 2010 Peter Jones <pjones at redhat.com> - 3.0e-11
 - Add PciIo headers.
 


More information about the scm-commits mailing list