diff options
Diffstat (limited to 'meta/recipes-core/initrdscripts/files/init-install-efi.sh')
-rw-r--r-- | meta/recipes-core/initrdscripts/files/init-install-efi.sh | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/meta/recipes-core/initrdscripts/files/init-install-efi.sh b/meta/recipes-core/initrdscripts/files/init-install-efi.sh index dca1432e40..74372b0c96 100644 --- a/meta/recipes-core/initrdscripts/files/init-install-efi.sh +++ b/meta/recipes-core/initrdscripts/files/init-install-efi.sh | |||
@@ -83,7 +83,7 @@ else | |||
83 | exit 1 | 83 | exit 1 |
84 | fi | 84 | fi |
85 | 85 | ||
86 | device=$TARGET_DEVICE_NAME | 86 | device=/dev/$TARGET_DEVICE_NAME |
87 | 87 | ||
88 | # | 88 | # |
89 | # The udev automounter can cause pain here, kill it | 89 | # The udev automounter can cause pain here, kill it |
@@ -94,12 +94,12 @@ rm -f /etc/udev/scripts/mount* | |||
94 | # | 94 | # |
95 | # Unmount anything the automounter had mounted | 95 | # Unmount anything the automounter had mounted |
96 | # | 96 | # |
97 | umount /dev/${device}* 2> /dev/null || /bin/true | 97 | umount ${device}* 2> /dev/null || /bin/true |
98 | 98 | ||
99 | mkdir -p /tmp | 99 | mkdir -p /tmp |
100 | cat /proc/mounts > /etc/mtab | 100 | cat /proc/mounts > /etc/mtab |
101 | 101 | ||
102 | disk_size=$(parted /dev/${device} unit mb print | grep Disk | cut -d" " -f 3 | sed -e "s/MB//") | 102 | disk_size=$(parted ${device} unit mb print | grep Disk | cut -d" " -f 3 | sed -e "s/MB//") |
103 | 103 | ||
104 | swap_size=$((disk_size*swap_ratio/100)) | 104 | swap_size=$((disk_size*swap_ratio/100)) |
105 | rootfs_size=$((disk_size-boot_size-swap_size)) | 105 | rootfs_size=$((disk_size-boot_size-swap_size)) |
@@ -117,32 +117,32 @@ if [ ! "${device#mmcblk}" = "${device}" ]; then | |||
117 | part_prefix="p" | 117 | part_prefix="p" |
118 | rootwait="rootwait" | 118 | rootwait="rootwait" |
119 | fi | 119 | fi |
120 | bootfs=/dev/${device}${part_prefix}1 | 120 | bootfs=${device}${part_prefix}1 |
121 | rootfs=/dev/${device}${part_prefix}2 | 121 | rootfs=${device}${part_prefix}2 |
122 | swap=/dev/${device}${part_prefix}3 | 122 | swap=${device}${part_prefix}3 |
123 | 123 | ||
124 | echo "*****************" | 124 | echo "*****************" |
125 | echo "Boot partition size: $boot_size MB ($bootfs)" | 125 | echo "Boot partition size: $boot_size MB ($bootfs)" |
126 | echo "Rootfs partition size: $rootfs_size MB ($rootfs)" | 126 | echo "Rootfs partition size: $rootfs_size MB ($rootfs)" |
127 | echo "Swap partition size: $swap_size MB ($swap)" | 127 | echo "Swap partition size: $swap_size MB ($swap)" |
128 | echo "*****************" | 128 | echo "*****************" |
129 | echo "Deleting partition table on /dev/${device} ..." | 129 | echo "Deleting partition table on ${device} ..." |
130 | dd if=/dev/zero of=/dev/${device} bs=512 count=2 | 130 | dd if=/dev/zero of=${device} bs=512 count=2 |
131 | 131 | ||
132 | echo "Creating new partition table on /dev/${device} ..." | 132 | echo "Creating new partition table on ${device} ..." |
133 | parted /dev/${device} mklabel gpt | 133 | parted ${device} mklabel gpt |
134 | 134 | ||
135 | echo "Creating boot partition on $bootfs" | 135 | echo "Creating boot partition on $bootfs" |
136 | parted /dev/${device} mkpart boot fat32 0% $boot_size | 136 | parted ${device} mkpart boot fat32 0% $boot_size |
137 | parted /dev/${device} set 1 boot on | 137 | parted ${device} set 1 boot on |
138 | 138 | ||
139 | echo "Creating rootfs partition on $rootfs" | 139 | echo "Creating rootfs partition on $rootfs" |
140 | parted /dev/${device} mkpart root ext3 $rootfs_start $rootfs_end | 140 | parted ${device} mkpart root ext3 $rootfs_start $rootfs_end |
141 | 141 | ||
142 | echo "Creating swap partition on $swap" | 142 | echo "Creating swap partition on $swap" |
143 | parted /dev/${device} mkpart swap linux-swap $swap_start 100% | 143 | parted ${device} mkpart swap linux-swap $swap_start 100% |
144 | 144 | ||
145 | parted /dev/${device} print | 145 | parted ${device} print |
146 | 146 | ||
147 | echo "Formatting $bootfs to vfat..." | 147 | echo "Formatting $bootfs to vfat..." |
148 | mkfs.vfat $bootfs | 148 | mkfs.vfat $bootfs |
@@ -163,13 +163,13 @@ mount -o rw,loop,noatime,nodiratime /run/media/$1/$2 /src_root | |||
163 | echo "Copying rootfs files..." | 163 | echo "Copying rootfs files..." |
164 | cp -a /src_root/* /tgt_root | 164 | cp -a /src_root/* /tgt_root |
165 | if [ -d /tgt_root/etc/ ] ; then | 165 | if [ -d /tgt_root/etc/ ] ; then |
166 | boot_uuid=$(blkid -o value -s UUID /dev/${device}1) | 166 | boot_uuid=$(blkid -o value -s UUID ${device}1) |
167 | swap_part_uuid=$(blkid -o value -s PARTUUID /dev/${device}3) | 167 | swap_part_uuid=$(blkid -o value -s PARTUUID ${device}3) |
168 | echo "/dev/disk/by-partuuid/$swap_part_uuid swap swap defaults 0 0" >> /tgt_root/etc/fstab | 168 | echo "/dev/disk/by-partuuid/$swap_part_uuid swap swap defaults 0 0" >> /tgt_root/etc/fstab |
169 | echo "UUID=$boot_uuid /boot vfat defaults 1 2" >> /tgt_root/etc/fstab | 169 | echo "UUID=$boot_uuid /boot vfat defaults 1 2" >> /tgt_root/etc/fstab |
170 | # We dont want udev to mount our root device while we're booting... | 170 | # We dont want udev to mount our root device while we're booting... |
171 | if [ -d /tgt_root/etc/udev/ ] ; then | 171 | if [ -d /tgt_root/etc/udev/ ] ; then |
172 | echo "/dev/${device}" >> /tgt_root/etc/udev/mount.blacklist | 172 | echo "${device}" >> /tgt_root/etc/udev/mount.blacklist |
173 | fi | 173 | fi |
174 | fi | 174 | fi |
175 | 175 | ||
@@ -185,7 +185,7 @@ mkdir -p $EFIDIR | |||
185 | cp /run/media/$1/EFI/BOOT/*.efi $EFIDIR | 185 | cp /run/media/$1/EFI/BOOT/*.efi $EFIDIR |
186 | 186 | ||
187 | if [ -f /run/media/$1/EFI/BOOT/grub.cfg ]; then | 187 | if [ -f /run/media/$1/EFI/BOOT/grub.cfg ]; then |
188 | root_part_uuid=$(blkid -o value -s PARTUUID /dev/${device}2) | 188 | root_part_uuid=$(blkid -o value -s PARTUUID ${device}2) |
189 | GRUBCFG="$EFIDIR/grub.cfg" | 189 | GRUBCFG="$EFIDIR/grub.cfg" |
190 | cp /run/media/$1/EFI/BOOT/grub.cfg $GRUBCFG | 190 | cp /run/media/$1/EFI/BOOT/grub.cfg $GRUBCFG |
191 | # Update grub config for the installed image | 191 | # Update grub config for the installed image |