diff options
Diffstat (limited to 'meta/recipes-core/initrdscripts')
24 files changed, 638 insertions, 154 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 7a0b4d4406..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 @@ -69,7 +69,7 @@ umount /dev/${device}* 2> /dev/null || /bin/true 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//") +disk_size=$(parted /dev/${device} unit mb print | grep '^Disk .*: .*MB' | cut -d" " -f 3 | sed -e "s/MB//") testfs_size=$((disk_size*testfs_ratio/100)) rootfs_size=$((disk_size-boot_size-testfs_size)) @@ -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 a3ed74b989..f667518b89 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]*} ;; @@ -29,7 +42,13 @@ esac echo "Searching for hard drives ..." -for device in `ls /sys/block/`; do +# Some eMMC devices have special sub devices such as mmcblk0boot0 etc +# we're currently only interested in the root device so pick them wisely +devices=`ls /sys/block/ | grep -v mmcblk` || true +mmc_devices=`ls /sys/block/ | grep "mmcblk[0-9]\{1,\}$"` || true +devices="$devices $mmc_devices" + +for device in $devices; do case $device in loop*) # skip loop device @@ -78,17 +97,23 @@ for hdname in $hdnamelist; do cat /sys/block/$hdname/device/uevent fi echo - # Get user choice - while true; do - echo -n "Do you want to install this image there? [y/n] " - read answer - if [ "$answer" = "y" -o "$answer" = "n" ]; then +done + +# Get user choice +while true; do + echo "Please select an install target or press n to exit ($hdnamelist ): " + read answer + if [ "$answer" = "n" ]; then + echo "Installation manually aborted." + exit 1 + fi + for hdname in $hdnamelist; do + if [ "$answer" = "$hdname" ]; then + TARGET_DEVICE_NAME=$answer break fi - echo "Please answer y or n" done - if [ "$answer" = "y" ]; then - TARGET_DEVICE_NAME=$hdname + if [ -n "$TARGET_DEVICE_NAME" ]; then break fi done @@ -114,9 +139,13 @@ rm -f /etc/udev/scripts/mount* umount ${device}* 2> /dev/null || /bin/true mkdir -p /tmp -cat /proc/mounts > /etc/mtab -disk_size=$(parted ${device} unit mb print | grep Disk | cut -d" " -f 3 | sed -e "s/MB//") +# Create /etc/mtab if not present +if [ ! -e /etc/mtab ] && [ -e /proc/mounts ]; then + ln -sf /proc/mounts /etc/mtab +fi + +disk_size=$(parted ${device} unit mb print | grep '^Disk .*: .*MB' | cut -d" " -f 3 | sed -e "s/MB//") swap_size=$((disk_size*swap_ratio/100)) rootfs_size=$((disk_size-boot_size-swap_size)) @@ -130,10 +159,17 @@ swap_start=$((rootfs_end)) # 2) they are detected asynchronously (need rootwait) rootwait="" part_prefix="" -if [ ! "${device#mmcblk}" = "${device}" ]; then +if [ ! "${device#/dev/mmcblk}" = "${device}" ] || \ + [ ! "${device#/dev/nvme}" = "${device}" ]; then part_prefix="p" rootwait="rootwait" fi + +# USB devices also require rootwait +if [ -n `readlink /dev/disk/by-id/usb* | grep $TARGET_DEVICE_NAME` ]; then + rootwait="rootwait" +fi + bootfs=${device}${part_prefix}1 rootfs=${device}${part_prefix}2 swap=${device}${part_prefix}3 @@ -154,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 @@ -180,8 +223,8 @@ mount -o rw,loop,noatime,nodiratime /run/media/$1/$2 /src_root echo "Copying rootfs files..." cp -a /src_root/* /tgt_root if [ -d /tgt_root/etc/ ] ; then - boot_uuid=$(blkid -o value -s UUID ${device}1) - swap_part_uuid=$(blkid -o value -s PARTUUID ${device}3) + boot_uuid=$(blkid -o value -s UUID ${bootfs}) + swap_part_uuid=$(blkid -o value -s PARTUUID ${swap}) echo "/dev/disk/by-partuuid/$swap_part_uuid swap swap defaults 0 0" >> /tgt_root/etc/fstab echo "UUID=$boot_uuid /boot vfat defaults 1 2" >> /tgt_root/etc/fstab # We dont want udev to mount our root device while we're booting... @@ -202,7 +245,7 @@ mkdir -p $EFIDIR cp /run/media/$1/EFI/BOOT/*.efi $EFIDIR if [ -f /run/media/$1/EFI/BOOT/grub.cfg ]; then - root_part_uuid=$(blkid -o value -s PARTUUID ${device}2) + root_part_uuid=$(blkid -o value -s PARTUUID ${rootfs}) GRUBCFG="$EFIDIR/grub.cfg" cp /run/media/$1/EFI/BOOT/grub.cfg $GRUBCFG # Update grub config for the installed image @@ -212,37 +255,48 @@ 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=[^ ]*/ /" $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 - GUMMIBOOT_CFGS="/boot/loader/entries/*.conf" - # copy config files for gummiboot + rootuuid=$(blkid -o value -s PARTUUID ${rootfs}) + 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 any extra files needed for ESP +if [ -d /run/media/$1/esp ]; then + cp -r /run/media/$1/esp/* /boot +fi + +# 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 f9e9768e43..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]*} ;; @@ -28,7 +41,13 @@ esac echo "Searching for hard drives ..." -for device in `ls /sys/block/`; do +# Some eMMC devices have special sub devices such as mmcblk0boot0 etc +# we're currently only interested in the root device so pick them wisely +devices=`ls /sys/block/ | grep -v mmcblk` || true +mmc_devices=`ls /sys/block/ | grep "mmcblk[0-9]\{1,\}$"` || true +devices="$devices $mmc_devices" + +for device in $devices; do case $device in loop*) # skip loop device @@ -72,17 +91,23 @@ for hdname in $hdnamelist; do cat /sys/block/$hdname/device/uevent fi echo - # Get user choice - while true; do - echo -n "Do you want to install this image there? [y/n] " - read answer - if [ "$answer" = "y" -o "$answer" = "n" ]; then +done + +# Get user choice +while true; do + echo "Please select an install target or press n to exit ($hdnamelist ): " + read answer + if [ "$answer" = "n" ]; then + echo "Installation manually aborted." + exit 1 + fi + for hdname in $hdnamelist; do + if [ "$answer" = "$hdname" ]; then + TARGET_DEVICE_NAME=$answer break fi - echo "Please answer y or n" done - if [ "$answer" = "y" ]; then - TARGET_DEVICE_NAME=$hdname + if [ -n "$TARGET_DEVICE_NAME" ]; then break fi done @@ -112,13 +137,13 @@ if [ ! -b /dev/loop0 ] ; then fi mkdir -p /tmp -if [ ! -L /etc/mtab ]; then - cat /proc/mounts > /etc/mtab +if [ ! -L /etc/mtab ] && [ -e /proc/mounts ]; then + ln -sf /proc/mounts /etc/mtab fi -disk_size=$(parted ${device} unit mb print | grep Disk | cut -d" " -f 3 | sed -e "s/MB//") +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 @@ -141,11 +166,17 @@ swap_start=$((rootfs_end)) # 2) they are detected asynchronously (need rootwait) rootwait="" part_prefix="" -if [ ! "${device#mmcblk}" = "${device}" ]; then +if [ ! "${device#/dev/mmcblk}" = "${device}" ] || \ + [ ! "${device#/dev/nvme}" = "${device}" ]; then part_prefix="p" rootwait="rootwait" fi +# USB devices also require rootwait +if [ -n `readlink /dev/disk/by-id/usb* | grep $TARGET_DEVICE_NAME` ]; then + rootwait="rootwait" +fi + if [ $grub_version -eq 0 ] ; then bios_boot='' bootfs=${device}${part_prefix}1 @@ -183,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' @@ -191,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 @@ -211,13 +249,13 @@ echo "Copying rootfs files..." cp -a /src_root/* /tgt_root if [ -d /tgt_root/etc/ ] ; then if [ $grub_version -ne 0 ] ; then - boot_uuid=$(blkid -o value -s UUID ${device}2) - swap_part_uuid=$(blkid -o value -s PARTUUID ${device}4) + boot_uuid=$(blkid -o value -s UUID ${bootfs}) + swap_part_uuid=$(blkid -o value -s PARTUUID ${swap}) bootdev="UUID=$boot_uuid" swapdev=/dev/disk/by-partuuid/$swap_part_uuid else - bootdev=${device}2 - swapdev=${device}4 + bootdev=${bootfs} + swapdev=${swap} fi echo "$swapdev swap swap defaults 0 0" >> /tgt_root/etc/fstab echo "$bootdev /boot ext3 defaults 1 2" >> /tgt_root/etc/fstab @@ -229,19 +267,46 @@ 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 ${device}3) - boot_uuid=$(blkid -o value -s UUID ${device}2) + root_part_uuid=$(blkid -o value -s PARTUUID ${rootfs}) + boot_uuid=$(blkid -o value -s UUID ${bootfs}) 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 @@ -255,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 d852c5737f..b20660b60a 100644..100755 --- a/meta/recipes-core/initrdscripts/files/init-live.sh +++ b/meta/recipes-core/initrdscripts/files/init-live.sh @@ -2,7 +2,7 @@ PATH=/sbin:/bin:/usr/sbin:/usr/bin -ROOT_MOUNT="/rootfs/" +ROOT_MOUNT="/rootfs" ROOT_IMAGE="rootfs.img" MOUNT="/bin/mount" UMOUNT="/bin/umount" @@ -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 } @@ -80,7 +76,13 @@ read_args() { boot_live_root() { # Watches the udev event queue, and exits if all current events are handled udevadm settle --timeout=3 --quiet - killall "${_UDEV_DAEMON##*/}" 2>/dev/null + # Kills the current udev running processes, which survived after + # 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 @@ -89,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 @@ -169,8 +174,8 @@ mount_and_boot() { # determine which unification filesystem to use union_fs_type="" - if grep -q -w "overlayfs" /proc/filesystems; then - union_fs_type="overlayfs" + if grep -q -w "overlay" /proc/filesystems; then + union_fs_type="overlay" elif grep -q -w "aufs" /proc/filesystems; then union_fs_type="aufs" else @@ -179,14 +184,15 @@ mount_and_boot() { # make a union mount if possible case $union_fs_type in - "overlayfs") + "overlay") mkdir -p /rootfs.ro /rootfs.rw if ! mount -n --move $ROOT_MOUNT /rootfs.ro; then rm -rf /rootfs.ro /rootfs.rw fatal "Could not move rootfs mount point" else mount -t tmpfs -o rw,noatime,mode=755 tmpfs /rootfs.rw - mount -t overlayfs -o "lowerdir=/rootfs.ro,upperdir=/rootfs.rw" overlayfs $ROOT_MOUNT + mkdir -p /rootfs.rw/upperdir /rootfs.rw/work + mount -t overlay overlay -o "lowerdir=/rootfs.ro,upperdir=/rootfs.rw/upperdir,workdir=/rootfs.rw/work" $ROOT_MOUNT mkdir -p $ROOT_MOUNT/rootfs.ro $ROOT_MOUNT/rootfs.rw mount --move /rootfs.ro $ROOT_MOUNT/rootfs.ro mount --move /rootfs.rw $ROOT_MOUNT/rootfs.rw @@ -214,11 +220,7 @@ mount_and_boot() { boot_live_root } -case $label in - boot) - mount_and_boot - ;; - install|install-efi) +if [ "$label" != "boot" -a -f $label.sh ] ; then if [ -f /run/media/$i/$ISOLINUX/$ROOT_IMAGE ] ; then ./$label.sh $i/$ISOLINUX $ROOT_IMAGE $video_mode $vga_mode $console_params else @@ -226,10 +228,8 @@ case $label in fi # If we're getting here, we failed... - fatal "Installation image failed" - ;; - *) - # Not sure what boot label is provided. Try to boot to avoid locking up. - mount_and_boot - ;; -esac + fatal "Target $label failed" +fi + +mount_and_boot + diff --git a/meta/recipes-core/initrdscripts/initramfs-boot_1.0.bb b/meta/recipes-core/initrdscripts/initramfs-boot_1.0.bb index 7ae7969f5e..ab460ac797 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/finish b/meta/recipes-core/initrdscripts/initramfs-framework/finish index 325f47be40..717383ebac 100755 --- a/meta/recipes-core/initrdscripts/initramfs-framework/finish +++ b/meta/recipes-core/initrdscripts/initramfs-framework/finish @@ -8,26 +8,6 @@ finish_enabled() { finish_run() { if [ -n "$ROOTFS_DIR" ]; then - if [ -n "$bootparam_rootdelay" ]; then - debug "Sleeping for $rootdelay second(s) to wait root to settle..." - sleep $bootparam_rootdelay - fi - - if [ -n "$bootparam_root" ]; then - debug "No e2fs compatible filesystem has been mounted, mounting $bootparam_root..." - - if [ "`echo ${bootparam_root} | cut -c1-5`" = "UUID=" ]; then - root_uuid=`echo $bootparam_root | cut -c6-` - bootparam_root="/dev/disk/by-uuid/$root_uuid" - fi - - if [ -e "$bootparam_root" ]; then - mount $bootparam_root $ROOTFS_DIR - else - debug "root '$bootparam_root' doesn't exist." - fi - fi - if [ ! -d $ROOTFS_DIR/dev ]; then fatal "ERROR: There's no '/dev' on rootfs." fi @@ -40,7 +20,7 @@ finish_run() { mount --move /sys $ROOTFS_DIR/sys cd $ROOTFS_DIR - exec switch_root -c /dev/console $ROOTFS_DIR /sbin/init + exec switch_root -c /dev/console $ROOTFS_DIR ${bootparam_init:-/sbin/init} else debug "No rootfs has been set" fi diff --git a/meta/recipes-core/initrdscripts/initramfs-framework/init b/meta/recipes-core/initrdscripts/initramfs-framework/init index e8f4713b52..567694aff7 100755 --- a/meta/recipes-core/initrdscripts/initramfs-framework/init +++ b/meta/recipes-core/initrdscripts/initramfs-framework/init @@ -58,9 +58,13 @@ fatal() { echo $1 >/dev/console echo >/dev/console + if [ -n "$bootparam_init_fatal_sh" ]; then + sh + else while [ "true" ]; do sleep 3600 done + fi } # Variables shared amoung modules @@ -68,23 +72,41 @@ 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 -# initialize /proc, /sys and /var/lock -mkdir -p /proc /sys /var/lock +# initialize /proc, /sys, /run/lock and /var/lock +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 + if [ -n "$quoted" ]; then + value="$value $p" + if [ "`echo $p | sed -e 's/\"$//'`" != "$p" ]; then + eval "bootparam_${quoted}=${value}" + unset quoted + fi + continue + fi + 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 value="`echo $p | cut -d'=' -f2-`" + if [ "`echo $value | sed -e 's/^\"//'`" != "$value" ]; then + quoted=${opt} + continue + fi eval "bootparam_${opt}=\"${value}\"" fi done 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 new file mode 100644 index 0000000000..e0efbe6ebe --- /dev/null +++ b/meta/recipes-core/initrdscripts/initramfs-framework/rootfs @@ -0,0 +1,66 @@ +#!/bin/sh +# Copyright (C) 2011 O.S. Systems Software LTDA. +# Licensed on MIT + +rootfs_enabled() { + return 0 +} + +rootfs_run() { + if [ -z "$ROOTFS_DIR" ]; then + return + fi + C=0 + delay=${bootparam_rootdelay:-1} + timeout=${bootparam_roottimeout:-5} + while ! mountpoint -q $ROOTFS_DIR; do + if [ $(( $C * $delay )) -gt $timeout ]; then + fatal "root '$bootparam_root' doesn't exist or does not contain a /dev." + fi + + if [ -n "$bootparam_root" ]; then + debug "No e2fs compatible filesystem has been mounted, mounting $bootparam_root..." + + if [ "`echo ${bootparam_root} | cut -c1-5`" = "UUID=" ]; then + root_uuid=`echo $bootparam_root | cut -c6-` + bootparam_root="/dev/disk/by-uuid/$root_uuid" + elif [ "`echo ${bootparam_root} | cut -c1-9`" = "PARTUUID=" ]; then + root_partuuid=`echo $bootparam_root | cut -c10-` + bootparam_root="/dev/disk/by-partuuid/$root_partuuid" + elif [ "`echo ${bootparam_root} | cut -c1-10`" = "PARTLABEL=" ]; then + root_partlabel=`echo $bootparam_root | cut -c11-` + bootparam_root="/dev/disk/by-partlabel/$root_partlabel" + elif [ "`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 + flags="" + 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 + if [ -n "$bootparam_rootfstype" ]; then + flags="$flags -t$bootparam_rootfstype" + fi + mount $flags $bootparam_root $ROOTFS_DIR + if mountpoint -q $ROOTFS_DIR; then + break + else + # It is unlikely to change, but keep trying anyway. + # Perhaps we pick a different device next time. + umount $ROOTFS_DIR + fi + fi + fi + debug "Sleeping for $delay second(s) to wait root to settle..." + sleep $delay + C=$(( $C + 1 )) + done +} 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..7e92f93322 --- /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 bb462dc448..4898b89246 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 } @@ -38,6 +39,10 @@ udev_run() { add_module_pre_hook "udev_shutdown_hook_handler" mkdir -p /run + mkdir -p /var/run + + # Workaround if console=null, systemd-udevd needs valid stdin, stdout and stderr to work + sh -c "exec 4< /dev/console" || { exec 0> /dev/null; exec 1> /dev/null; exec 2> /dev/null; } $_UDEV_DAEMON --daemon udevadm trigger --action=add diff --git a/meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb b/meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb index 6c37b9aef6..9e8c1dc3ab 100644 --- a/meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb +++ b/meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb @@ -1,18 +1,24 @@ SUMMARY = "Modular initramfs system" LICENSE = "MIT" LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" -RDEPENDS_${PN} += "busybox" +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}" @@ -21,8 +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 @@ -35,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 @@ -42,25 +56,54 @@ do_install() { } PACKAGES = "${PN}-base \ + initramfs-module-exec \ initramfs-module-mdev \ initramfs-module-udev \ initramfs-module-e2fs \ - initramfs-module-debug" - -FILES_${PN}-base = "/init /init.d/99-finish /dev" - -SUMMARY_initramfs-module-mdev = "initramfs support for mdev" -RDEPENDS_initramfs-module-mdev = "${PN}-base" -FILES_initramfs-module-mdev = "/init.d/01-mdev" - -SUMMARY_initramfs-module-udev = "initramfs support for udev" -RDEPENDS_initramfs-module-udev = "${PN}-base udev" -FILES_initramfs-module-udev = "/init.d/01-udev" - -SUMMARY_initramfs-module-e2fs = "initramfs support for ext4/ext3/ext2 filesystems" -RDEPENDS_initramfs-module-e2fs = "${PN}-base" -FILES_initramfs-module-e2fs = "/init.d/10-e2fs" - -SUMMARY_initramfs-module-debug = "initramfs dynamic debug support" -RDEPENDS_initramfs-module-debug = "${PN}-base" -FILES_initramfs-module-debug = "/init.d/00-debug" + initramfs-module-nfsrootfs \ + initramfs-module-rootfs \ + initramfs-module-debug \ + initramfs-module-lvm \ + " + +FILES:${PN}-base = "/init /init.d/99-finish /dev" + +# 99-finish in base depends on some other module which mounts +# the rootfs, like 90-rootfs. To replace that default, use +# BAD_RECOMMENDATIONS += "initramfs-module-rootfs" in your +# initramfs recipe and install something else, or install +# something that runs earlier (for example, a 89-my-rootfs) +# 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" + +SUMMARY:initramfs-module-udev = "initramfs support for udev" +RDEPENDS:initramfs-module-udev = "${PN}-base udev" +FILES:initramfs-module-udev = "/init.d/01-udev" + +SUMMARY:initramfs-module-e2fs = "initramfs support for ext4/ext3/ext2 filesystems" +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" + +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..59a530506a --- /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-boot_1.0.bb b/meta/recipes-core/initrdscripts/initramfs-live-boot_1.0.bb index 57b30254a6..8f56d7ab90 100644 --- a/meta/recipes-core/initrdscripts/initramfs-live-boot_1.0.bb +++ b/meta/recipes-core/initrdscripts/initramfs-live-boot_1.0.bb @@ -2,7 +2,7 @@ SUMMARY = "Live image init script" LICENSE = "MIT" LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" DEPENDS = "virtual/kernel" -RDEPENDS_${PN} = "udev udev-extraconf" +RDEPENDS:${PN} = "udev udev-extraconf" SRC_URI = "file://init-live.sh" PR = "r12" @@ -15,7 +15,7 @@ do_install() { mknod -m 622 ${D}/dev/console c 5 1 } -FILES_${PN} += " /init /dev " +FILES:${PN} += " /init /dev " # Due to kernel dependency PACKAGE_ARCH = "${MACHINE_ARCH}" diff --git a/meta/recipes-core/initrdscripts/initramfs-live-install-efi-testfs_1.0.bb b/meta/recipes-core/initrdscripts/initramfs-live-install-efi-testfs_1.0.bb index c03bd2d765..495eccbeda 100644 --- a/meta/recipes-core/initrdscripts/initramfs-live-install-efi-testfs_1.0.bb +++ b/meta/recipes-core/initrdscripts/initramfs-live-install-efi-testfs_1.0.bb @@ -3,7 +3,7 @@ LICENSE = "MIT" LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" SRC_URI = "file://init-install-efi-testfs.sh" -RDEPENDS_${PN} = "parted e2fsprogs-mke2fs dosfstools" +RDEPENDS:${PN} = "parted e2fsprogs-mke2fs dosfstools" S = "${WORKDIR}" @@ -12,5 +12,5 @@ do_install() { } INHIBIT_DEFAULT_DEPS = "1" -FILES_${PN} = " /install-efi.sh " +FILES:${PN} = " /install-efi.sh " COMPATIBLE_HOST = "(i.86|x86_64).*-linux" 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..ecbd567d6c 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}" @@ -19,6 +20,6 @@ do_install() { #inherit allarch INHIBIT_DEFAULT_DEPS = "1" -FILES_${PN} = " /install-efi.sh " +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-testfs_1.0.bb b/meta/recipes-core/initrdscripts/initramfs-live-install-testfs_1.0.bb index 937bfd4d38..d347e323b3 100644 --- a/meta/recipes-core/initrdscripts/initramfs-live-install-testfs_1.0.bb +++ b/meta/recipes-core/initrdscripts/initramfs-live-install-testfs_1.0.bb @@ -3,7 +3,7 @@ LICENSE = "MIT" LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" SRC_URI = "file://init-install-testfs.sh" -RDEPENDS_${PN} = "grub parted e2fsprogs-mke2fs" +RDEPENDS:${PN} = "grub parted e2fsprogs-mke2fs" S = "${WORKDIR}" @@ -12,5 +12,5 @@ do_install() { } INHIBIT_DEFAULT_DEPS = "1" -FILES_${PN} = " /install.sh " +FILES:${PN} = " /install.sh " COMPATIBLE_HOST = "(i.86|x86_64).*-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..674d49ecdf 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 @@ -19,6 +20,6 @@ do_install() { #inherit allarch INHIBIT_DEFAULT_DEPS = "1" -FILES_${PN} = " /install.sh " +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..fb19484555 --- /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..4d48d54e9e --- /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..d8ce024b83 --- /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" |