Live installer fixes and EFI support
cover Live installer fixes and EFI support
Cleanup the existing installer a bit.
Fix the grub-efi-native help2man build issue.
Add EFI support to the installer.
I have tested both PCBIOS install as well as EFI install from a live USB key to the internal MMC device on the FRI2 BSP.
The following changes since commit a6b6df1350149c116050cb93c3c7b4802c709d31:
task-core-tools-debug: Added openssh-sftp-server. (2012-07-03 14:52:38 +0100)
are available in the git repository at:
git://git.yoctoproject.org/user-contrib/dvhart/oe-core installer
http://git.yoctoproject.org/cgit.cgi/user-contrib/dvhart/oe-core/log/?h=installer
Darren Hart (5):
init-install: Use swap_ratio in the calulation of swap_size
init-install: Correct ext2->ext3 typo in logging
init-install: Clean up partition alignment
grub-efi: Do not use help2man
EFI: Make installer EFI aware
meta/classes/grub-efi.bbclass | 2 + .../grub/files/grub-1.99-disable-help2man.patch | 231 ++++++++++++++++++++ meta/recipes-bsp/grub/grub-efi-native_1.99.bb | 17 +- .../images/core-image-minimal-initramfs.bb | 2 +- .../initrdscripts/files/init-install-efi.sh | 188 ++++++++++++++++ .../initrdscripts/files/init-install.sh | 12 +- meta/recipes-core/initrdscripts/files/init-live.sh | 6 +- 7 files changed, 440 insertions(+), 18 deletions(-) create mode 100644 meta/recipes-bsp/grub/files/grub-1.99-disable-help2man.patch create mode 100644 meta/recipes-core/initrdscripts/files/init-install-efi.sh
Signature · 1 line
1.7.5.4
PATCH 1/5 init-install: Use swap_ratio in the calulation of swap_size
swap_size currently uses a hard coded percentage and ignores the swap_ratio variable. Fortunately they are the same value currently. Make the calculation use the variable to avoid problems in the future.
--- .../initrdscripts/files/init-install.sh | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
meta/recipes-core/initrdscripts/files/init-install.sh +1 -1
@@ -81,7 +81,7 @@ cat /proc/mounts > /etc/mtab disk_size=$(parted /dev/${device} unit mb print | grep Disk | cut -d" " -f 3 | sed -e "s/MB//") -swap_size=$((disk_size*5/100)) +swap_size=$((disk_size*swap_ratio/100)) rootfs_size=$((disk_size-boot_size-swap_size)) rootfs_start=$((boot_size + 1))
Signature · 1 line
1.7.5.4
PATCH 2/5 init-install: Correct ext2->ext3 typo in logging
In reply to Darren HartWe create both the boot and root partitions as ext3 now, update the logging accordingly.
--- .../initrdscripts/files/init-install.sh | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
meta/recipes-core/initrdscripts/files/init-install.sh +1 -1
@@ -123,7 +123,7 @@ parted /dev/${device} mkpart primary $swap_start $disk_size parted /dev/${device} print -echo "Formatting $bootfs to ext2..." +echo "Formatting $bootfs to ext3..." mkfs.ext3 $bootfs echo "Formatting $rootfs to ext3..."
Signature · 1 line
1.7.5.4
PATCH 3/5 init-install: Clean up partition alignment
In reply to Darren HartThe current partitioning scheme leaves a 1MB gap between all the generated partitions by adding a 1 to the end of the last partition to use as the start of the next. parted is smart enough to not overlap start and end positions of the same value. This avoids the 1 MB gaps.
Rather than pad the disk with 1MB in the beginning and cut it off at the MB boundary on the end, we can use 0% and 100% to allow parted to do the required math and use as much of the disk as possible.
--- .../initrdscripts/files/init-install.sh | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
meta/recipes-core/initrdscripts/files/init-install.sh +4 -4
@@ -84,9 +84,9 @@ disk_size=$(parted /dev/${device} unit mb print | grep Disk | cut -d" " -f 3 | s swap_size=$((disk_size*swap_ratio/100)) rootfs_size=$((disk_size-boot_size-swap_size)) -rootfs_start=$((boot_size + 1)) +rootfs_start=$((boot_size)) rootfs_end=$((rootfs_start+rootfs_size)) -swap_start=$((rootfs_end+1)) +swap_start=$((rootfs_end)) # MMC devices are special in a couple of ways # 1) they use a partition prefix character 'p'
@@ -113,13 +113,13 @@ echo "Creating new partition table on /dev/${device} ..." parted /dev/${device} mklabel msdos echo "Creating boot partition on $bootfs" -parted /dev/${device} mkpart primary 1 $boot_size +parted /dev/${device} mkpart primary 0% $boot_size echo "Creating rootfs partition on $rootfs" parted /dev/${device} mkpart primary $rootfs_start $rootfs_end echo "Creating swap partition on $swap" -parted /dev/${device} mkpart primary $swap_start $disk_size +parted /dev/${device} mkpart primary $swap_start 100% parted /dev/${device} print
Signature · 1 line
1.7.5.4
PATCH 4/5 grub-efi: Do not use help2man
In reply to Darren HartFixes [YOCTO #2527]
Modify configure.ac and the generated configure script to avoid using help2man during the compilation process. For grub-efi we are only deploying the EFI payload and are not installing grub on the target root filesystem. Therefor, we do not need the man pages.
Cleanup the SRC_URI whitespace while we add a line to it.
grub-efi-native whitespace cleanup (INC)
--- .../grub/files/grub-1.99-disable-help2man.patch | 231 ++++++++++++++++++++ meta/recipes-bsp/grub/grub-efi-native_1.99.bb | 17 +- 2 files changed, 240 insertions(+), 8 deletions(-) create mode 100644 meta/recipes-bsp/grub/files/grub-1.99-disable-help2man.patch
meta/recipes-bsp/grub/files/grub-1.99-disable-help2man.patch new file +231 -0
@@ -0,0 +1,231 @@ +Upstream-Status: Inappropriate (Bitbake build environment) + +We do not need the man pages when building just the EFI payload for the target, +all the tools are built for the host. This does not trigger GRUB's built-in +cross-compilation check, so force it. After the change to configure.ac, +autogen.sh was run in devshell and the resulting configure was used to generate +the configure diff. The configure diff was included to avoid having to add +autogen.sh to a do_configure_prepend() routine which would slow down the build +unnecessarily. + +Signed-off-by: Darren Hart <[email protected]> + +Index: grub-1.99/configure.ac +=================================================================== +--- grub-1.99.orig/configure.ac ++++ grub-1.99/configure.ac +@@ -275,11 +275,12 @@ if test x$grub_cv_apple_cc = xyes ; then + HOST_CFLAGS="$HOST_CFLAGS -fnested-functions" + fi + +-if test "x$cross_compiling" = xyes; then +- AC_MSG_WARN([cannot generate manual pages while cross compiling]) +-else +- AC_PATH_PROG(HELP2MAN, help2man) +-fi ++# Force behaving as though we are cross-compiling with respect to HELP2MAN ++#if test "x$cross_compiling" = xyes; then ++AC_MSG_WARN([cannot generate manual pages while cross compiling]) ++#else ++# AC_PATH_PROG(HELP2MAN, help2man) ++#fi + + # Check for functions and headers. + AC_CHECK_FUNCS(posix_memalign memalign asprintf vasprintf getextmntent) +Index: grub-1.99/configure +=================================================================== +--- grub-1.99.orig/configure ++++ grub-1.99/configure +@@ -1172,7 +1172,6 @@ GL_COND_LIBTOOL_FALSE + GL_COND_LIBTOOL_TRUE + BUILD_CC + LIBUTIL +-HELP2MAN + POSUB + LTLIBINTL + LIBINTL +@@ -1204,6 +1203,7 @@ LEXLIB + am__fastdepCC_FALSE + am__fastdepCC_TRUE + CCDEPMODE ++am__nodep + AMDEPBACKSLASH + AMDEP_FALSE + AMDEP_TRUE +@@ -3011,7 +3011,6 @@ _ACEOF + # Let the site file select an alternate cache file if it wants to. + # Prefer an explicitly selected file to automatically selected ones. + ac_site_file1=NONE +-ac_site_file2=NONE + if test -n "$CONFIG_SITE"; then + # We do not want a PATH search for config.site. + case $CONFIG_SITE in #(( +@@ -3019,14 +3018,8 @@ if test -n "$CONFIG_SITE"; then + */*) ac_site_file1=$CONFIG_SITE;; + *) ac_site_file1=./$CONFIG_SITE;; + esac +-elif test "x$prefix" != xNONE; then +- ac_site_file1=$prefix/share/config.site +- ac_site_file2=$prefix/etc/config.site +-else +- ac_site_file1=$ac_default_prefix/share/config.site +- ac_site_file2=$ac_default_prefix/etc/config.site + fi +-for ac_site_file in "$ac_site_file1" "$ac_site_file2" ++for ac_site_file in $ac_site_file1 + do + test "x$ac_site_file" = xNONE && continue + if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then +@@ -3313,8 +3306,9 @@ case $target_os in *\ *) target_os=`echo + # The aliases save the names the user supplied, while $host etc. + # will get canonicalized. + test -n "$target_alias" && +- test "$program_prefix$program_suffix$program_transform_name" = \ +- NONENONEs,x,x, && ++ test "$target_alias" != "$host_alias" && ++ test "$program_prefix$program_suffix$program_transform_name" = \ ++ NONENONEs,x,x, && + program_prefix=${target_alias}- + + am__api_version='1.11' +@@ -3786,11 +3780,11 @@ MAKEINFO=${MAKEINFO-"${am_missing_run}ma + + # We need awk for the "check" target. The system "awk" is bad on + # some platforms. +-# Always define AMTAR for backward compatibility. +- +-AMTAR=${AMTAR-"${am_missing_run}tar"} ++# Always define AMTAR for backward compatibility. Yes, it's still used ++# in the wild :-( We should find a proper way to deprecate it ... ++AMTAR='$${TAR-tar}' + +-am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' ++am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' + + + +@@ -4256,6 +4250,7 @@ fi + if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' ++ am__nodep='_no' + fi + if test "x$enable_dependency_tracking" != xno; then + AMDEP_TRUE= +@@ -5069,6 +5064,7 @@ else + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. ++ rm -rf conftest.dir + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. +@@ -5128,7 +5124,7 @@ else + break + fi + ;; +- msvisualcpp | msvcmsys) ++ msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok `-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. +@@ -6044,6 +6040,7 @@ else + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. ++ rm -rf conftest.dir + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. +@@ -6103,7 +6100,7 @@ else + break + fi + ;; +- msvisualcpp | msvcmsys) ++ msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok `-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. +@@ -6848,6 +6845,7 @@ else + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. ++ rm -rf conftest.dir + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. +@@ -6905,7 +6903,7 @@ else + break + fi + ;; +- msvisualcpp | msvcmsys) ++ msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok `-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. +@@ -9529,51 +9527,13 @@ if test x$grub_cv_apple_cc = xyes ; then + HOST_CFLAGS="$HOST_CFLAGS -fnested-functions" + fi + +-if test "x$cross_compiling" = xyes; then +- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot generate manual pages while cross compiling" >&5 ++# Force behaving as though we are cross-compiling with respect to HELP2MAN ++#if test "x$cross_compiling" = xyes; then ++{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot generate manual pages while cross compiling" >&5 + $as_echo "$as_me: WARNING: cannot generate manual pages while cross compiling" >&2;} +-else +- # Extract the first word of "help2man", so it can be a program name with args. +-set dummy help2man; ac_word=$2 +-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +-$as_echo_n "checking for $ac_word... " >&6; } +-if ${ac_cv_path_HELP2MAN+:} false; then : +- $as_echo_n "(cached) " >&6 +-else +- case $HELP2MAN in +- [\\/]* | ?:[\\/]*) +- ac_cv_path_HELP2MAN="$HELP2MAN" # Let the user override the test with a path. +- ;; +- *) +- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +-for as_dir in $PATH +-do +- IFS=$as_save_IFS +- test -z "$as_dir" && as_dir=. +- for ac_exec_ext in '' $ac_executable_extensions; do +- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then +- ac_cv_path_HELP2MAN="$as_dir/$ac_word$ac_exec_ext" +- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 +- break 2 +- fi +-done +- done +-IFS=$as_save_IFS +- +- ;; +-esac +-fi +-HELP2MAN=$ac_cv_path_HELP2MAN +-if test -n "$HELP2MAN"; then +- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $HELP2MAN" >&5 +-$as_echo "$HELP2MAN" >&6; } +-else +- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +-$as_echo "no" >&6; } +-fi +- +- +-fi ++#else ++# AC_PATH_PROG(HELP2MAN, help2man) ++#fi + + # Check for functions and headers. + for ac_func in posix_memalign memalign asprintf vasprintf getextmntent +@@ -20309,6 +20269,7 @@ $as_echo_n "checking whether \`$CC' gene + cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ + ++void g (int); + void f (int (*p) (void)); + void g (int i) + {
meta/recipes-bsp/grub/grub-efi-native_1.99.bb +9 -8
@@ -16,20 +16,21 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504" # FIXME: We should be able to optionally drop freetype as a dependency DEPENDS = "help2man-native autogen-native" RDEPENDS_${PN} = "diffutils freetype" -PR = "r9" +PR = "r10" # Native packages do not normally rebuild when the target changes. # Ensure this is built once per HOST-TARGET pair. PN := "grub-efi-${TRANSLATED_TARGET_ARCH}-native" SRC_URI = "ftp://ftp.gnu.org/gnu/grub/grub-${PV}.tar.gz \ - file://grub-1.99_fix_for_automake_1.11.2.patch \ - file://grub-1.99-fpmath-sse-387-fix.patch \ - file://grub-1.99-gcc-4.7.0.patch \ - file://grub-1.99-gcc-4.7.0-uninitialized-var-errors.patch \ - file://grub-1.99-gcc-4.7.0-strict-aliasing-errors.patch \ - file://grub-1.99-fix-enable_execute_stack-check.patch \ - " + file://grub-1.99_fix_for_automake_1.11.2.patch \ + file://grub-1.99-fpmath-sse-387-fix.patch \ + file://grub-1.99-gcc-4.7.0.patch \ + file://grub-1.99-gcc-4.7.0-uninitialized-var-errors.patch \ + file://grub-1.99-gcc-4.7.0-strict-aliasing-errors.patch \ + file://grub-1.99-fix-enable_execute_stack-check.patch \ + file://grub-1.99-disable-help2man.patch \ + " SRC_URI[md5sum] = "ca9f2a2d571b57fc5c53212d1d22e2b5" SRC_URI[sha256sum] = "b91f420f2c51f6155e088e34ff99bea09cc1fb89585cf7c0179644e57abd28ff"
Signature · 1 line
1.7.5.4
PATCH 5/5 EFI: Make installer EFI aware
In reply to Darren Hart[YOCTO #1919]
Create a basic EFI installer script modeled after the existing installer and add it to a new initramfs-live-install-efi recipe. Update the init-live.sh script to distinguish between LABEL=install and LABEL=install-efi and select the appropriate script. Add the efi installer to core-image-minimal-initramfs.
Update grub-efi.bbclass to use "LABEL=install-efi" when it detects a label of "install". This is clearly not ideal, but a proper fix would involve decoupling the LABELS assignment from the image-live.bbclass usage of SYSLINUX_LABELS. We should be able to address that in a follow-on clean-up series.
--- meta/classes/grub-efi.bbclass | 2 + .../images/core-image-minimal-initramfs.bb | 2 +- .../initrdscripts/files/init-install-efi.sh | 188 ++++++++++++++++++++ meta/recipes-core/initrdscripts/files/init-live.sh | 6 +- 4 files changed, 194 insertions(+), 4 deletions(-) create mode 100644 meta/recipes-core/initrdscripts/files/init-install-efi.sh
meta/classes/grub-efi.bbclass +2 -0
@@ -99,6 +99,8 @@ python build_grub_cfg() { bb.data.update_data(localdata) cfgfile.write('\nmenuentry \'%s\'{\n' % (label)) + if label == "install": + label = "install-efi" cfgfile.write('linux /vmlinuz LABEL=%s' % (label)) append = localdata.getVar('APPEND', True)
meta/recipes-core/images/core-image-minimal-initramfs.bb +1 -1
@@ -3,7 +3,7 @@ DESCRIPTION = "Small image capable of booting a device. The kernel includes \ the Minimal RAM-based Initial Root Filesystem (initramfs), which finds the \ first “init” program more efficiently." -IMAGE_INSTALL = "initramfs-live-boot initramfs-live-install busybox udev base-passwd" +IMAGE_INSTALL = "initramfs-live-boot initramfs-live-install initramfs-live-install-efi busybox udev base-passwd" # Do not pollute the initrd image with rootfs features IMAGE_FEATURES = ""
meta/recipes-core/initrdscripts/files/init-install-efi.sh new file +188 -0
188 lines not on this page · raw message
meta/recipes-core/initrdscripts/files/init-live.sh +3 -3
@@ -110,11 +110,11 @@ case $label in fi fi ;; - install) + install|install-efi) if [ -f /media/$i/$ISOLINUX/$ROOT_IMAGE ] ; then - ./install.sh $i/$ISOLINUX $ROOT_IMAGE $video_mode $vga_mode + ./$label.sh $i/$ISOLINUX $ROOT_IMAGE $video_mode $vga_mode else - fatal "Could not find install script" + fatal "Could not find $label script" fi # If we're getting here, we failed...
Signature · 1 line
1.7.5.4
Re: [PATCH 5/5] EFI: Make installer EFI aware
Quoted 41 lines · Darren Hart
[YOCTO #1919]
Create a basic EFI installer script modeled after the existing installer and add it to a new initramfs-live-install-efi recipe. Update the
init-live.shscript to distinguish between LABEL=install and LABEL=install-efi and select the appropriate script. Add the efi installer to core-image-minimal-initramfs.Update grub-efi.bbclass to use "LABEL=install-efi" when it detects a label of "install". This is clearly not ideal, but a proper fix would involve decoupling the LABELS assignment from the image-live.bbclass usage of
SYSLINUX_LABELS. We should be able to address that in a follow-on clean-up series.Signed-off-by Darren Hart <[email protected]>--- meta/classes/grub-efi.bbclass | 2 + .../images/core-image-minimal-initramfs.bb | 2 +- .../initrdscripts/files/init-install-efi.sh | 188 ++++++++++++++++++++ meta/recipes-core/initrdscripts/files/init-live.sh | 6 +- 4 files changed, 194 insertions(+), 4 deletions(-)create mode 100644
meta/recipes-core/initrdscripts/files/init-install-efi.shmeta/classes/grub-efi.bbclass +2
-0@@ -99,6 +99,8 @@ python build_grub_cfg() { bb.data.update_data(localdata) cfgfile.write('\nmenuentry \'%s\'{\n' % (label)) + if label == "install": + label = "install-efi" cfgfile.write('linux /vmlinuz LABEL=%s' % (label)) append = localdata.getVar('APPEND', True)meta/recipes-core/images/core-image-minimal-initramfs.bb +0
-0
meta/recipes-core/images/core-image-minimal-initramfs.bb DESCRIPTION = "Small image capable of booting a device. The kernel includes \ · line 6
Quoted 5 lines
meta/recipes-core/images/core-image-minimal-initramfs.bb +1
-1@@ -3,7 +3,7 @@ DESCRIPTION = "Small image capable of booting a device. The kernel includes \ the Minimal RAM-based Initial Root Filesystem (initramfs), which finds the \ first “init” program more efficiently." -IMAGE_INSTALL = "initramfs-live-boot initramfs-live-install busybox udev base-passwd" +IMAGE_INSTALL = "initramfs-live-boot initramfs-live-install initramfs-live-install-efi busybox udev base-passwd"
What provides the initramfs-live-install-efi?
I don't see it anywhere and I am getting the following ERROR on build:
Quoted 5 lines
meta/recipes-core/images/core-image-minimal-initramfs.bb +0
-0ERROR: Nothing RPROVIDES 'initramfs-live-install-efi' (but /intel/poky/distro/meta/recipes-core/images/core-image-minimal-initramfs.bb RDEPENDS on or otherwise requires it)NOTE: Runtime target 'initramfs-live-install-efi' is unbuildable, removing...
Missing or unbuildable dependency chain was: ['initramfs-live-install-efi']
ERROR: Required build target 'core-image-minimal' has no buildable providers.
Missing or unbuildable dependency chain was: ['core-image-minimal', 'core-image-minimal-initramfs', 'initramfs-live-install-efi']
Sau!
Quoted 217 lines
# Do not pollute the initrd image with rootfs features
IMAGE_FEATURES= ""meta/recipes-core/initrdscripts/files/init-install-efi.sh new file +188
-0@@ -0,0 +1,188 @@ +#!/bin/sh -e +# +# Copyright (c) 2012, Intel Corporation. +# All rights reserved. +# +# install.sh [device_name] [rootfs_name] [video_mode] [vga_mode] +# + +PATH=/sbin:/bin:/usr/sbin:/usr/bin + +# We need 20 Mb for the boot partition +boot_size=20 + +# 5% for the swap +swap_ratio=5 + +found="no" + +echo "Searching for a hard drive..." +for device in 'hda' 'hdb' 'sda' 'sdb' 'mmcblk0' 'mmcblk1' +do + if [ -e /sys/block/${device}/removable ]; then + if [ "$(cat /sys/block/${device}/removable)" = "0" ]; then + found="yes" + + while true; do + # Try sleeping here to avoid getting kernel messages + # obscuring/confusing user + sleep 5 + echo "Found drive at /dev/${device}. Do you want to install this image there ? [y/n]" + read answer + if [ "$answer" = "y" ] ; then + break + fi + + if [ "$answer" = "n" ] ; then + found=no + break + fi + + echo "Please answer y or n" + done + fi + fi + + if [ "$found" = "yes" ]; then + break; + fi + +done + +if [ "$found" = "no" ]; then + exit 1 +fi + +echo "Installing image on /dev/${device}" + +# +# The udev automounter can cause pain here, kill it +# +rm -f /etc/udev/scripts/mount* + +# +# Unmount anything the automounter had mounted +# +umount /dev/${device}* 2> /dev/null || /bin/true + +# We always build with devtmpfs, this is not necessary +#if [ ! -b /dev/sda ] ; then +# mknod /dev/sda b 8 0 +#fi +# +#if [ ! -b /dev/sdb ] ; then +# mknod /dev/sdb b 8 16 +#fi +# +#if [ ! -b /dev/loop0 ] ; then +# mknod /dev/loop0 b 7 0 +#fi + +mkdir -p /tmp +cat /proc/mounts > /etc/mtab + +disk_size=$(parted /dev/${device} unit mb print | grep Disk | cut -d" " -f 3 | sed -e "s/MB//") + +swap_size=$((disk_size*swap_ratio/100)) +rootfs_size=$((disk_size-boot_size-swap_size)) + +rootfs_start=$((boot_size)) +rootfs_end=$((rootfs_start+rootfs_size)) +swap_start=$((rootfs_end)) + +# MMC devices are special in a couple of ways +# 1) they use a partition prefix character 'p' +# 2) they are detected asynchronously (need rootwait) +rootwait="" +part_prefix="" +if [ ! "${device#mmcblk}" = "${device}" ]; then + part_prefix="p" + rootwait="rootwait" +fi +bootfs=/dev/${device}${part_prefix}1 +rootfs=/dev/${device}${part_prefix}2 +swap=/dev/${device}${part_prefix}3 + +echo "*****************" +echo "Boot partition size: $boot_size MB ($bootfs)" +echo "Rootfs partition size: $rootfs_size MB ($rootfs)" +echo "Swap partition size: $swap_size MB ($swap)" +echo "*****************" +echo "Deleting partition table on /dev/${device} ..." +dd if=/dev/zero of=/dev/${device} bs=512 count=2 + +echo "Creating new partition table on /dev/${device} ..." +parted /dev/${device} mklabel gpt + +echo "Creating boot partition on $bootfs" +parted /dev/${device} mkpart primary 0% $boot_size + +echo "Creating rootfs partition on $rootfs" +parted /dev/${device} mkpart primary $rootfs_start $rootfs_end + +echo "Creating swap partition on $swap" +parted /dev/${device} mkpart primary $swap_start 100% + +parted /dev/${device} print + +echo "Formatting $bootfs to vfat..." +mkfs.vfat $bootfs + +echo "Formatting $rootfs to ext3..." +mkfs.ext3 $rootfs + +echo "Formatting swap partition...($swap)" +mkswap $swap + +mkdir /ssd +mkdir /rootmnt +mkdir /bootmnt + +mount $rootfs /ssd +mount -o rw,loop,noatime,nodiratime /media/$1/$2 /rootmnt + +echo "Copying rootfs files..." +cp -a /rootmnt/* /ssd + +if [ -d /ssd/etc/ ] ; then + echo "$swap swap swap defaults 0 0" >> /ssd/etc/fstab + + # We dont want udev to mount our root device while we're booting... + if [ -d /ssd/etc/udev/ ] ; then + echo "/dev/${device}" >> /ssd/etc/udev/mount.blacklist + fi +fi + +umount /ssd +umount /rootmnt + +echo "Preparing boot partition..." +mount $bootfs /ssd + +EFIDIR="/ssd/EFI/BOOT" +mkdir -p $EFIDIR +GRUBCFG="$EFIDIR/grub.cfg" + +cp /media/$1/vmlinuz /ssd +# Copy the efi loader and config (booti*.efi and grub.cfg) +cp /media/$1/EFI/BOOT/* $EFIDIR + +# Update grub config for the installed image +# Delete the install entry +sed -i "/menuentry 'install'/,/^}/d" $GRUBCFG +# Delete the initrd lines +sed -i "/initrd /d" $GRUBCFG +# Delete any LABEL= strings +sed -i "s/ LABEL=[^ ]*/ /" $GRUBCFG +# Replace the ramdisk root with the install device and include other options +sed -i "s@ root=[^ ]*@ root=$rootfs rw $rootwait quiet@" $GRUBCFG + +umount /ssd +sync + +echo "Remove your installation media, and press ENTER" + +read enter + +echo "Rebooting..." +reboot -fmeta/recipes-core/initrdscripts/files/init-live.sh +3
-3@@ -110,11 +110,11 @@ case $label in fi fi ;; - install) + install|install-efi) if [ -f /media/$i/$ISOLINUX/$ROOT_IMAGE ] ; then - ./install.sh $i/$ISOLINUX $ROOT_IMAGE $video_mode $vga_mode + ./$label.sh $i/$ISOLINUX $ROOT_IMAGE $video_mode $vga_mode else - fatal "Could not find install script" + fatal "Could not find $label script" fi # If we're getting here, we failed...
Quoted 15 lines · Darren Hart
Cleanup the existing installer a bit.
Fix the grub-efi-native help2man build issue.
Add EFI support to the installer.I have tested both PCBIOS install as well as EFI install from a live USB key to the internal MMC device on the FRI2 BSP.
The following changes since commit
a6b6df1350149c116050cb93c3c7b4802c709d31:task-core-tools-debug: Added openssh-sftp-server. (2012-07-03 14:52:38 +0100)are available in the git repository at:
git://git.yoctoproject.org/user-contrib/dvhart/oe-coreinstaller
http://git.yoctoproject.org/cgit.cgi/user-contrib/dvhart/oe-core/log/?h=installer
Quoted 5 lines
Darren Hart (5):
init-install: Useswap_ratioin the calulation ofswap_size
init-install: Correctext2->ext3typo in logging
init-install: Clean up partition alignment
grub-efi: Do not use help2man
Merged the above set into OE-Core
Quoted 1 line
EFI: Make installer EFI aware
As noted, this is missing some bits that define: initramfs-live-install-efi
Sau!
Quoted 12 lines
meta/classes/grub-efi.bbclass | 2 + .../grub/files/grub-1.99-disable-help2man.patch | 231 ++++++++++++++++++++ meta/recipes-bsp/grub/grub-efi-native_1.99.bb | 17 +- .../images/core-image-minimal-initramfs.bb | 2 +- .../initrdscripts/files/init-install-efi.sh | 188 ++++++++++++++++ .../initrdscripts/files/init-install.sh | 12 +- meta/recipes-core/initrdscripts/files/init-live.sh | 6 +- 7 files changed, 440 insertions(+), 18 deletions(-)create mode 100644
meta/recipes-bsp/grub/files/grub-1.99-disable-help2man.patchcreate mode 100644meta/recipes-core/initrdscripts/files/init-install-efi.sh