Commit Graph

137 Commits

Author SHA1 Message Date
Alejandro Hernandez 2dce2648e3 gummiboot: Remove/change gummiboot references with systemd-boot
After systemd-boot was introduced, its been tested for a while with no major
issues being found until now, this patch completely replaces all gummiboot
instances with systemd-boot ones, taking the next step into cleaning
up systemd-boot/gummiboot.

[YOCTO #10332]

(From OE-Core rev: f9a61d3400ad9068a6d83b8eb6aefe3098c58e68)

Signed-off-by: Alejandro Hernandez <alejandro.hernandez@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-01-09 13:39:11 +00:00
Joe Konno 85c9b9f9c6 initrdscripts: add support for NVME target install
Add awareness of /dev/nvme* block devices to install scripts. As presently
written, installer knows only of /dev/sd* and /dev/mmcblk* block devices.
Building upon scaffolding put in place by Awais in...

    80ec9f627915 ("initrdscripts: handle mmc device as installer medium")

(From OE-Core rev: b5a036ce958e3fe24690531712071abc14b48033)

Signed-off-by: Joe Konno <joe.konno@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-11-15 15:19:54 +00:00
Alejandro Hernandez 087c580b28 init-install: Fixes the install script failing when not finding any mmcblk devices
The init-install.sh and init-install-efi.sh scripts perform a check
to see which devices are available on a booted system for installation.

Recently, the way we check for these devices changed on 993bfb,
greping for devices found on /sys/block/, this change caused the installer
to fail (at least) when not finding any mmcblk devices, due to the fact
that we call sh -e to execute this script, so any command (grep)
or pipeline exiting with a non-zero status causes the whole script to exit

This patch throws in a harmless true exit status at the end of the pipeline(s)
of the grep commands to avoid the installer script from exiting, fixing the issue.

[YOCTO #10189]

(From OE-Core rev: 384cf92ca9c3e66763c2c1ff2776c53d47ae25d6)

Signed-off-by: Alejandro Hernandez <alejandro.hernandez@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-08-30 07:57:50 +01:00
Awais Belal 92f505b016 init-install*: /etc/mtab make a link rather than a copy
Using a copy would only make management of devices erroneous
and makes the system unstable in some scenarios as tools will
have to manipulate both files separately. A link ensures that
both files /proc/mounts and /etc/mtab will have the same
information at all times and this is how it is handled
on newer systems where there is such a need. Same is
suggested by busybox.

(From OE-Core rev: 9f9240d175acee274c04242fd5781094b3f5491b)

Signed-off-by: Awais Belal <awais_belal@mentor.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-08-17 10:35:41 +01:00
Awais Belal 993bfb55c7 init-install*: only pick root mmc devices
Some eMMC devices show special sub-devices such as mmcblk0boot0
etc. The installation script currently pick all of them up and
displays it to the user which makes some confusions because these
sub-devices are pretty small and complete installation including
rootfs won't be possible in most cases.
We simply now drop these sub-devices and only present the user
with the root of such mmc devices.

(From OE-Core rev: 4b4d80306de8d8a2e3a2d784890f34e4a0ecfcf0)

Signed-off-by: Awais Belal <awais_belal@mentor.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-08-17 10:35:40 +01:00
California Sullivan df6694b7c8 initrdscripts/init-install*: Add rootwait when installing to USB devices
It can take a bit for USB devices to be detected, so if a USB device is
your rootfs and you don't set rootwait you will most likely get a kernel
panic. Fix this by adding rootwait to the kernel command line on
installation.

Fixes [YOCTO #9462].

(From OE-Core rev: 40e2d36573a7a6bce377b1f9653607065ba5ffb6)

Signed-off-by: California Sullivan <california.l.sullivan@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-08-17 10:35:39 +01:00
Alejandro Hernandez 4f9ddb6e90 initramfs-live-boot: Make sure we kill udev before switching root when live booting
When live booting, we need to make sure the running udev processes are killed
to avoid unexepected behavior, we do this just before switching root,
once we do, a new udev process will be spawned from init and will take care
of whatever work was still missing

[YOCTO #9520]

(From OE-Core rev: e88d9e56952414e6214804f9b450c7106d04318d)

Signed-off-by: Alejandro Hernandez <alejandro.hernandez@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-08-17 10:35:38 +01:00
California Sullivan 031c2f6ced initrdscripts/init-install*: Select install target instead of looping through
Its not immediately apparent that more than one install target could be
available. With this change we list the available devices up front then
prompt the user for which one to use, reducing confusion.

Fixes [YOCTO #9919].

(From OE-Core rev: e68774f684543fd75250e56ea88a5e0cb0a2dd0a)

Signed-off-by: California Sullivan <california.l.sullivan@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-07-21 07:47:52 +01:00
Patrick Ohly 15ba3c1a96 initramfs-framework: make rootfs module optional
It still gets installed by default via RRECOMMENDS without having to update
users of the framework (because without it, the framework is incomplete),
but that recommendation can be overridden on a per-image basis.

(From OE-Core rev: 73bfaa0e57a3b6c8779ba716c1e38fcbee734947)

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-07-20 10:28:47 +01:00
Igor Stoppa d6a43d222d initramfs-framework: Add support for PartUUIDs
The rootfs can be addressed also by referring to the PartUUID
value from the GPT.
This patch enables such type of reference.

(From OE-Core rev: 1ab2ca141d3defe4b80212e28ac7c3f2271e2515)

Signed-off-by: Igor Stoppa <igor.stoppa@intel.com>
Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-07-08 09:57:26 +01:00
Patrick Ohly ee6a6c3461 initramfs-framework: add retry loop for slow boot devices (like USB)
On some hardware platforms (Gigabyte, qemu), detection of USB devices
by the kernel is slow enough such that it happens only after the first
attempt to mount the rootfs. We need to keep trying for a while
(default: 5s seconds, controlled by roottimeout=<seconds>) and sleep
between each attempt (default: one second, rootdelay=<seconds>).

This change intentionally splits finding the rootfs (in the new
"rootfs") and switching to it ("finish"). That is needed to keep udev
running while waiting for the rootfs, because it shuts down before
"finish" starts. It is also the direction that was discussed on the OE
mailing list for future changes to initramfs-framework (like
supporting a "live CD" module, which would replace or further augment
mounting of the rootfs).

(From OE-Core rev: 2a50bb9ee8838e3d026c82dc09aaccb880a264f4)

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-07-08 09:57:26 +01:00
Otavio Salvador 2f9b8e9134 initramfs-framework: base: Ensures /run/lock is available
Depending on the module we use, the /run/lock may be required. This
creates it as part of initial setup and thus makes it available for
every sub module.

(From OE-Core rev: 1cf288a0514ae9365fe55a0ff90b5abe35042cef)

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-06-23 14:26:16 +01:00
Otavio Salvador 9623b237ce initramfs-framework: mdev: Add a runtime dependency on busybox-mdev
The mdev support relies on the mdev support inside busybox, which thus
builds the busybox-mdev package. Adding the runtime dependency ensures
its installation fails if mdev support is disabled.

(From OE-Core rev: 48dbdc0317db6836cfeba083844910c15d5beb77)

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-06-23 14:26:16 +01:00
Robert Yang 1f2a01b02e init-install-efi.sh: remove all root=foo from grub.cfg
There might be more than one root=/dev/foo in the config file which
would cause unepected errros on the installed target, so remove all of
them.

[YOCTO #9354]

(From OE-Core rev: ca402bc3bc4e9a5c3e19a6ca504017335212b2c9)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-04-03 15:51:35 +01:00
Robert Yang 3ce7d8cdc8 init-install.sh: fix disk_size
It mis-matched "SanDisk" or "Disk Flags" before, which caused unexpected
error.

(From OE-Core rev: a68ac76c1b6ed4c1a2fbc944c5021c89fd26217f)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-04-03 15:51:35 +01:00
Robert Yang f1f9f891a4 init-live.sh: fix overlay fs
* The name changes from overlayfs to overlayo
* The workdir is a must when mount
* The updir must be a subdir of rootfs.rw

This patch plus with another one which has been sent to linux-yocto can
fix the error when boot iso:
EXT4-fs (loop0): re-mounted. Opts: data=ordered
Populating dev cache
/etc/init.d/rc: /etc/rcS.d/S37populate-volatile.sh: line 1: can't create
/etc/volatile.cache.build: Read-only file system
/etc/rcS.d/S36udev-cache: line 73: can't create /etc/udev-cache.tar.gz:
Read-only file system
udev-cache: update failed!
rm: can't remove '/etc/udev/cache.data': Read-only file system
/etc/init.d/rc: /etc/rcS.d/S37populate-volatile.sh: line 1: can't create
/etc/volatile.cache.build: Read-only file system
/etc/init.d/rc: /etc/rcS.d/S37populate-volatile.sh: line 1: can't create
/etc/volatile.cache.build: Read-only file system
/etc/init.d/rc: /etc/rcS.d/S37populate-volatile.sh: line 1: can't create
/etc/volatile.cache.build: Read-only file system
/etc/init.d/rc: /etc/rcS.d/S37populate-volatile.sh: line 1: can't create
/etc/volatile.cache.build: Read-only file system
/etc/init.d/rc: /etc/rcS.d/S37populate-volatile.sh: line 1: can't create
/etc/volatile.cache.build: Read-only file system
/etc/init.d/rc: /etc/rcS.d/S37populate-volatile.sh: line 1: can't create
/etc/volatile.cache.build: Read-only file system
/etc/init.d/rc: /etc/rcS.d/S37populate-volatile.sh: line 1: can't create
/etc/volatile.cache.build: Read-only file system
/etc/init.d/rc: /etc/rcS.d/S37populate-volatile.sh: line 1: can't create
/etc/volatile.cache.build: Read-only file system
rm: can't remove '/tmp': Read-only file system
ln: /tmp/tmp: Read-only file system
/etc/init.d/rc: /etc/rcS.d/S37populate-volatile.sh: line 1: can't create
/etc/volatile.cache.build: Read-only file system
/etc/init.d/rc: /etc/rcS.d/S37populate-volatile.sh: line 1: can't create
/etc/volatile.cache.build: Read-only file system
/etc/init.d/rc: /etc/rcS.d/S37populate-volatile.sh: line 1: can't create
/etc/volatile.cache.build: Read-only file system
ln: /etc/resolv.conf: Read-only file system
/etc/init.d/rc: /etc/rcS.d/S37populate-volatile.sh: line 1: can't create
/etc/volatile.cache.build: Read-only file system
/etc/init.d/rc: /etc/rcS.d/S37populate-volatile.sh: line 1: can't create
/etc/volatile.cache.build: Read-only file system

(From OE-Core rev: ba918e0e36418ec6e14aef537ff4fdf45af6d8d4)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-03-29 23:20:12 +01:00
Robert Yang 4e7eaed2c0 init-live.sh: fix ROOT_MOUNT
The '/' in the end is not needed, which caused '//' in the path.

(From OE-Core rev: 6b0fc87ced857763ae7e9d1012fb9f5c952c2cc8)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-03-29 23:20:12 +01:00
Jérémy Rosen 21916234dd init-live : make it easier to add custom boot targets
When booting from the live image, the label from the bootloader is passed
to init.sh. init.sh uses the label to either boot a live image or call a
script to take over and install the system.

It is possible to add new labels to the bootloader via the LABELS family of
variables, but the names in init.sh were hardcoded to install and
install-efi

this patch checks if a shell script with the same name as the label is
available instead of using a hardcoded list. Any recipe can add such file
and this provide a new boot target to the live image

(From OE-Core rev: 2c10ca0fe612818cb43931b969ad2af5502f1e84)

Signed-off-by: Jérémy Rosen <jeremy.rosen@openwide.fr>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-03-20 23:12:27 +00:00
Urs Fässler 7edea7c0a4 initrdscripts: fix mmc device as install target
Installing from USB to an internal SD Card did not work with Linux 4.4 in Yocto jethro. With this patch, consistent names are used for the paritions.

(From OE-Core rev: 00a45d2e50c4f044ee4099940dd7d13ca44f7187)

Signed-off-by: Urs Fässler <urs.fassler@bbv.ch>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-02-11 12:27:47 +00:00
Alejandro Joya cc7bb6c9dd initramfs-framework_1.0:replace busybox for variable.
It replaces the use of busybox as hardcoded dependency to more dynamic
this wouldn't affect the way that the initrams is build, just it let a more
flexible replacement in the core.

(From OE-Core rev: f0f7062e9aa5e7708fc92cac2afb1aa85eb3d4ef)

Signed-off-by: Alejandro Joya <alejandro.joya.cruz@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-01-06 15:27:33 +00:00
Wills Wang 7a775a1c46 initramfs-framework: create directory /var/run
The following error occurs when udevd startup:
udevd[146]: bind failed: No such file or directory
error binding udev control socket
udevd[146]: error binding udev control socket

(From OE-Core rev: 4db089f10a379bc9a4df287bd657153eb4b94c45)

Signed-off-by: Wills Wang <wills.wang@live.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-12-08 10:20:53 +00:00
Ng, Mei Yeen 1781a9afc6 init-install-efi: fix script for eMMC installation
Running the install option from bootloader to install image to eMMC will fail
with error:
Formatting /dev/mmcblk01 to vfat...
mkfs.fat 3.0.28 (2015-05-16)
/dev/mmcblk01: No such file or directory

This issue impacts both grub and gummiboot install option to eMMC device.
The installation failure is due to the following:
[1] Unable to partition eMMC as the partition prefix 'p' is not appended
The condition checking failed with the additional /dev/ appended with
the target device name.
[2] The partition uuid for boot, root and swap partition is not captured
for eMMC

This fix updated the condition checking and changed the variables to
reference the boot, root and swap partitions for UUID.

[YOCTO #8710]
(From OE-Core rev: a7d081c3db776c8b0734942df6bf96f811f15bd3)

Signed-off-by: Ng, Mei Yeen <mei.yeen.ng@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-12-01 21:32:14 +00:00
Ng, Mei Yeen f8087475de init-install-efi: fix script for gummiboot loader
After running gummiboot loader install option, the installed target
storage device boot parameter for root=PARTUUID is empty causing boot failure.
This issue is only observed with gummiboot and not with GRUB loader.

This fix assign the rootuuid of the rootfs partition for gummiboot loader.

[YOCTO #8709]
(From OE-Core rev: fd5fa06fe45ca1fdf20df4198ae323967244af5b)

Signed-off-by: Ng, Mei Yeen <mei.yeen.ng@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-12-01 21:32:14 +00:00
Patrick Ohly d6e40e80d1 initramfs-framework: better error reporting for invalid root boot parameter
When the "boot" parameter refers to a non-existent device, the only
visible output at normal log levels was a rather confusing:
   ERROR: There's no '/dev' on rootfs.

That's because the actual error, not being able to find the root
device, was only a debug message, which gets ignored in the default
mode.

Promoting the "root '$bootparam_root' doesn't exist." message from
"debug" to "msg" gives sufficient context to understand the error. A
more intrusive change would be to change also the control flow.

(From OE-Core rev: 71d7803e5b13e26fd8001e87cfbac68114ddaa30)

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-09-23 09:52:59 +01:00
Patrick Ohly 288a9ffcf2 initramfs-framework: fix "support dropping into shell on failure"
Due to a missing $ before the variable name, all fatal errors ended up
invoking a shell, instead of only doing that when init_fatal_sh is set
as boot parameter.

(From OE-Core rev: 2a4335eae4b31ea9451a665dad2ba33ae4967670)

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-09-23 09:52:58 +01:00
Leonardo Sandoval 5acf99d1af init-install-efi.sh: Avoid /mnt/mtab creation if already present
The base-files recipe installs /mnt/mtab (it is a softlink of /proc/mounts),
so if an image includes the latter, there is no new to created it again inside
the install-efi.sh script, otherwise an error may occur as indicated on the
bug's site.

[YOCTO #7971]

(From OE-Core rev: 6c6c6528954952e1e323f5a26afd93b99913e6f2)

Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-09-18 09:05:21 +01:00
Patrick Ohly 08ec92a04e initramfs-framework: support dropping into shell on failure
When the init_fatal_sh boot parameter is present (i.e. used without
value) and a fatal problem occurs inside the initramfs-module, a shell
will be started instead of looping forever.

Useful for debugging.

Interestingly enough, the code was already indented to support such an
if check...

(From OE-Core rev: 1d3dc681e809846dba7cae4f81566045a3f8c205)

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-09-12 22:48:43 +01:00
Patrick Ohly 04f4ef9766 initramfs-framework: support init boot parameter
It can be useful for debugging to override the default /sbin/init.
This is something typically done via the init boot parameter which
then gets interpreted by the kernel. But when using an initramfs, it
is the initramfs which must react to the option.

(From OE-Core rev: dfd6d4c765924f472ac2df724342547b5c15249a)

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-09-12 22:48:43 +01:00
Patrick Ohly 77524d791b initramfs-framework: support ro boot parameter
Default is to mount the rootfs read/write. "ro" can be used to turn
that into read-only, which is useful on systems where userspace does
an fsck before remounting read-write.

Giving both "ro" and "rw" will still mount read-only regardless of the
order, because the ordering information is not preserved by the
initramfs-framework's boot param support.

(From OE-Core rev: a09f10f9360862c16fb68972ac041d474d6e3a64)

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-09-12 22:48:42 +01:00
Patrick Ohly d7508fee30 initramfs-framework: support rootflags and rootfstype boot parameter
These two parameters are supported by the kernel
(https://www.kernel.org/doc/Documentation/kernel-parameters.txt). When
an initramfs is used, the kernel does not mount the rootfs and the
initramfs needs to react to them.

The boot parameters can be set both by the image creator and
by users.

Supporting these two parameters is useful:
- rootflags is needed to ensure that the rootfs is already mounted as
  intended in the time between starting init and init remounting
  it (as systemd does); this is critical for IMA where iversion must be
  active already when system starts writing files.
- setting it correctly up-front avoids messages from the kernel ("cannot
  mount ... as ext2 because ...") when trying to guess the desired type.

For example, assuming that only one of ext4/ext3/ext2 is set,
rootfstype could be set in an image recipe with:
APPEND_append = "${@''.join([' rootfstype=' + i for i in ['ext4', 'ext3', 'ext2'] if i in d.getVar('IMAGE_FSTYPES', True).split()])}"

(From OE-Core rev: b8ea1c61b4b8071edf70f5d42119c54ea84de330)

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-09-12 22:48:42 +01:00
Patrick Ohly 82dd3fb27e initramfs-framework: handle kernel parameters with . inside
Kernel parameters like "uvesafb.mode_option=640x480-32" were turned
into shell variables named "bootparam_uvesafb.mode_option", which
triggered errors from the shell because the name is not valid. Now
points get replaced with underscores, leading to
bootparam_uvesafb_mode_option in this example.

(From OE-Core rev: de81e804f0654092d20ccb8e6e40f4ff614c4b09)

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-09-06 15:26:24 +01:00
Patrick Ohly 8582791683 initramfs-live-boot: create /dev/console
Some kernels, for example linux-yocto 3.19 for qemux86, fail to
execute /init in an initramfs unless there is already a /dev/console
char device in the initramfs. Booting then fails with:
    Kernel panic - not syncing: /dev/console is missing or not a character device!
    Please ensure your rootfs is properly configured

The panic itself comes from a linux-yocto specific patch to
kernel_init_freeable in init/main.c, but even without it, that
function will print an error when /dev/console is missing. The
kernel's Documentation/initrd.txt also mentions creating that device.

It remained unclear why this is not a problem on other machines. On
intel-corei7-64 from meta-intel, something (the kernel?) creates
/dev/console and /dev/[012] before transfering control to the init
script. In that case, creating /dev/console in advance is not
necessary, but does not cause any problem either.

(From OE-Core rev: 1b64664f0c388f41084f5db6e46e3e68c53fb6d9)

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-09-06 15:26:24 +01:00
Patrick Ohly cc9ff1a86a initramfs-framework: create /dev/console
Some kernels, for example linux-yocto 3.19 for qemux86, fail to
execute /init in an initramfs unless there is already a /dev/console
char device in the initramfs. Booting then fails with:
    Kernel panic - not syncing: /dev/console is missing or not a character device!
    Please ensure your rootfs is properly configured

The panic itself comes from a linux-yocto specific patch to
kernel_init_freeable in init/main.c, but even without it, that
function will print an error when /dev/console is missing. The
kernel's Documentation/initrd.txt also mentions creating that device.

It remained unclear why this is not a problem on other machines. On
intel-corei7-64 from meta-intel, something (the kernel?) creates
/dev/console and /dev/[012] before transfering control to the init
script. In that case, creating /dev/console in advance is not
necessary, but does not cause any problem either.

(From OE-Core rev: 0352841cd92f6316bcac092e2fff9d28c352b36b)

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-09-06 15:26:24 +01:00
Leonardo Sandoval 445c49ce50 init-install-efi.sh: Check if an installation device is present
In case there is no installation device present, give a better
message to the user and abort installation.

[YOCTO #7971]

(From OE-Core rev: f1596b7169146afcb38db683eb6170a480422d73)

Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-08-01 22:24:07 +01:00
Awais Belal 525ba4ce29 initrdscripts: handle mmc device as installer medium
Platforms which have the capability of using the MMC as an
installer medium will present the same MMC device as an
installation candidate. This happens because the MMC
devices appear as mmcblk<X> and the current script strips
up the <X> which is needed to identify an MMC device
uniqely.
This patch now updates the way device identifier stripping
is done and handles the exclusion of installer device from
installation candidates more generically.

(From OE-Core rev: 80ec9f62791575de4948d7635dc6674abfac2193)

Signed-off-by: Awais Belal <awais_belal@mentor.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-07-16 15:09:19 +01:00
Ed Bartosh 2173a0ec28 init-install: Properly delete partition table
Fixed deletion of the partition table by increasing
amount of sectors from 2(correct for msdos PT) to 35 as
GPT size is 34 sectors + 1 sector for protective MBR.

(From OE-Core rev: 9be59c02901a6c9ecaaa293aea2e938edf9b122c)

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-06-23 11:47:29 +01:00
Ed Bartosh 68d8f6d2e4 init-install: code cleanup: replace /dev/$device -> $device
Shortened code by including /dev/ prefix into variable.

(From OE-Core rev: f2fe5735a2d2c5a5cbadd3486aa24a4931655526)

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-06-23 11:47:28 +01:00
Ed Bartosh 99a7c5b50d init-install: code cleanup: Replace tabs with spaces
Cleaned up spaces from init-install* shell scripts.

(From OE-Core rev: 2cc5492a7e196adaab8bc35b48299c9e4d229ebc)

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-06-23 11:47:28 +01:00
Ed Bartosh a10c4481f1 init-install: Specify partition name in parted command line
parted allows to use names for partitions if GPT partition table
is used on the device. msdos partitioning can have only partition
types: 'primary', 'logical' or 'extended'.

Used meaningful partition names in parted command line for GPT
partitioning.

(From OE-Core rev: ef2c6df7fcfd02ed45637f2e6b48f324d7a56b88)

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-06-23 11:47:27 +01:00
Ed Bartosh 891cdacb62 init-install: Specify filesystem type in parted command line
Explicitly specified filesystem type for parted mkpart command.
This makes partition table to look more informative.

(From OE-Core rev: 945a5172c2b996f0f307813d061250c39f77ebd2)

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-06-23 11:47:26 +01:00
Ed Bartosh 1f7d16b6db init-install: Implement UUID support
Used partition UUID in kernel command line to specify root partition.
Searched root device by file system uuid in GRUB configuration.
Used partition UUID in /etc/fstab to specify swap partition.
Used filesystem UUID in /etc/fstab to specify boot partition.

[YOCTO #6101]

(From OE-Core rev: 4c223e0bd8770909dca1131580878eba6855e085)

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-06-23 11:47:25 +01:00
Ed Bartosh 04bff65585 init-install: Use GPT table with GRUB 2
Changed partition type from 'msdos' to 'gpt'.
Added special partition for grub stage2 bootloader.

NOTE: This is done only for GRUB 2 as legacy GRUB is
rarely used and doesn't support GPT partitions.

(From OE-Core rev: 9544ac920d65edb7ddb267482c84d6fc1b464912)

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-06-23 11:47:25 +01:00
Ed Bartosh 78bacee0ac init-install-efi: Implement UUID support
Using UUID in favor of device names is more reliable as
UUID names are persistent.

Device names can change as the order of adding device nodes
is arbitrary. This sometimes results in device names switching
on each boot, which can cause system fail to boot.
Persistent naming solves these issues.

Used partition UUID in kernel command line to specify root partition.
Used partition UUID in /etc/fstab to specify swap partition.
Used filesystem UUID in /etc/fstab to specify boot partition.

[YOCTO #6101]

(From OE-Core rev: f51b050e0df6ceaea07fbda99f54dc4aeaab334c)

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-06-23 11:47:24 +01:00
Ed Bartosh 411c276310 initramfs-live-install: Add blkid to initramfs
Added util-linux-blkid to the list of dependencies of
initramfs-live-install and initramfs-live-install-efi.

This is a part of the work to support partiion UUID in installer.
blkid is going to be used to get partition and filesystem UUIDs.

(From OE-Core rev: 3c26a5ad5937556dfd3262fa50e63350c5c71623)

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-06-23 11:47:22 +01:00
Awais Belal e1de8af487 initrdscripts: make boot drive detection more generic
The init script that invokes install and install-efi scripts
passes the first parameter that identifies the boot drive but
in cases when this disk is labeled and kernel configurations
allow disk labeling under /run/media/ this would pass the disk
label.
The earlier implementation considered that the drive name will
be passed and in case the label is passed it fails and provides
the boot drive as an option for installation driver.
We now use a more generic approach to identify the boot drive
which can handle both drive name as well as label if passed.

(From OE-Core rev: 1964b697ddadc59e27087f9f1f6b24236f4addcc)

Signed-off-by: Awais Belal <awais_belal@mentor.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-05-24 07:19:18 +01:00
Reinette Chatre fc15878af4 init-install-efi.sh: fix gummiboot entry installation
After selecting the "install" gummiboot option of a Live image we are
seeing boot failure resulting from the gummiboot entries not being
installed correctly. This seems to be a problem in this init-install-efi.sh
script where it incorrectly installs the gummiboot entries into the root
filesystem, not the boot partition. We fix it by installing the entries in
the boot partition.

(From OE-Core rev: c9b06c79ed8a082d1b385e9f61721aeeda9bf1af)

Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Acked-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-04-21 07:20:27 +01:00
Petter Mabäcker 4eb3db9a2c meta: set proper S value
After removal of auto-creating S we must ensure that all recipes are
using a proper value for S.

Fix all recipes that only need to set S equals to WORKDIR.

[YOCTO #5627]

(From OE-Core rev: 9d220b1bfe4589736604dd5a7129e3699377d830)

Signed-off-by: Petter Mabäcker <petter@technux.se>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-01-23 11:36:27 +00:00
Drew Moseley cade601651 init-install: Skip CDROM devices during probe
(From OE-Core rev: e8ee8b765183fb3ebe5e94df6375c2fad111dcc7)

Signed-off-by: Drew Moseley <drew_moseley@mentor.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-08-02 09:26:17 +01:00
Drew Moseley 112674d9fc init-install: Strip partition number from live_dev_name
This is needed in case the boot disk was created with mkdiskimage.
In that case the parameter passed is a variant of /dev/sda4 which
includes the partition number.  Without this change this install script
will offer to install onto the live media.

(From OE-Core rev: 9f6d7d42eaad225698de730d5c76bfe9523f4a78)

Signed-off-by: Drew Moseley <drew_moseley@mentor.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-08-02 09:26:16 +01:00
Drew Moseley 7a81bd4c34 init-install-efi.sh: Verify /sys based files exist before displaying them
Some mmc cards do not have all the data files in /sys/block
populated.  Check for existence before displaying the files
to avoid erroring out of the install process.

(From OE-Core rev: 4abe5563f61a228963e1e442ebc2df9f2d01be80)

Signed-off-by: Drew Moseley <drew_moseley@mentor.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-08-02 09:26:16 +01:00