diff options
author | Artem Bityutskiy <artem.bityutskiy@linux.intel.com> | 2013-06-25 16:19:16 +0300 |
---|---|---|
committer | Artem Bityutskiy <artem.bityutskiy@linux.intel.com> | 2013-06-25 17:40:35 +0300 |
commit | cbc538235a74035a876e7b4fe32544b569def2ca (patch) | |
tree | 8b5ecd25051123cb1cd7cf08050892fcb2af945c | |
download | setup-efi-ivi-cbc538235a74035a876e7b4fe32544b569def2ca.tar.gz setup-efi-ivi-cbc538235a74035a876e7b4fe32544b569def2ca.tar.bz2 setup-efi-ivi-cbc538235a74035a876e7b4fe32544b569def2ca.zip |
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
-rw-r--r-- | packaging/setup-efi-ivi.changes | 2 | ||||
-rw-r--r-- | packaging/setup-efi-ivi.manifest | 5 | ||||
-rw-r--r-- | packaging/setup-efi-ivi.spec | 42 | ||||
-rwxr-xr-x | setup-efi-ivi | 75 |
4 files changed, 124 insertions, 0 deletions
diff --git a/packaging/setup-efi-ivi.changes b/packaging/setup-efi-ivi.changes new file mode 100644 index 0000000..d440a45 --- /dev/null +++ b/packaging/setup-efi-ivi.changes @@ -0,0 +1,2 @@ +* Tue Jun 25 13:54:36 UTC 2013 Artem Bityutskiy * <artem.bityutskiy@linux.intel.com> 1.0 +- This package configures the system to support UEFI boot. diff --git a/packaging/setup-efi-ivi.manifest b/packaging/setup-efi-ivi.manifest new file mode 100644 index 0000000..017d22d --- /dev/null +++ b/packaging/setup-efi-ivi.manifest @@ -0,0 +1,5 @@ +<manifest> + <request> + <domain name="_"/> + </request> +</manifest> diff --git a/packaging/setup-efi-ivi.spec b/packaging/setup-efi-ivi.spec new file mode 100644 index 0000000..4fba258 --- /dev/null +++ b/packaging/setup-efi-ivi.spec @@ -0,0 +1,42 @@ +Name: setup-efi-ivi +Version: 1.0 +Release: 0 +License: GPL-2.0 +Summary: System UEFI boot setup +Url: http://www.tizen.org +Group: System/Configuration +Source: %{name}_%{version}.tar.gz +Requires: gummiboot +Requires: /usr/bin/sed +Requires: /usr/bin/sort +Requires: /usr/bin/grep +ExclusiveArch: %{ix86} x86_64 + +%description +Configure the system to support booting on UEFI platforms. + +### +### PREP +### +%prep +%setup -q -n %{name}-%{version} + +### +### INSTALL +### +%install +install -d %{buildroot}/%{_sbindir} +install -m755 setup-efi-ivi %{buildroot}/%{_sbindir} + +### +### CLEAN +### +%clean +rm -rf %{buildroot} + +### +### FILES +### +%files +%defattr(-,root,root) +%{_sbindir}/setup-efi-ivi diff --git a/setup-efi-ivi b/setup-efi-ivi new file mode 100755 index 0000000..972bf74 --- /dev/null +++ b/setup-efi-ivi @@ -0,0 +1,75 @@ +#!/bin/sh -ef + +PROG="setup-efi-ivi" + +# This is a helper function which prints an error message and exits +fatal() +{ + echo "$PROG: error: $1" 1>&2 + exit 1 +} + +boot_mountpoint="/boot" + +# Make sure the installer framework variables are defined +[ "x$INSTALLERFW_INSTALLER_NAME" != "x" ] || + fatal "installer framework environment variables not found" + +# Find the root and boot paritions +pnum=0 +root_partuuid= +boot_fstype= + +while [ "$pnum" -lt "$INSTALLERFW_PART_COUNT" ]; do + mountpoint="INSTALLERFW_PART${pnum}_MOUNTPOINT" + mountpoint="$(eval echo '$'$mountpoint)" + + # Find out all the required data for the root and boot partition + if [ "$mountpoint" == "/" ]; then + root_partuuid=INSTALLERFW_PART${pnum}_PARTUUID + root_partuuid="$(eval echo '$'$root_partuuid)" + elif [ "$mountpoint" == "$boot_mountpoint" ]; then + boot_fstype=INSTALLERFW_PART${pnum}_FSTYPE + boot_fstype="$(eval echo '$'$boot_fstype)" + fi + + pnum="$((pnum+1))" +done + +# Make sure that the boot partition has a FAT file-system +[ "$boot_fstype" == "vfat" ] || \ + fatal "boot partition has to have type \"vfat\"" + +# Make sure gummiboot is installed in the system +if ! ([ -f /usr/lib/gummiboot/gummibootia32.efi ] || \ + [ -f /usr/lib/gummiboot/gummibootx64.efi ]); then + fatal "\"/usr/lib/gummiboot/gummiboot*.efi\" files not found!" +fi + +# Install gummiboot +mkdir -p "$boot_mountpoint/EFI/boot" +[ -f "/usr/lib/gummiboot/gummibootia32.efi" ] && + cp "/usr/lib/gummiboot/gummibootia32.efi" "$boot_mountpoint/EFI/boot/bootia32.efi" +[ -f "/usr/lib/gummiboot/gummibootx64.efi" ] && + cp "/usr/lib/gummiboot/gummibootx64.efi" "$boot_mountpoint/boot/EFI/boot/bootx64.efi" + +# Find out the latest kernel binary in boot partition +vmlinuz="$(ls -1 "$boot_mountpoint" | grep "^vmlinuz-" | sort -r | head -n1)" +vmlinuz_version="$(echo $vmlinuz | sed -e 's/vmlinuz-\(.*\)/\1/')" + +# Create the gummiboot configuration file +mkdir -p "$boot_mountpoint/loader" + +cat > "$boot_mountpoint/loader/loader.conf" <<-EOF +timeout 0 +default vmlinuz-default.conf +EOF + +# Create the default gummiboot entry +mkdir -p "$boot_mountpoint/loader/entries" +cat > "$boot_mountpoint/loader/entries/vmlinuz-default.conf" <<-EOF +title Tizen IVI 3.0 +version $vmlinuz_version +efi /$vmlinuz +options $INSTALLERFW_KERNEL_OPTS root=PARTUUID=$root_partuuid +EOF |