From 4a2a102033e9acfb747b7def829f1a07af4d264a Mon Sep 17 00:00:00 2001 From: Philippe Coval Date: Mon, 15 Dec 2014 14:11:53 +0100 Subject: [PATCH] wip: u-boot Change-Id: I0ec7dc621be3e9c915a0198d4c52fa2a39bcee60 Signed-off-by: Philippe Coval --- packaging/setup-scripts.spec | 12 +++++++++ setup-scripts-boot | 48 +++++++++++++++++++++++++++++++++++- 2 files changed, 59 insertions(+), 1 deletion(-) diff --git a/packaging/setup-scripts.spec b/packaging/setup-scripts.spec index ec37bc7..7546255 100644 --- a/packaging/setup-scripts.spec +++ b/packaging/setup-scripts.spec @@ -29,6 +29,12 @@ Provides: virtual-%{name}-bootloader Requires: %{name} = %{version}-%{release} Requires: syslinux-extlinux +%package -n %{name}-u-boot +Summary: Command-line tool for tweaking u-boot configuration +Provides: virtual-%{name}-bootloader +Requires: %{name} = %{version}-%{release} +Requires: u-boot + %package -n %{name}-clone Summary: A tool for cloning a Tizen system Provides: setup-ivi-clone = %{version}-%{release} @@ -56,6 +62,9 @@ configuration files. This package provides a command-line tool for changing the extlinux bootloader configuration file. +%description -n %{name}-u-boot +TODO + %description -n %{name}-clone This package provides a command line tool for cloning a Tizen system to a different disk. @@ -112,6 +121,9 @@ rm -rf %{buildroot} %defattr(-,root,root) %{_sbindir}/setup-extlinux-conf +%files -n %{name}-u-boot +%defattr(-,root,root) + %files -n setup-scripts-clone %defattr(-,root,root) %{_sbindir}/setup-scripts-clone diff --git a/setup-scripts-boot b/setup-scripts-boot index e1dc8cf..5bb0afb 100755 --- a/setup-scripts-boot +++ b/setup-scripts-boot @@ -121,6 +121,52 @@ install_extlinux() verbose "installed extlinux to $bootdir" } +install_uboot() +{ + boot_part="/boot" + ls "${boot_part}" || exit 1 + # repart part + # copy files to offset + + + # Get device node name for the boot partition + local boot_devnode + installerfw_get_part_info "/boot" "DEVNODE_NOW" "boot_devnode" + if [ ! -n "$boot_devnode" ] ; then + verbose "No /boot part, fallback to /" + installerfw_get_part_info "/" "DEVNODE_NOW" "boot_devnode" + fi + [ -n "$boot_devnode" ] || \ + fatal "cannot find device node of the boot disk, probably" \ + "INSTALLERFW_PARTx_DEVNODE_NOW environment" \ + "variable is not defined" + + + # Get device node name for the boot disk + local mbr_devnode + installerfw_get_part_info "/boot" "DISK_DEVNODE_NOW" "mbr_devnode" + if [ ! -n "$mbr_devnode" ] ; then + verbose "No /boot disk, fallback to /" + installerfw_get_part_info "/" "DISK_DEVNODE_NOW" "mbr_devnode" + fi + [ -n "$mbr_devnode" ] || \ + fatal "cannot find device node of the boot disk, probably" \ + "INSTALLERFW_PARTx_DISK_DEVNODE_NOW environment" \ + "variable is not defined" + + file="/usr/lib/u-boot-hardkernel.sh" # TODO place it in setup-scripts + [ ! -r "${file}" ] || $SHELL "${file}" "${mbr_devnode}" +} + +install_msdos_boot_system() +{ + if [ -d "/usr/share/syslinux" ] ; then + install_syslinux + else + install_uboot + fi +} + show_usage() { cat <<-EOF @@ -185,7 +231,7 @@ get_os_name "os_name" if installerfw_is_efi_boot_system; then install_gummiboot else - install_extlinux + install_msdos_boot_system fi # Create bootloader entries for each kernel -- 2.34.1