Yosemite DP1 Includes new EFI images/sound files

Sam’s efires-xtract (Perl script) was already a handy tool, but it needed a few tweaks here and there. For example. Version 0.5 adds support for Yosemite. In fact. It should support all future version of OS X, this because it no longer use hard-coded filenames. Nope. Now it reads: /use/standalone/i386/EfiLoginUI/ and get the target file names automatically. No more tweaking. Ok. Let’s run ./efires-xtract and see what we get:

1) appleLogo.efires (4 images) NEW
– appleLogo_apple.png (84 x 103 pixels)
– appleLogo_apple@2x.png (168 x 206 pixels)
– appleLogo_apple_gray.png (90 x 95 pixels)
– appleLogo_apple_gray@2x.png (160 x 190 pixels)

2) battery.efires (430 images)

3) disk_passwordUI.efires (20 images)

4) flag_picker.efires (698 images)

5) guest_userUI.efires (20 images)

6) loginui.efires (116 images)

7) Lucida13.efires (892 images)

8) recovery_user.efires (2 images)

9) recoveryUI.efires (10 images)

10) sound.efires (6 images) NEW

– sound_SCREFIAudio.Beep
– sound_SCREFIAudio.Password
– sound_SCREFIAudio.Username
– sound_SCREFIAudio.UsernameOrPasswordIncorrect
– sound_SCREFIAudio.VoiceOverOff
– sound_SCREFIAudio.VoiceOverOn

11) unknown_userUI.efires (22 images)

Ok. So the Yosemite Developer Preview 1 includes two new files called: appleLogo.efires and sound.efires Wait what. Sound?

Let’s have a look at the header data. For this we use: xxd -l 144 sound_SCREFIAudio.caf

0000000: 6361 6666 0001 0000 6465 7363 0000 0000 caff....desc....
0000010: 0000 0020 40e5 8880 0000 0000 696d 6134 ... @.......ima4
0000020: 0000 0000 0000 0022 0000 0040 0000 0001 ......."...@....
0000030: 0000 0000 696e 666f 0000 0000 0000 003f ....info.......?
0000040: 0000 0002 6170 7072 6f78 696d 6174 6520 ....approximate
0000050: 6475 7261 7469 6f6e 2069 6e20 7365 636f duration in seco
0000060: 6e64 7300 302e 3034 3600 736f 7572 6365 nds.0.046.source
0000070: 2062 6974 2064 6570 7468 0049 3136 0070 bit depth.I16.p
0000080: 616b 7400 0000 0000 0000 1800 0000 0000 akt.............

Cool. So this is actually a file in Apple Core Audio Format. And adding a .caf file extension should change the icon and then we should be able to play it with the QuickTime Player. Yup. That worked. Perfect.

Note: run sudo chmod +x efires-xtract before running it.

Expect an update after my coffee break!

Edit

Crap. I used an old HDD for my Yosemite installation and it started to make funny noises. Like tick tick tick. Won’t boot up anymore. Had to re-install Yosemite and get stuff going again, which was why my coffee break went on forever.

I now also added the PNG image sizes, and here is a cool new find. Add “meter=0” under ‘Kernel Flags’ in /Library/Preferences/SystemConfiguration/com.Apple.Boot.plist and the good old throbber is back. This setting also removes IODeviceTree:/chosen/IOProgressColorTheme (Number) 01.

I also changed RevoBoot, in my local repository, and now it loads: /usr/standalone/appleLogo.efires to get the Apple logos – gray or white, and scaling (1x or 2x) also works. Just like Boot.efi does.

For your info. The new BlackMode loads the white Apple logo, instead of the gray Apple logo, on a black background.

Update

Here is a proof of concept, showing you how to load and show the new Apple logo images in Yosemite.

//==============================================================================

typedef struct
{
	uint16_t	revision;
	uint16_t	imageCount;
} __attribute__((packed)) EFIRES_HEADER;

typedef struct
{
	char		filename[64];
	uint32_t	offset;
	uint32_t	imageSize;
} __attribute__((packed)) EFIRES_IMAGE_HEADER;

//==============================================================================

void showBootLogo()
{
	setVideoMode(GRAPHICS_MODE);

	long backGroundColor = 0xbfbfbf;

	char targetLogoName[30] = "appleLogo_apple";

	// bootArgs->flags |= kBootArgsFlagBlack is set by boot.efi (EFI var 'BlackMode')
	if (bootArgs->flags & kBootArgsFlagBlack)
	{
		backGroundColor = 0x030000;
	}
	else
	{
		sprintf(targetLogoName, "%s%s", targetLogoName, "_gray");
	}

	// bootArgs->flags |= kBootArgsFlagHiDPI is set by boot.efi (EFI var 'UIScale')
	sprintf(targetLogoName, "%s%s.png", targetLogoName, (bootArgs->flags & kBootArgsFlagHiDPI) ? "@2x" : "");

	setBackgroundColor(backGroundColor);
	
	void *imageLoadBuffer = (void *)kLoadAddr;

	int EFIResourceFile = open("/usr/standalone/i386/EfiLoginUI/appleLogo.efires", 0);
	
	if (EFIResourceFile >= 0)
	{
		int filesize = file_size(EFIResourceFile);
		
		if (read(EFIResourceFile, (char *) kLoadAddr, filesize) == filesize)
		{
			EFIRES_HEADER * header = (EFIRES_HEADER *) imageLoadBuffer;
#if DEBUG
			printf("\nheader->revision..: %d\n", header->revision);
			printf("header->imageCount: %d\n", header->imageCount);
#endif
			int pos = sizeof(header);

			for (int index = 0; index < header->imageCount; index++)
			{
				EFIRES_IMAGE_HEADER * imageHeader = (EFIRES_IMAGE_HEADER *) (imageLoadBuffer + pos);
#if DEBUG
				printf("imageHeader->filename.: %s\n", imageHeader->filename);
				printf("imageHeader->offset...: %d\n", imageHeader->offset);
				printf("imageHeader->imageSize: %d\n", imageHeader->imageSize);
#endif
				if (strncmp((char *)imageHeader->filename, targetLogoName, strlen(targetLogoName)) == 0)
				{
					PNG_info_t *info = PNG_decode((imageLoadBuffer + imageHeader->offset), imageHeader->imageSize);
#if DEBUG
					printf("Apple logo image found!\n");
					printf("Image width...........: %d\n", info->width);
					printf("Image height..........: %d\n", info->height);
					sleep(3);
#endif
					uint8_t *bootImage = malloc((info->width * 4) * info->height);
					memcpy(bootImage, info->image->data, ((info->width * 4) * info->height));
	
					uint16_t x = (VIDEO(width) - MIN(info->width, VIDEO(width)) ) / 2;
					uint16_t y = (VIDEO(height) - MIN(info->height, VIDEO(height)) ) / 2;
	
					blendImage(x, y, info->width, info->height, bootImage);
					png_alloc_free_all();
					free(bootImage);
					close(EFIResourceFile);
					return;
				}
				else
				{
					pos += sizeof(EFIRES_IMAGE_HEADER);
				}
			}
		}

		close(EFIResourceFile);
	}
	else
	{
		setVideoMode(FB_TEXT_MODE);
		error("showBootLogo(Error)");
	}
}

It should be fairly easy to port the code to Chameleon/Chimera.

Edit Typo fixed in logo scaling (@2X -> @2x).

Edit 2 The same (efires) image files can be found on the Recovery HD partition in the directory: com.apple.boot.P/usr/standalone/i386/EfiLoginUI/

Advertisements

3 thoughts on “Yosemite DP1 Includes new EFI images/sound files

  1. So in other words Apple are going to great lengths to change the look and feel of Mac OS. I was wondering why Yosemite is booting up weirdly when not in verbose mode. I shall try that script when I get home. A good reason not to visit the pub for a few drinks with my colleagues on a hot summer friday evening like today!

    Thanks Pike.

  2. Pingback: LZVN packed Apple Logo’s | Pike's Universum

  3. Pingback: New LZVN packed NetBoot images available | Pike's Universum

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s