Initial commit accepted/tizen/20130625.160256 submit/tizen/20130625.144120
authorArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
Tue, 25 Jun 2013 13:19:16 +0000 (16:19 +0300)
committerArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
Tue, 25 Jun 2013 14:40:35 +0000 (17:40 +0300)
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
packaging/setup-efi-ivi.changes [new file with mode: 0644]
packaging/setup-efi-ivi.manifest [new file with mode: 0644]
packaging/setup-efi-ivi.spec [new file with mode: 0644]
setup-efi-ivi [new file with mode: 0755]

diff --git a/packaging/setup-efi-ivi.changes b/packaging/setup-efi-ivi.changes
new file mode 100644 (file)
index 0000000..d440a45
--- /dev/null
@@ -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 (file)
index 0000000..017d22d
--- /dev/null
@@ -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 (file)
index 0000000..4fba258
--- /dev/null
@@ -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 (executable)
index 0000000..972bf74
--- /dev/null
@@ -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