summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/initrdscripts
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-core/initrdscripts')
-rw-r--r--meta/recipes-core/initrdscripts/files/init-install-efi-testfs.sh14
-rw-r--r--meta/recipes-core/initrdscripts/files/init-install-efi.sh62
-rw-r--r--meta/recipes-core/initrdscripts/files/init-install.sh74
-rwxr-xr-x[-rw-r--r--]meta/recipes-core/initrdscripts/files/init-live.sh17
-rw-r--r--meta/recipes-core/initrdscripts/initramfs-boot_1.0.bb7
-rw-r--r--meta/recipes-core/initrdscripts/initramfs-framework/exec29
-rwxr-xr-xmeta/recipes-core/initrdscripts/initramfs-framework/init7
-rw-r--r--meta/recipes-core/initrdscripts/initramfs-framework/lvm13
-rw-r--r--meta/recipes-core/initrdscripts/initramfs-framework/mdev4
-rw-r--r--meta/recipes-core/initrdscripts/initramfs-framework/nfsrootfs48
-rw-r--r--meta/recipes-core/initrdscripts/initramfs-framework/rootfs19
-rw-r--r--meta/recipes-core/initrdscripts/initramfs-framework/setup-live64
-rw-r--r--meta/recipes-core/initrdscripts/initramfs-framework/udev1
-rw-r--r--meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb34
-rw-r--r--meta/recipes-core/initrdscripts/initramfs-live-boot-tiny_1.0.bb21
-rw-r--r--meta/recipes-core/initrdscripts/initramfs-live-install-efi_1.0.bb5
-rw-r--r--meta/recipes-core/initrdscripts/initramfs-live-install_1.0.bb5
-rw-r--r--meta/recipes-core/initrdscripts/initramfs-module-install-efi_1.0.bb18
-rw-r--r--meta/recipes-core/initrdscripts/initramfs-module-install_1.0.bb23
-rw-r--r--meta/recipes-core/initrdscripts/initramfs-module-setup-live_1.0.bb20
20 files changed, 430 insertions, 55 deletions
diff --git a/meta/recipes-core/initrdscripts/files/init-install-efi-testfs.sh b/meta/recipes-core/initrdscripts/files/init-install-efi-testfs.sh
index b562109157..b351985a61 100644
--- a/meta/recipes-core/initrdscripts/files/init-install-efi-testfs.sh
+++ b/meta/recipes-core/initrdscripts/files/init-install-efi-testfs.sh
@@ -27,7 +27,7 @@ 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]"
+ echo "Found drive at /dev/${device}. Do you want to install this image there? [y/n]"
read answer
if [ "$answer" = "y" ] ; then
break
@@ -171,19 +171,19 @@ if [ -f /run/media/$1/EFI/BOOT/grub.cfg ]; then
fi
if [ -d /run/media/$1/loader ]; then
- GUMMIBOOT_CFGS="/ssd/loader/entries/*.conf"
- # copy config files for gummiboot
+ SYSTEMDBOOT_CFGS="/ssd/loader/entries/*.conf"
+ # copy config files for systemd-boot
cp -dr /run/media/$1/loader /ssd
# delete the install entry
rm -f /ssd/loader/entries/install.conf
# delete the initrd lines
- sed -i "/initrd /d" $GUMMIBOOT_CFGS
+ sed -i "/initrd /d" $SYSTEMDBOOT_CFGS
# delete any LABEL= strings
- sed -i "s/ LABEL=[^ ]*/ /" $GUMMIBOOT_CFGS
+ sed -i "s/ LABEL=[^ ]*/ /" $SYSTEMDBOOT_CFGS
# delete any root= strings
- sed -i "s/ root=[^ ]*/ /" $GUMMIBOOT_CFGS
+ sed -i "s/ root=[^ ]*/ /" $SYSTEMDBOOT_CFGS
# add the root= and other standard boot options
- sed -i "s@options *@options root=$rootfs rw $rootwait quiet @" $GUMMIBOOT_CFGS
+ sed -i "s@options *@options root=$rootfs rw $rootwait quiet @" $SYSTEMDBOOT_CFGS
# Add the test label
echo -ne "title test\nlinux /test-kernel\noptions root=$testfs rw $rootwait quiet\n" > /ssd/loader/entries/test.conf
fi
diff --git a/meta/recipes-core/initrdscripts/files/init-install-efi.sh b/meta/recipes-core/initrdscripts/files/init-install-efi.sh
index 441e25238d..b6855b5aac 100644
--- a/meta/recipes-core/initrdscripts/files/init-install-efi.sh
+++ b/meta/recipes-core/initrdscripts/files/init-install-efi.sh
@@ -8,8 +8,19 @@
PATH=/sbin:/bin:/usr/sbin:/usr/bin
-# We need 20 Mb for the boot partition
-boot_size=20
+# figure out how big of a boot partition we need
+boot_size=$(du -ms /run/media/$1/ | awk '{print $1}')
+# remove rootfs.img ($2) from the size if it exists, as its not installed to /boot
+if [ -e /run/media/$1/$2 ]; then
+ boot_size=$(( boot_size - $( du -ms /run/media/$1/$2 | awk '{print $1}') ))
+fi
+# remove initrd from size since its not currently installed
+if [ -e /run/media/$1/initrd ]; then
+ boot_size=$(( boot_size - $( du -ms /run/media/$1/initrd | awk '{print $1}') ))
+fi
+# add 10M to provide some extra space for users and account
+# for rounding in the above subtractions
+boot_size=$(( boot_size + 10 ))
# 5% for swap
swap_ratio=5
@@ -22,6 +33,8 @@ live_dev_name=${live_dev_name#\/dev/}
case $live_dev_name in
mmcblk*)
;;
+ nvme*)
+ ;;
*)
live_dev_name=${live_dev_name%%[0-9]*}
;;
@@ -146,7 +159,8 @@ swap_start=$((rootfs_end))
# 2) they are detected asynchronously (need rootwait)
rootwait=""
part_prefix=""
-if [ ! "${device#/dev/mmcblk}" = "${device}" ]; then
+if [ ! "${device#/dev/mmcblk}" = "${device}" ] || \
+ [ ! "${device#/dev/nvme}" = "${device}" ]; then
part_prefix="p"
rootwait="rootwait"
fi
@@ -176,18 +190,25 @@ parted ${device} mkpart boot fat32 0% $boot_size
parted ${device} set 1 boot on
echo "Creating rootfs partition on $rootfs"
-parted ${device} mkpart root ext3 $rootfs_start $rootfs_end
+parted ${device} mkpart root ext4 $rootfs_start $rootfs_end
echo "Creating swap partition on $swap"
parted ${device} mkpart swap linux-swap $swap_start 100%
parted ${device} print
+echo "Waiting for device nodes..."
+C=0
+while [ $C -ne 3 ] && [ ! -e $bootfs -o ! -e $rootfs -o ! -e $swap ]; do
+ C=$(( C + 1 ))
+ sleep 1
+done
+
echo "Formatting $bootfs to vfat..."
mkfs.vfat $bootfs
-echo "Formatting $rootfs to ext3..."
-mkfs.ext3 $rootfs
+echo "Formatting $rootfs to ext4..."
+mkfs.ext4 $rootfs
echo "Formatting swap partition...($swap)"
mkswap $swap
@@ -234,38 +255,43 @@ if [ -f /run/media/$1/EFI/BOOT/grub.cfg ]; then
sed -i "/initrd /d" $GRUBCFG
# Delete any LABEL= strings
sed -i "s/ LABEL=[^ ]*/ /" $GRUBCFG
- # Delete any root= strings
- sed -i "s/ root=[^ ]*/ /g" $GRUBCFG
- # Add the root= and other standard boot options
- sed -i "s@linux /vmlinuz *@linux /vmlinuz root=PARTUUID=$root_part_uuid rw $rootwait quiet @" $GRUBCFG
+ # Replace root= and add additional standard boot options
+ # We use root as a sentinel value, as vmlinuz is no longer guaranteed
+ sed -i "s/ root=[^ ]*/ root=PARTUUID=$root_part_uuid rw $rootwait quiet /g" $GRUBCFG
fi
if [ -d /run/media/$1/loader ]; then
rootuuid=$(blkid -o value -s PARTUUID ${rootfs})
- GUMMIBOOT_CFGS="/boot/loader/entries/*.conf"
- # copy config files for gummiboot
+ SYSTEMDBOOT_CFGS="/boot/loader/entries/*.conf"
+ # copy config files for systemd-boot
cp -dr /run/media/$1/loader /boot
# delete the install entry
rm -f /boot/loader/entries/install.conf
# delete the initrd lines
- sed -i "/initrd /d" $GUMMIBOOT_CFGS
+ sed -i "/initrd /d" $SYSTEMDBOOT_CFGS
# delete any LABEL= strings
- sed -i "s/ LABEL=[^ ]*/ /" $GUMMIBOOT_CFGS
+ sed -i "s/ LABEL=[^ ]*/ /" $SYSTEMDBOOT_CFGS
# delete any root= strings
- sed -i "s/ root=[^ ]*/ /" $GUMMIBOOT_CFGS
+ sed -i "s/ root=[^ ]*/ /" $SYSTEMDBOOT_CFGS
# add the root= and other standard boot options
- sed -i "s@options *@options root=PARTUUID=$rootuuid rw $rootwait quiet @" $GUMMIBOOT_CFGS
+ sed -i "s@options *@options root=PARTUUID=$rootuuid rw $rootwait quiet @" $SYSTEMDBOOT_CFGS
fi
umount /tgt_root
-cp /run/media/$1/vmlinuz /boot
+# Copy kernel artifacts. To add more artifacts just add to types
+# For now just support kernel types already being used by something in OE-core
+for types in bzImage zImage vmlinux vmlinuz fitImage; do
+ for kernel in `find /run/media/$1/ -name $types*`; do
+ cp $kernel /boot
+ done
+done
umount /boot
sync
-echo "Remove your installation media, and press ENTER"
+echo "Installation successful. Remove your installation media and press ENTER to reboot."
read enter
diff --git a/meta/recipes-core/initrdscripts/files/init-install.sh b/meta/recipes-core/initrdscripts/files/init-install.sh
index 04ce5fb4b5..e71579631b 100644
--- a/meta/recipes-core/initrdscripts/files/init-install.sh
+++ b/meta/recipes-core/initrdscripts/files/init-install.sh
@@ -7,8 +7,19 @@
PATH=/sbin:/bin:/usr/sbin:/usr/bin
-# We need 20 Mb for the boot partition
-boot_size=20
+# figure out how big of a boot partition we need
+boot_size=$(du -ms /run/media/$1/ | awk '{print $1}')
+# remove rootfs.img ($2) from the size if it exists, as its not installed to /boot
+if [ -e /run/media/$1/$2 ]; then
+ boot_size=$(( boot_size - $( du -ms /run/media/$1/$2 | awk '{print $1}') ))
+fi
+# remove initrd from size since its not currently installed
+if [ -e /run/media/$1/initrd ]; then
+ boot_size=$(( boot_size - $( du -ms /run/media/$1/initrd | awk '{print $1}') ))
+fi
+# add 10M to provide some extra space for users and account
+# for rounding in the above subtractions
+boot_size=$(( boot_size + 10 ))
# 5% for the swap
swap_ratio=5
@@ -21,6 +32,8 @@ live_dev_name=${live_dev_name#\/dev/}
case $live_dev_name in
mmcblk*)
;;
+ nvme*)
+ ;;
*)
live_dev_name=${live_dev_name%%[0-9]*}
;;
@@ -130,7 +143,7 @@ fi
disk_size=$(parted ${device} unit mb print | grep '^Disk .*: .*MB' | cut -d" " -f 3 | sed -e "s/MB//")
-grub_version=$(grub-install -v|sed 's/.* \([0-9]\).*/\1/')
+grub_version=$(grub-install -V|sed 's/.* \([0-9]\).*/\1/')
if [ $grub_version -eq 0 ] ; then
bios_boot_size=0
@@ -153,7 +166,8 @@ swap_start=$((rootfs_end))
# 2) they are detected asynchronously (need rootwait)
rootwait=""
part_prefix=""
-if [ ! "${device#/dev/mmcblk}" = "${device}" ]; then
+if [ ! "${device#/dev/mmcblk}" = "${device}" ] || \
+ [ ! "${device#/dev/nvme}" = "${device}" ]; then
part_prefix="p"
rootwait="rootwait"
fi
@@ -200,7 +214,7 @@ fi
echo "Creating rootfs partition on $rootfs"
[ $grub_version -eq 0 ] && pname='primary' || pname='root'
-parted ${device} mkpart $pname ext3 $rootfs_start $rootfs_end
+parted ${device} mkpart $pname ext4 $rootfs_start $rootfs_end
echo "Creating swap partition on $swap"
[ $grub_version -eq 0 ] && pname='primary' || pname='swap'
@@ -208,11 +222,18 @@ parted ${device} mkpart $pname linux-swap $swap_start 100%
parted ${device} print
+echo "Waiting for device nodes..."
+C=0
+while [ $C -ne 3 ] && [ ! -e $bootfs -o ! -e $rootfs -o ! -e $swap ]; do
+ C=$(( C + 1 ))
+ sleep 1
+done
+
echo "Formatting $bootfs to ext3..."
mkfs.ext3 $bootfs
-echo "Formatting $rootfs to ext3..."
-mkfs.ext3 $rootfs
+echo "Formatting $rootfs to ext4..."
+mkfs.ext4 $rootfs
echo "Formatting swap partition...($swap)"
mkswap $swap
@@ -246,9 +267,34 @@ fi
umount /tgt_root
umount /src_root
+echo "Looking for kernels to use as boot target.."
+# Find kernel to boot to
+# Give user options if multiple are found
+kernels="$(find /run/media/$1/ -type f \
+ -name bzImage* -o -name zImage* \
+ -o -name vmlinux* -o -name vmlinuz* \
+ -o -name fitImage* \
+ | sed s:.*/::)"
+if [ -n "$(echo $kernels)" ]; then
+ # only one kernel entry if no space
+ if [ -z "$(echo $kernels | grep " ")" ]; then
+ kernel=$kernels
+ echo "$kernel will be used as the boot target"
+ else
+ echo "Which kernel do we want to boot by default? The following kernels were found:"
+ echo $kernels
+ read answer
+ kernel=$answer
+ fi
+else
+ echo "No kernels found, exiting..."
+ exit 1
+fi
+
# Handling of the target boot partition
mount $bootfs /boot
echo "Preparing boot partition..."
+
if [ -f /etc/grub.d/00_header -a $grub_version -ne 0 ] ; then
echo "Preparing custom grub2 menu..."
root_part_uuid=$(blkid -o value -s PARTUUID ${rootfs})
@@ -256,9 +302,11 @@ if [ -f /etc/grub.d/00_header -a $grub_version -ne 0 ] ; then
GRUBCFG="/boot/grub/grub.cfg"
mkdir -p $(dirname $GRUBCFG)
cat >$GRUBCFG <<_EOF
+timeout=5
+default=0
menuentry "Linux" {
search --no-floppy --fs-uuid $boot_uuid --set root
- linux /vmlinuz root=PARTUUID=$root_part_uuid $rootwait rw $5 $3 $4 quiet
+ linux /$kernel root=PARTUUID=$root_part_uuid $rootwait rw $5 $3 $4 quiet
}
_EOF
chmod 0444 $GRUBCFG
@@ -272,10 +320,16 @@ if [ $grub_version -eq 0 ] ; then
echo "timeout 30" >> /boot/grub/menu.lst
echo "title Live Boot/Install-Image" >> /boot/grub/menu.lst
echo "root (hd0,0)" >> /boot/grub/menu.lst
- echo "kernel /vmlinuz root=$rootfs rw $3 $4 quiet" >> /boot/grub/menu.lst
+ echo "kernel /$kernel root=$rootfs rw $3 $4 quiet" >> /boot/grub/menu.lst
fi
-cp /run/media/$1/vmlinuz /boot/
+# Copy kernel artifacts. To add more artifacts just add to types
+# For now just support kernel types already being used by something in OE-core
+for types in bzImage zImage vmlinux vmlinuz fitImage; do
+ for kernel in `find /run/media/$1/ -name $types*`; do
+ cp $kernel /boot
+ done
+done
umount /boot
diff --git a/meta/recipes-core/initrdscripts/files/init-live.sh b/meta/recipes-core/initrdscripts/files/init-live.sh
index 441b41c9d6..b20660b60a 100644..100755
--- a/meta/recipes-core/initrdscripts/files/init-live.sh
+++ b/meta/recipes-core/initrdscripts/files/init-live.sh
@@ -28,8 +28,7 @@ udev_daemon() {
_UDEV_DAEMON=`udev_daemon`
early_setup() {
- mkdir -p /proc
- mkdir -p /sys
+ mkdir -p /proc /sys /run /var/run
mount -t proc proc /proc
mount -t sysfs sysfs /sys
mount -t devtmpfs none /dev
@@ -37,9 +36,6 @@ early_setup() {
# support modular kernel
modprobe isofs 2> /dev/null
- mkdir -p /run
- mkdir -p /var/run
-
$_UDEV_DAEMON --daemon
udevadm trigger --action=add
}
@@ -84,6 +80,10 @@ boot_live_root() {
# device node creation events were handled, to avoid unexpected behavior
killall -9 "${_UDEV_DAEMON##*/}" 2>/dev/null
+ # Don't run systemd-update-done on systemd-based live systems
+ # because it triggers a slow rebuild of ldconfig caches.
+ touch ${ROOT_MOUNT}/etc/.updated ${ROOT_MOUNT}/var/.updated
+
# Allow for identification of the real root even after boot
mkdir -p ${ROOT_MOUNT}/media/realroot
mount -n --move "/run/media/${ROOT_DISK}" ${ROOT_MOUNT}/media/realroot
@@ -91,8 +91,11 @@ boot_live_root() {
# Move the mount points of some filesystems over to
# the corresponding directories under the real root filesystem.
for dir in `awk '/\/dev.* \/run\/media/{print $2}' /proc/mounts`; do
- mkdir -p ${ROOT_MOUNT}/media/${dir##*/}
- mount -n --move $dir ${ROOT_MOUNT}/media/${dir##*/}
+ # Parse any OCT or HEX encoded chars such as spaces
+ # in the mount points to actual ASCII chars
+ dir=`printf $dir`
+ mkdir -p "${ROOT_MOUNT}/media/${dir##*/}"
+ mount -n --move "$dir" "${ROOT_MOUNT}/media/${dir##*/}"
done
mount -n --move /proc ${ROOT_MOUNT}/proc
mount -n --move /sys ${ROOT_MOUNT}/sys
diff --git a/meta/recipes-core/initrdscripts/initramfs-boot_1.0.bb b/meta/recipes-core/initrdscripts/initramfs-boot_1.0.bb
index 7ae7969f5e..29ec5ec2ff 100644
--- a/meta/recipes-core/initrdscripts/initramfs-boot_1.0.bb
+++ b/meta/recipes-core/initrdscripts/initramfs-boot_1.0.bb
@@ -9,8 +9,13 @@ S = "${WORKDIR}"
do_install() {
install -m 0755 ${WORKDIR}/init-boot.sh ${D}/init
+
+ # Create device nodes expected by some kernels in initramfs
+ # before even executing /init.
+ install -d ${D}/dev
+ mknod -m 622 ${D}/dev/console c 5 1
}
inherit allarch
-FILES_${PN} += " /init "
+FILES_${PN} += "/init /dev/console"
diff --git a/meta/recipes-core/initrdscripts/initramfs-framework/exec b/meta/recipes-core/initrdscripts/initramfs-framework/exec
new file mode 100644
index 0000000000..a8e2432bb6
--- /dev/null
+++ b/meta/recipes-core/initrdscripts/initramfs-framework/exec
@@ -0,0 +1,29 @@
+#!/bin/sh
+# Copyright (C) 2017 O.S. Systems Software LTDA.
+# Licensed on MIT
+
+EXEC_DIR=/exec.d # place to look for modules
+
+exec_enabled() {
+ return 0
+}
+
+exec_run() {
+ if [ ! -d $EXEC_DIR ]; then
+ msg "No contents to exec in $EXEC_DIR. Starting shell ..."
+ sh
+ fi
+
+ # Load and run modules
+ for m in $EXEC_DIR/*; do
+ # Skip backup files
+ if [ "`echo $m | sed -e 's/\~$//'`" != "$m" ]; then
+ continue
+ fi
+
+ debug "Starting $m"
+
+ # process module
+ ./$m
+ done
+}
diff --git a/meta/recipes-core/initrdscripts/initramfs-framework/init b/meta/recipes-core/initrdscripts/initramfs-framework/init
index 37527a840a..c71ce0ce8c 100755
--- a/meta/recipes-core/initrdscripts/initramfs-framework/init
+++ b/meta/recipes-core/initrdscripts/initramfs-framework/init
@@ -72,6 +72,7 @@ ROOTFS_DIR="/rootfs" # where to do the switch root
MODULE_PRE_HOOKS="" # functions to call before running each module
MODULE_POST_HOOKS="" # functions to call after running each module
MODULES_DIR=/init.d # place to look for modules
+EFI_DIR=/sys/firmware/efi # place to store device firmware information
# make mount stop complaining about missing /etc/fstab
touch /etc/fstab
@@ -81,10 +82,14 @@ mkdir -p /proc /sys /run/lock /var/lock
mount -t proc proc /proc
mount -t sysfs sysfs /sys
+if [ -d $EFI_DIR ];then
+ mount -t efivarfs none /sys/firmware/efi/efivars
+fi
+
# populate bootparam environment
for p in `cat /proc/cmdline`; do
opt=`echo $p | cut -d'=' -f1`
- opt=`echo $opt | tr '.-' '__'`
+ opt=`echo $opt | sed -e 'y/.-/__/'`
if [ "`echo $p | cut -d'=' -f1`" = "$p" ]; then
eval "bootparam_${opt}=true"
else
diff --git a/meta/recipes-core/initrdscripts/initramfs-framework/lvm b/meta/recipes-core/initrdscripts/initramfs-framework/lvm
new file mode 100644
index 0000000000..7deeccb9a2
--- /dev/null
+++ b/meta/recipes-core/initrdscripts/initramfs-framework/lvm
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+lvm_enabled() {
+ if ! lvscan |grep -i -w "inactive" &>/dev/null;then
+ return 1
+ fi
+ return 0
+}
+
+lvm_run() {
+ lvm pvscan --cache --activate ay
+ udevadm trigger --action=add
+}
diff --git a/meta/recipes-core/initrdscripts/initramfs-framework/mdev b/meta/recipes-core/initrdscripts/initramfs-framework/mdev
index a5df1d717a..9814d9764a 100644
--- a/meta/recipes-core/initrdscripts/initramfs-framework/mdev
+++ b/meta/recipes-core/initrdscripts/initramfs-framework/mdev
@@ -1,5 +1,5 @@
#!/bin/sh
-# Copyright (C) 2011 O.S. Systems Software LTDA.
+# Copyright (C) 2011, 2017 O.S. Systems Software LTDA.
# Licensed on MIT
mdev_enabled() {
@@ -25,6 +25,6 @@ mdev_run() {
# load modules for devices
find /sys -name modalias | while read m; do
- load_kernel_module $(cat $m)
+ load_kernel_module $(cat "$m")
done
}
diff --git a/meta/recipes-core/initrdscripts/initramfs-framework/nfsrootfs b/meta/recipes-core/initrdscripts/initramfs-framework/nfsrootfs
new file mode 100644
index 0000000000..e67ee4c25d
--- /dev/null
+++ b/meta/recipes-core/initrdscripts/initramfs-framework/nfsrootfs
@@ -0,0 +1,48 @@
+#!/bin/sh
+
+nfsrootfs_enabled() {
+ if [ ${bootparam_root} != "/dev/nfs" ] || [ -z ${bootparam_nfsroot} ]; then
+ return 1
+ fi
+ return 0
+}
+
+nfsrootfs_run() {
+ local nfs_opts
+ local location
+ local flags
+ local server_ip
+
+ nfs_opts=""
+ if [ "${bootparam_nfsroot#*,}" != "${bootparam_nfsroot}" ]; then
+ nfs_opts="-o ${bootparam_nfsroot#*,}"
+ fi
+
+ location="${bootparam_nfsroot%%,*}"
+ if [ "${location#*:}" = "${location}" ]; then
+ # server-ip not given. Get server ip from ip option
+ server_ip=""
+ if [ "${bootparam_ip#*:}" != "${bootparam_ip}" ]; then
+ server_ip=$(echo "$bootparam_ip" | cut -d: -f2)
+ fi
+
+ if [ -z "$server_ip" ]; then
+ fatal "Server IP is not set. Update ip or nfsroot options."
+ fi
+ location=${server_ip}:${location}
+ fi
+
+ flags="-o nolock"
+ if [ -n "$bootparam_ro" ] && ! echo "$bootparam_rootflags" | grep -w -q "ro"; then
+ if [ -n "$bootparam_rootflags" ]; then
+ bootparam_rootflags="$bootparam_rootflags,"
+ fi
+ bootparam_rootflags="${bootparam_rootflags}ro"
+ fi
+ if [ -n "$bootparam_rootflags" ]; then
+ flags="$flags -o $bootparam_rootflags"
+ fi
+
+ mount -t nfs ${flags} ${nfs_opts} ${location} ${ROOTFS_DIR}
+}
+
diff --git a/meta/recipes-core/initrdscripts/initramfs-framework/rootfs b/meta/recipes-core/initrdscripts/initramfs-framework/rootfs
index 14768f1cd4..748c9391c0 100644
--- a/meta/recipes-core/initrdscripts/initramfs-framework/rootfs
+++ b/meta/recipes-core/initrdscripts/initramfs-framework/rootfs
@@ -27,8 +27,23 @@ rootfs_run() {
fi
if [ "`echo ${bootparam_root} | cut -c1-9`" = "PARTUUID=" ]; then
- root_uuid=`echo $bootparam_root | cut -c10-`
- bootparam_root="/dev/disk/by-partuuid/$root_uuid"
+ root_partuuid=`echo $bootparam_root | cut -c10-`
+ bootparam_root="/dev/disk/by-partuuid/$root_partuuid"
+ fi
+
+ if [ "`echo ${bootparam_root} | cut -c1-10`" = "PARTLABEL=" ]; then
+ root_partlabel=`echo $bootparam_root | cut -c11-`
+ bootparam_root="/dev/disk/by-partlabel/$root_partlabel"
+ fi
+
+ if [ "`echo ${bootparam_root} | cut -c1-10`" = "PARTLABEL=" ]; then
+ root_partlabel=`echo $bootparam_root | cut -c11-`
+ bootparam_root="/dev/disk/by-partlabel/$root_partlabel"
+ fi
+
+ if [ "`echo ${bootparam_root} | cut -c1-6`" = "LABEL=" ]; then
+ root_label=`echo $bootparam_root | cut -c7-`
+ bootparam_root="/dev/disk/by-label/$root_label"
fi
if [ -e "$bootparam_root" ]; then
diff --git a/meta/recipes-core/initrdscripts/initramfs-framework/setup-live b/meta/recipes-core/initrdscripts/initramfs-framework/setup-live
new file mode 100644
index 0000000000..4c79f41285
--- /dev/null
+++ b/meta/recipes-core/initrdscripts/initramfs-framework/setup-live
@@ -0,0 +1,64 @@
+#/bin/sh
+# Copyright (C) 2011 O.S. Systems Software LTDA.
+# Licensed on MIT
+
+setup_enabled() {
+ return 0
+}
+
+setup_run() {
+ROOT_IMAGE="rootfs.img"
+ISOLINUX=""
+ROOT_DISK=""
+shelltimeout=30
+
+ if [ -z "$bootparam_root" -o "$bootparam_root" = "/dev/ram0" ]; then
+ echo "Waiting for removable media..."
+ C=0
+ while true
+ do
+ for i in `ls /run/media 2>/dev/null`; do
+ if [ -f /run/media/$i/$ROOT_IMAGE ] ; then
+ found="yes"
+ ROOT_DISK="$i"
+ break
+ elif [ -f /run/media/$i/isolinux/$ROOT_IMAGE ]; then
+ found="yes"
+ ISOLINUX="isolinux"
+ ROOT_DISK="$i"
+ break
+ fi
+ done
+ if [ "$found" = "yes" ]; then
+ break;
+ fi
+ # don't wait for more than $shelltimeout seconds, if it's set
+ if [ -n "$shelltimeout" ]; then
+ echo -n " " $(( $shelltimeout - $C ))
+ if [ $C -ge $shelltimeout ]; then
+ echo "..."
+ echo "Mounted filesystems"
+ mount | grep media
+ echo "Available block devices"
+ cat /proc/partitions
+ fatal "Cannot find $ROOT_IMAGE file in /run/media/* , dropping to a shell "
+ fi
+ C=$(( C + 1 ))
+ fi
+ sleep 1
+ done
+ # The existing rootfs module has no support for rootfs images. Assign the rootfs image.
+ bootparam_root="/run/media/$ROOT_DISK/$ISOLINUX/$ROOT_IMAGE"
+ fi
+
+ if [ "$bootparam_LABEL" != "boot" -a -f /init.d/$bootparam_LABEL.sh ] ; then
+ if [ -f /run/media/$i/$ISOLINUX/$ROOT_IMAGE ] ; then
+ ./init.d/$bootparam_LABEL.sh $i/$ISOLINUX $ROOT_IMAGE $video_mode $vga_mode $console_params
+ else
+ fatal "Could not find $bootparam_LABEL script"
+ fi
+
+ # If we're getting here, we failed...
+ fatal "Target $bootparam_LABEL failed"
+ fi
+}
diff --git a/meta/recipes-core/initrdscripts/initramfs-framework/udev b/meta/recipes-core/initrdscripts/initramfs-framework/udev
index 79c8867823..87551ff4a9 100644
--- a/meta/recipes-core/initrdscripts/initramfs-framework/udev
+++ b/meta/recipes-core/initrdscripts/initramfs-framework/udev
@@ -6,6 +6,7 @@ udev_shutdown_hook_handler() {
status=$1
module=$2
if [ "$status" = "pre" ] && [ "$module" = "finish" ]; then
+ udevadm settle
killall `basename $_UDEV_DAEMON` 2>/dev/null
fi
}
diff --git a/meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb b/meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb
index 67a1b04d28..c53a0c03ae 100644
--- a/meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb
+++ b/meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb
@@ -2,18 +2,23 @@ SUMMARY = "Modular initramfs system"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
RDEPENDS_${PN} += "${VIRTUAL-RUNTIME_base-utils}"
+RRECOMMENDS_${PN} = "${VIRTUAL-RUNTIME_base-utils-syslog}"
-PR = "r2"
+PR = "r4"
inherit allarch
SRC_URI = "file://init \
+ file://exec \
+ file://nfsrootfs \
file://rootfs \
file://finish \
file://mdev \
file://udev \
file://e2fs \
- file://debug"
+ file://debug \
+ file://lvm \
+ "
S = "${WORKDIR}"
@@ -22,9 +27,13 @@ do_install() {
# base
install -m 0755 ${WORKDIR}/init ${D}/init
+ install -m 0755 ${WORKDIR}/nfsrootfs ${D}/init.d/85-nfsrootfs
install -m 0755 ${WORKDIR}/rootfs ${D}/init.d/90-rootfs
install -m 0755 ${WORKDIR}/finish ${D}/init.d/99-finish
+ # exec
+ install -m 0755 ${WORKDIR}/exec ${D}/init.d/89-exec
+
# mdev
install -m 0755 ${WORKDIR}/mdev ${D}/init.d/01-mdev
@@ -37,6 +46,9 @@ do_install() {
# debug
install -m 0755 ${WORKDIR}/debug ${D}/init.d/00-debug
+ # lvm
+ install -m 0755 ${WORKDIR}/lvm ${D}/init.d/09-lvm
+
# Create device nodes expected by some kernels in initramfs
# before even executing /init.
install -d ${D}/dev
@@ -44,11 +56,15 @@ do_install() {
}
PACKAGES = "${PN}-base \
+ initramfs-module-exec \
initramfs-module-mdev \
initramfs-module-udev \
initramfs-module-e2fs \
+ initramfs-module-nfsrootfs \
initramfs-module-rootfs \
- initramfs-module-debug"
+ initramfs-module-debug \
+ initramfs-module-lvm \
+ "
FILES_${PN}-base = "/init /init.d/99-finish /dev"
@@ -60,6 +76,10 @@ FILES_${PN}-base = "/init /init.d/99-finish /dev"
# and mounts the rootfs. Then 90-rootfs will proceed immediately.
RRECOMMENDS_${PN}-base += "initramfs-module-rootfs"
+SUMMARY_initramfs-module-exec = "initramfs support for easy execution of applications"
+RDEPENDS_initramfs-module-exec = "${PN}-base"
+FILES_initramfs-module-exec = "/init.d/89-exec"
+
SUMMARY_initramfs-module-mdev = "initramfs support for mdev"
RDEPENDS_initramfs-module-mdev = "${PN}-base busybox-mdev"
FILES_initramfs-module-mdev = "/init.d/01-mdev"
@@ -72,6 +92,10 @@ SUMMARY_initramfs-module-e2fs = "initramfs support for ext4/ext3/ext2 filesystem
RDEPENDS_initramfs-module-e2fs = "${PN}-base"
FILES_initramfs-module-e2fs = "/init.d/10-e2fs"
+SUMMARY_initramfs-module-nfsrootfs = "initramfs support for locating and mounting the root partition via nfs"
+RDEPENDS_initramfs-module-nfsrootfs = "${PN}-base"
+FILES_initramfs-module-nfsrootfs = "/init.d/85-nfsrootfs"
+
SUMMARY_initramfs-module-rootfs = "initramfs support for locating and mounting the root partition"
RDEPENDS_initramfs-module-rootfs = "${PN}-base"
FILES_initramfs-module-rootfs = "/init.d/90-rootfs"
@@ -79,3 +103,7 @@ FILES_initramfs-module-rootfs = "/init.d/90-rootfs"
SUMMARY_initramfs-module-debug = "initramfs dynamic debug support"
RDEPENDS_initramfs-module-debug = "${PN}-base"
FILES_initramfs-module-debug = "/init.d/00-debug"
+
+SUMMARY_initramfs-module-lvm = "initramfs lvm rootfs support"
+RDEPENDS_initramfs-module-lvm = "${PN}-base"
+FILES_initramfs-module-lvm = "/init.d/09-lvm"
diff --git a/meta/recipes-core/initrdscripts/initramfs-live-boot-tiny_1.0.bb b/meta/recipes-core/initrdscripts/initramfs-live-boot-tiny_1.0.bb
new file mode 100644
index 0000000000..7a9a8ecae2
--- /dev/null
+++ b/meta/recipes-core/initrdscripts/initramfs-live-boot-tiny_1.0.bb
@@ -0,0 +1,21 @@
+SUMMARY = "Live image init script"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
+DEPENDS = "virtual/kernel"
+RDEPENDS_${PN} = "busybox-mdev"
+SRC_URI = "file://init-live.sh"
+
+PR = "r12"
+
+S = "${WORKDIR}"
+
+do_install() {
+ install -m 0755 ${WORKDIR}/init-live.sh ${D}/init
+ install -d ${D}/dev
+ mknod -m 622 ${D}/dev/console c 5 1
+}
+
+FILES_${PN} += " /init /dev "
+
+# Due to kernel dependency
+PACKAGE_ARCH = "${MACHINE_ARCH}"
diff --git a/meta/recipes-core/initrdscripts/initramfs-live-install-efi_1.0.bb b/meta/recipes-core/initrdscripts/initramfs-live-install-efi_1.0.bb
index 32c1fce76b..cc842ae8b7 100644
--- a/meta/recipes-core/initrdscripts/initramfs-live-install-efi_1.0.bb
+++ b/meta/recipes-core/initrdscripts/initramfs-live-install-efi_1.0.bb
@@ -5,7 +5,8 @@ SRC_URI = "file://init-install-efi.sh"
PR = "r1"
-RDEPENDS_${PN} = "parted e2fsprogs-mke2fs dosfstools util-linux-blkid"
+RDEPENDS_${PN} = "parted e2fsprogs-mke2fs dosfstools util-linux-blkid ${VIRTUAL-RUNTIME_base-utils}"
+RRECOMMENDS_${PN} = "${VIRTUAL-RUNTIME_base-utils-syslog}"
S = "${WORKDIR}"
@@ -21,4 +22,4 @@ INHIBIT_DEFAULT_DEPS = "1"
FILES_${PN} = " /install-efi.sh "
-COMPATIBLE_HOST = "(i.86|x86_64).*-linux"
+COMPATIBLE_HOST = "(i.86.*|x86_64.*|aarch64.*)-linux"
diff --git a/meta/recipes-core/initrdscripts/initramfs-live-install_1.0.bb b/meta/recipes-core/initrdscripts/initramfs-live-install_1.0.bb
index 88b3b30197..48fc0c4a76 100644
--- a/meta/recipes-core/initrdscripts/initramfs-live-install_1.0.bb
+++ b/meta/recipes-core/initrdscripts/initramfs-live-install_1.0.bb
@@ -7,7 +7,8 @@ PR = "r9"
S = "${WORKDIR}"
-RDEPENDS_${PN} = "grub parted e2fsprogs-mke2fs util-linux-blkid"
+RDEPENDS_${PN} = "grub parted e2fsprogs-mke2fs util-linux-blkid ${VIRTUAL-RUNTIME_base-utils}"
+RRECOMMENDS_${PN} = "${VIRTUAL-RUNTIME_base-utils-syslog}"
do_install() {
install -m 0755 ${WORKDIR}/init-install.sh ${D}/install.sh
@@ -21,4 +22,4 @@ INHIBIT_DEFAULT_DEPS = "1"
FILES_${PN} = " /install.sh "
-COMPATIBLE_HOST = "(i.86|x86_64).*-linux"
+COMPATIBLE_HOST = "(i.86.*|x86_64.*|aarch64.*)-linux"
diff --git a/meta/recipes-core/initrdscripts/initramfs-module-install-efi_1.0.bb b/meta/recipes-core/initrdscripts/initramfs-module-install-efi_1.0.bb
new file mode 100644
index 0000000000..523138cff3
--- /dev/null
+++ b/meta/recipes-core/initrdscripts/initramfs-module-install-efi_1.0.bb
@@ -0,0 +1,18 @@
+SUMMARY = "initramfs-framework module for EFI installation option"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
+RDEPENDS_${PN} = "initramfs-framework-base parted e2fsprogs-mke2fs dosfstools util-linux-blkid ${VIRTUAL-RUNTIME_base-utils}"
+RRECOMMENDS_${PN} = "${VIRTUAL-RUNTIME_base-utils-syslog}"
+
+PR = "r4"
+
+SRC_URI = "file://init-install-efi.sh"
+
+S = "${WORKDIR}"
+
+do_install() {
+ install -d ${D}/init.d
+ install -m 0755 ${WORKDIR}/init-install-efi.sh ${D}/init.d/install-efi.sh
+}
+
+FILES_${PN} = "/init.d/install-efi.sh"
diff --git a/meta/recipes-core/initrdscripts/initramfs-module-install_1.0.bb b/meta/recipes-core/initrdscripts/initramfs-module-install_1.0.bb
new file mode 100644
index 0000000000..56898e824f
--- /dev/null
+++ b/meta/recipes-core/initrdscripts/initramfs-module-install_1.0.bb
@@ -0,0 +1,23 @@
+SUMMARY = "initramfs-framework module for installation option"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
+RDEPENDS_${PN} = "initramfs-framework-base grub parted e2fsprogs-mke2fs util-linux-blkid ${VIRTUAL-RUNTIME_base-utils}"
+RRECOMMENDS_${PN} = "${VIRTUAL-RUNTIME_base-utils-syslog}"
+
+# The same restriction as grub
+COMPATIBLE_HOST = '(x86_64.*|i.86.*|arm.*|aarch64.*)-(linux.*|freebsd.*)'
+COMPATIBLE_HOST_armv7a = 'null'
+COMPATIBLE_HOST_armv7ve = 'null'
+
+PR = "r1"
+
+SRC_URI = "file://init-install.sh"
+
+S = "${WORKDIR}"
+
+do_install() {
+ install -d ${D}/init.d
+ install -m 0755 ${WORKDIR}/init-install.sh ${D}/init.d/install.sh
+}
+
+FILES_${PN} = "/init.d/install.sh"
diff --git a/meta/recipes-core/initrdscripts/initramfs-module-setup-live_1.0.bb b/meta/recipes-core/initrdscripts/initramfs-module-setup-live_1.0.bb
new file mode 100644
index 0000000000..4d2fe9dd2b
--- /dev/null
+++ b/meta/recipes-core/initrdscripts/initramfs-module-setup-live_1.0.bb
@@ -0,0 +1,20 @@
+SUMMARY = "initramfs-framework module for live booting"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
+RDEPENDS_${PN} = "initramfs-framework-base udev-extraconf"
+
+PR = "r4"
+
+inherit allarch
+
+FILESEXTRAPATHS_prepend := "${THISDIR}/initramfs-framework:"
+SRC_URI = "file://setup-live"
+
+S = "${WORKDIR}"
+
+do_install() {
+ install -d ${D}/init.d
+ install -m 0755 ${WORKDIR}/setup-live ${D}/init.d/80-setup-live
+}
+
+FILES_${PN} = "/init.d/80-setup-live"