wip: u-boot sandbox/pcoval/devel
authorPhilippe Coval <philippe.coval@open.eurogiciel.org>
Mon, 15 Dec 2014 13:11:53 +0000 (14:11 +0100)
committerPhilippe Coval <philippe.coval@open.eurogiciel.org>
Mon, 15 Dec 2014 13:11:53 +0000 (14:11 +0100)
Change-Id: I0ec7dc621be3e9c915a0198d4c52fa2a39bcee60
Signed-off-by: Philippe Coval <philippe.coval@open.eurogiciel.org>
packaging/setup-scripts.spec
setup-scripts-boot

index ec37bc7abe9f5697a36904d863aab7d31c46eac6..754625598fc020243148540b32b1acfda3139ed4 100644 (file)
@@ -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
index e1dc8cf57e044b7d511958c30144c69d279b9c06..5bb0afb70728d288dbc3e8643130f2e9edbb62f5 100755 (executable)
@@ -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