diff options
Diffstat (limited to 'meta/recipes-core/initrdscripts')
19 files changed, 1582 insertions, 0 deletions
diff --git a/meta/recipes-core/initrdscripts/files/init-boot.sh b/meta/recipes-core/initrdscripts/files/init-boot.sh new file mode 100644 index 0000000000..e82eba025d --- /dev/null +++ b/meta/recipes-core/initrdscripts/files/init-boot.sh | |||
@@ -0,0 +1,10 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | PATH=/sbin:/bin:/usr/sbin:/usr/bin | ||
4 | |||
5 | mkdir /proc | ||
6 | mkdir /sys | ||
7 | mount -t proc proc /proc | ||
8 | mount -t sysfs sysfs /sys | ||
9 | |||
10 | exec sh | ||
diff --git a/meta/recipes-core/initrdscripts/files/init-install-efi-testfs.sh b/meta/recipes-core/initrdscripts/files/init-install-efi-testfs.sh new file mode 100644 index 0000000000..2fea7610f9 --- /dev/null +++ b/meta/recipes-core/initrdscripts/files/init-install-efi-testfs.sh | |||
@@ -0,0 +1,199 @@ | |||
1 | #!/bin/sh -e | ||
2 | # | ||
3 | # Copyright (c) 2012, Intel Corporation. | ||
4 | # All rights reserved. | ||
5 | # | ||
6 | # install.sh [device_name] [rootfs_name] | ||
7 | # | ||
8 | |||
9 | PATH=/sbin:/bin:/usr/sbin:/usr/bin | ||
10 | |||
11 | # We need 200 Mb for the boot partition | ||
12 | boot_size=200 | ||
13 | |||
14 | # 50% for the second rootfs | ||
15 | testfs_ratio=50 | ||
16 | |||
17 | found="no" | ||
18 | |||
19 | echo "Searching for a hard drive..." | ||
20 | for device in 'hda' 'hdb' 'sda' 'sdb' 'mmcblk0' 'mmcblk1' | ||
21 | do | ||
22 | if [ -e /sys/block/${device}/removable ]; then | ||
23 | if [ "$(cat /sys/block/${device}/removable)" = "0" ]; then | ||
24 | found="yes" | ||
25 | |||
26 | while true; do | ||
27 | # Try sleeping here to avoid getting kernel messages | ||
28 | # obscuring/confusing user | ||
29 | sleep 5 | ||
30 | echo "Found drive at /dev/${device}. Do you want to install this image there ? [y/n]" | ||
31 | read answer | ||
32 | if [ "$answer" = "y" ] ; then | ||
33 | break | ||
34 | fi | ||
35 | |||
36 | if [ "$answer" = "n" ] ; then | ||
37 | found=no | ||
38 | break | ||
39 | fi | ||
40 | |||
41 | echo "Please answer y or n" | ||
42 | done | ||
43 | fi | ||
44 | fi | ||
45 | |||
46 | if [ "$found" = "yes" ]; then | ||
47 | break; | ||
48 | fi | ||
49 | |||
50 | done | ||
51 | |||
52 | if [ "$found" = "no" ]; then | ||
53 | exit 1 | ||
54 | fi | ||
55 | |||
56 | echo "Installing image on /dev/${device}" | ||
57 | |||
58 | # | ||
59 | # The udev automounter can cause pain here, kill it | ||
60 | # | ||
61 | rm -f /etc/udev/rules.d/automount.rules | ||
62 | rm -f /etc/udev/scripts/mount* | ||
63 | |||
64 | # | ||
65 | # Unmount anything the automounter had mounted | ||
66 | # | ||
67 | umount /dev/${device}* 2> /dev/null || /bin/true | ||
68 | |||
69 | mkdir -p /tmp | ||
70 | cat /proc/mounts > /etc/mtab | ||
71 | |||
72 | disk_size=$(parted /dev/${device} unit mb print | grep Disk | cut -d" " -f 3 | sed -e "s/MB//") | ||
73 | |||
74 | testfs_size=$((disk_size*testfs_ratio/100)) | ||
75 | rootfs_size=$((disk_size-boot_size-testfs_size)) | ||
76 | |||
77 | rootfs_start=$((boot_size)) | ||
78 | rootfs_end=$((rootfs_start+rootfs_size)) | ||
79 | testfs_start=$((rootfs_end)) | ||
80 | |||
81 | # MMC devices are special in a couple of ways | ||
82 | # 1) they use a partition prefix character 'p' | ||
83 | # 2) they are detected asynchronously (need rootwait) | ||
84 | rootwait="" | ||
85 | part_prefix="" | ||
86 | if [ ! "${device#mmcblk}" = "${device}" ]; then | ||
87 | part_prefix="p" | ||
88 | rootwait="rootwait" | ||
89 | fi | ||
90 | bootfs=/dev/${device}${part_prefix}1 | ||
91 | rootfs=/dev/${device}${part_prefix}2 | ||
92 | testfs=/dev/${device}${part_prefix}3 | ||
93 | |||
94 | echo "*****************" | ||
95 | echo "Boot partition size: $boot_size MB ($bootfs)" | ||
96 | echo "Rootfs partition size: $rootfs_size MB ($rootfs)" | ||
97 | echo "Testfs partition size: $testfs_size MB ($testfs)" | ||
98 | echo "*****************" | ||
99 | echo "Deleting partition table on /dev/${device} ..." | ||
100 | dd if=/dev/zero of=/dev/${device} bs=512 count=2 | ||
101 | |||
102 | echo "Creating new partition table on /dev/${device} ..." | ||
103 | parted /dev/${device} mklabel gpt | ||
104 | |||
105 | echo "Creating boot partition on $bootfs" | ||
106 | parted /dev/${device} mkpart primary 0% $boot_size | ||
107 | parted /dev/${device} set 1 boot on | ||
108 | |||
109 | echo "Creating rootfs partition on $rootfs" | ||
110 | parted /dev/${device} mkpart primary $rootfs_start $rootfs_end | ||
111 | |||
112 | echo "Creating testfs partition on $testfs" | ||
113 | parted /dev/${device} mkpart primary $testfs_start 100% | ||
114 | |||
115 | parted /dev/${device} print | ||
116 | |||
117 | echo "Formatting $bootfs to vfat..." | ||
118 | mkfs.vfat -n "boot" $bootfs | ||
119 | |||
120 | echo "Formatting $rootfs to ext3..." | ||
121 | mkfs.ext3 -L "platform" $rootfs | ||
122 | |||
123 | echo "Formatting $testfs to ext3..." | ||
124 | mkfs.ext3 -L "testrootfs" $testfs | ||
125 | |||
126 | mkdir /ssd | ||
127 | mkdir /rootmnt | ||
128 | mkdir /bootmnt | ||
129 | |||
130 | mount $rootfs /ssd | ||
131 | mount -o rw,loop,noatime,nodiratime /media/$1/$2 /rootmnt | ||
132 | |||
133 | echo "Copying rootfs files..." | ||
134 | cp -a /rootmnt/* /ssd | ||
135 | |||
136 | touch /ssd/etc/masterimage | ||
137 | |||
138 | if [ -d /ssd/etc/ ] ; then | ||
139 | # We dont want udev to mount our root device while we're booting... | ||
140 | if [ -d /ssd/etc/udev/ ] ; then | ||
141 | echo "/dev/${device}" >> /ssd/etc/udev/mount.blacklist | ||
142 | fi | ||
143 | fi | ||
144 | |||
145 | umount /ssd | ||
146 | umount /rootmnt | ||
147 | |||
148 | echo "Preparing boot partition..." | ||
149 | mount $bootfs /ssd | ||
150 | |||
151 | EFIDIR="/ssd/EFI/BOOT" | ||
152 | mkdir -p $EFIDIR | ||
153 | cp /media/$1/vmlinuz /ssd | ||
154 | # Copy the efi loader | ||
155 | cp /media/$1/EFI/BOOT/*.efi $EFIDIR | ||
156 | |||
157 | if [ -f /media/$1/EFI/BOOT/grub.cfg ]; then | ||
158 | GRUBCFG="$EFIDIR/grub.cfg" | ||
159 | cp /media/$1/EFI/BOOT/grub.cfg $GRUBCFG | ||
160 | # Update grub config for the installed image | ||
161 | # Delete the install entry | ||
162 | sed -i "/menuentry 'install'/,/^}/d" $GRUBCFG | ||
163 | # Delete the initrd lines | ||
164 | sed -i "/initrd /d" $GRUBCFG | ||
165 | # Delete any LABEL= strings | ||
166 | sed -i "s/ LABEL=[^ ]*/ /" $GRUBCFG | ||
167 | # Delete any root= strings | ||
168 | sed -i "s/ root=[^ ]*/ /" $GRUBCFG | ||
169 | # Add the root= and other standard boot options | ||
170 | sed -i "s@linux /vmlinuz *@linux /vmlinuz root=$rootfs rw $rootwait quiet @" $GRUBCFG | ||
171 | fi | ||
172 | |||
173 | if [ -d /media/$1/loader ]; then | ||
174 | GUMMIBOOT_CFGS="/ssd/loader/entries/*.conf" | ||
175 | # copy config files for gummiboot | ||
176 | cp -dr /media/$1/loader /ssd | ||
177 | # delete the install entry | ||
178 | rm -f /ssd/loader/entries/install.conf | ||
179 | # delete the initrd lines | ||
180 | sed -i "/initrd /d" $GUMMIBOOT_CFGS | ||
181 | # delete any LABEL= strings | ||
182 | sed -i "s/ LABEL=[^ ]*/ /" $GUMMIBOOT_CFGS | ||
183 | # delete any root= strings | ||
184 | sed -i "s/ root=[^ ]*/ /" $GUMMIBOOT_CFGS | ||
185 | # add the root= and other standard boot options | ||
186 | sed -i "s@options *@options root=$rootfs rw $rootwait quiet @" $GUMMIBOOT_CFGS | ||
187 | # Add the test label | ||
188 | echo -ne "title test\nlinux /test-kernel\noptions root=$testfs rw $rootwait quiet\n" > /ssd/loader/entries/test.conf | ||
189 | fi | ||
190 | |||
191 | umount /ssd | ||
192 | sync | ||
193 | |||
194 | echo "Remove your installation media, and press ENTER" | ||
195 | |||
196 | read enter | ||
197 | |||
198 | echo "Rebooting..." | ||
199 | reboot -f | ||
diff --git a/meta/recipes-core/initrdscripts/files/init-install-efi.sh b/meta/recipes-core/initrdscripts/files/init-install-efi.sh new file mode 100644 index 0000000000..ed3221b0a6 --- /dev/null +++ b/meta/recipes-core/initrdscripts/files/init-install-efi.sh | |||
@@ -0,0 +1,197 @@ | |||
1 | #!/bin/sh -e | ||
2 | # | ||
3 | # Copyright (c) 2012, Intel Corporation. | ||
4 | # All rights reserved. | ||
5 | # | ||
6 | # install.sh [device_name] [rootfs_name] | ||
7 | # | ||
8 | |||
9 | PATH=/sbin:/bin:/usr/sbin:/usr/bin | ||
10 | |||
11 | # We need 20 Mb for the boot partition | ||
12 | boot_size=20 | ||
13 | |||
14 | # 5% for swap | ||
15 | swap_ratio=5 | ||
16 | |||
17 | found="no" | ||
18 | |||
19 | echo "Searching for a hard drive..." | ||
20 | for device in 'hda' 'hdb' 'sda' 'sdb' 'mmcblk0' 'mmcblk1' | ||
21 | do | ||
22 | if [ -e /sys/block/${device}/removable ]; then | ||
23 | if [ "$(cat /sys/block/${device}/removable)" = "0" ]; then | ||
24 | found="yes" | ||
25 | |||
26 | while true; do | ||
27 | # Try sleeping here to avoid getting kernel messages | ||
28 | # obscuring/confusing user | ||
29 | sleep 5 | ||
30 | echo "Found drive at /dev/${device}. Do you want to install this image there ? [y/n]" | ||
31 | read answer | ||
32 | if [ "$answer" = "y" ] ; then | ||
33 | break | ||
34 | fi | ||
35 | |||
36 | if [ "$answer" = "n" ] ; then | ||
37 | found=no | ||
38 | break | ||
39 | fi | ||
40 | |||
41 | echo "Please answer y or n" | ||
42 | done | ||
43 | fi | ||
44 | fi | ||
45 | |||
46 | if [ "$found" = "yes" ]; then | ||
47 | break; | ||
48 | fi | ||
49 | |||
50 | done | ||
51 | |||
52 | if [ "$found" = "no" ]; then | ||
53 | exit 1 | ||
54 | fi | ||
55 | |||
56 | echo "Installing image on /dev/${device}" | ||
57 | |||
58 | # | ||
59 | # The udev automounter can cause pain here, kill it | ||
60 | # | ||
61 | rm -f /etc/udev/rules.d/automount.rules | ||
62 | rm -f /etc/udev/scripts/mount* | ||
63 | |||
64 | # | ||
65 | # Unmount anything the automounter had mounted | ||
66 | # | ||
67 | umount /dev/${device}* 2> /dev/null || /bin/true | ||
68 | |||
69 | mkdir -p /tmp | ||
70 | cat /proc/mounts > /etc/mtab | ||
71 | |||
72 | disk_size=$(parted /dev/${device} unit mb print | grep Disk | cut -d" " -f 3 | sed -e "s/MB//") | ||
73 | |||
74 | swap_size=$((disk_size*swap_ratio/100)) | ||
75 | rootfs_size=$((disk_size-boot_size-swap_size)) | ||
76 | |||
77 | rootfs_start=$((boot_size)) | ||
78 | rootfs_end=$((rootfs_start+rootfs_size)) | ||
79 | swap_start=$((rootfs_end)) | ||
80 | |||
81 | # MMC devices are special in a couple of ways | ||
82 | # 1) they use a partition prefix character 'p' | ||
83 | # 2) they are detected asynchronously (need rootwait) | ||
84 | rootwait="" | ||
85 | part_prefix="" | ||
86 | if [ ! "${device#mmcblk}" = "${device}" ]; then | ||
87 | part_prefix="p" | ||
88 | rootwait="rootwait" | ||
89 | fi | ||
90 | bootfs=/dev/${device}${part_prefix}1 | ||
91 | rootfs=/dev/${device}${part_prefix}2 | ||
92 | swap=/dev/${device}${part_prefix}3 | ||
93 | |||
94 | echo "*****************" | ||
95 | echo "Boot partition size: $boot_size MB ($bootfs)" | ||
96 | echo "Rootfs partition size: $rootfs_size MB ($rootfs)" | ||
97 | echo "Swap partition size: $swap_size MB ($swap)" | ||
98 | echo "*****************" | ||
99 | echo "Deleting partition table on /dev/${device} ..." | ||
100 | dd if=/dev/zero of=/dev/${device} bs=512 count=2 | ||
101 | |||
102 | echo "Creating new partition table on /dev/${device} ..." | ||
103 | parted /dev/${device} mklabel gpt | ||
104 | |||
105 | echo "Creating boot partition on $bootfs" | ||
106 | parted /dev/${device} mkpart primary 0% $boot_size | ||
107 | parted /dev/${device} set 1 boot on | ||
108 | |||
109 | echo "Creating rootfs partition on $rootfs" | ||
110 | parted /dev/${device} mkpart primary $rootfs_start $rootfs_end | ||
111 | |||
112 | echo "Creating swap partition on $swap" | ||
113 | parted /dev/${device} mkpart primary $swap_start 100% | ||
114 | |||
115 | parted /dev/${device} print | ||
116 | |||
117 | echo "Formatting $bootfs to vfat..." | ||
118 | mkfs.vfat $bootfs | ||
119 | |||
120 | echo "Formatting $rootfs to ext3..." | ||
121 | mkfs.ext3 $rootfs | ||
122 | |||
123 | echo "Formatting swap partition...($swap)" | ||
124 | mkswap $swap | ||
125 | |||
126 | mkdir /ssd | ||
127 | mkdir /rootmnt | ||
128 | mkdir /bootmnt | ||
129 | |||
130 | mount $rootfs /ssd | ||
131 | mount -o rw,loop,noatime,nodiratime /media/$1/$2 /rootmnt | ||
132 | |||
133 | echo "Copying rootfs files..." | ||
134 | cp -a /rootmnt/* /ssd | ||
135 | |||
136 | if [ -d /ssd/etc/ ] ; then | ||
137 | echo "$swap swap swap defaults 0 0" >> /ssd/etc/fstab | ||
138 | |||
139 | # We dont want udev to mount our root device while we're booting... | ||
140 | if [ -d /ssd/etc/udev/ ] ; then | ||
141 | echo "/dev/${device}" >> /ssd/etc/udev/mount.blacklist | ||
142 | fi | ||
143 | fi | ||
144 | |||
145 | umount /ssd | ||
146 | umount /rootmnt | ||
147 | |||
148 | echo "Preparing boot partition..." | ||
149 | mount $bootfs /ssd | ||
150 | |||
151 | EFIDIR="/ssd/EFI/BOOT" | ||
152 | mkdir -p $EFIDIR | ||
153 | cp /media/$1/vmlinuz /ssd | ||
154 | # Copy the efi loader | ||
155 | cp /media/$1/EFI/BOOT/*.efi $EFIDIR | ||
156 | |||
157 | if [ -f /media/$1/EFI/BOOT/grub.cfg ]; then | ||
158 | GRUBCFG="$EFIDIR/grub.cfg" | ||
159 | cp /media/$1/EFI/BOOT/grub.cfg $GRUBCFG | ||
160 | # Update grub config for the installed image | ||
161 | # Delete the install entry | ||
162 | sed -i "/menuentry 'install'/,/^}/d" $GRUBCFG | ||
163 | # Delete the initrd lines | ||
164 | sed -i "/initrd /d" $GRUBCFG | ||
165 | # Delete any LABEL= strings | ||
166 | sed -i "s/ LABEL=[^ ]*/ /" $GRUBCFG | ||
167 | # Delete any root= strings | ||
168 | sed -i "s/ root=[^ ]*/ /" $GRUBCFG | ||
169 | # Add the root= and other standard boot options | ||
170 | sed -i "s@linux /vmlinuz *@linux /vmlinuz root=$rootfs rw $rootwait quiet @" $GRUBCFG | ||
171 | fi | ||
172 | |||
173 | if [ -d /media/$1/loader ]; then | ||
174 | GUMMIBOOT_CFGS="/ssd/loader/entries/*.conf" | ||
175 | # copy config files for gummiboot | ||
176 | cp -dr /media/$1/loader /ssd | ||
177 | # delete the install entry | ||
178 | rm -f /ssd/loader/entries/install.conf | ||
179 | # delete the initrd lines | ||
180 | sed -i "/initrd /d" $GUMMIBOOT_CFGS | ||
181 | # delete any LABEL= strings | ||
182 | sed -i "s/ LABEL=[^ ]*/ /" $GUMMIBOOT_CFGS | ||
183 | # delete any root= strings | ||
184 | sed -i "s/ root=[^ ]*/ /" $GUMMIBOOT_CFGS | ||
185 | # add the root= and other standard boot options | ||
186 | sed -i "s@options *@options root=$rootfs rw $rootwait quiet @" $GUMMIBOOT_CFGS | ||
187 | fi | ||
188 | |||
189 | umount /ssd | ||
190 | sync | ||
191 | |||
192 | echo "Remove your installation media, and press ENTER" | ||
193 | |||
194 | read enter | ||
195 | |||
196 | echo "Rebooting..." | ||
197 | reboot -f | ||
diff --git a/meta/recipes-core/initrdscripts/files/init-install-testfs.sh b/meta/recipes-core/initrdscripts/files/init-install-testfs.sh new file mode 100644 index 0000000000..d2f2420498 --- /dev/null +++ b/meta/recipes-core/initrdscripts/files/init-install-testfs.sh | |||
@@ -0,0 +1,211 @@ | |||
1 | #!/bin/sh -e | ||
2 | # | ||
3 | # Copyright (C) 2008-2011 Intel | ||
4 | # | ||
5 | # install.sh [device_name] [rootfs_name] [video_mode] [vga_mode] | ||
6 | # | ||
7 | |||
8 | PATH=/sbin:/bin:/usr/sbin:/usr/bin | ||
9 | |||
10 | # We need 20 Mb for the boot partition | ||
11 | boot_size=200 | ||
12 | |||
13 | # 50% for the the test partition | ||
14 | testfs_ratio=50 | ||
15 | |||
16 | # Get a list of hard drives | ||
17 | hdnamelist="" | ||
18 | live_dev_name=${1%%/*} | ||
19 | |||
20 | echo "Searching for hard drives ..." | ||
21 | |||
22 | for device in `ls /sys/block/`; do | ||
23 | case $device in | ||
24 | loop*) | ||
25 | # skip loop device | ||
26 | ;; | ||
27 | ram*) | ||
28 | # skip ram device | ||
29 | ;; | ||
30 | *) | ||
31 | # skip the device LiveOS is on | ||
32 | # Add valid hard drive name to the list | ||
33 | if [ $device != $live_dev_name -a -e /dev/$device ]; then | ||
34 | hdnamelist="$hdnamelist $device" | ||
35 | fi | ||
36 | ;; | ||
37 | esac | ||
38 | done | ||
39 | |||
40 | TARGET_DEVICE_NAME="" | ||
41 | for hdname in $hdnamelist; do | ||
42 | # Display found hard drives and their basic info | ||
43 | echo "-------------------------------" | ||
44 | echo /dev/$hdname | ||
45 | if [ -r /sys/block/$hdname/device/vendor ]; then | ||
46 | echo -n "VENDOR=" | ||
47 | cat /sys/block/$hdname/device/vendor | ||
48 | fi | ||
49 | echo -n "MODEL=" | ||
50 | cat /sys/block/$hdname/device/model | ||
51 | cat /sys/block/$hdname/device/uevent | ||
52 | echo | ||
53 | # Get user choice | ||
54 | while true; do | ||
55 | echo -n "Do you want to install this image there? [y/n] " | ||
56 | read answer | ||
57 | if [ "$answer" = "y" -o "$answer" = "n" ]; then | ||
58 | break | ||
59 | fi | ||
60 | echo "Please answer y or n" | ||
61 | done | ||
62 | if [ "$answer" = "y" ]; then | ||
63 | TARGET_DEVICE_NAME=$hdname | ||
64 | break | ||
65 | fi | ||
66 | done | ||
67 | |||
68 | if [ -n "$TARGET_DEVICE_NAME" ]; then | ||
69 | echo "Installing image on /dev/$TARGET_DEVICE_NAME ..." | ||
70 | else | ||
71 | echo "No hard drive selected. Installation aborted." | ||
72 | exit 1 | ||
73 | fi | ||
74 | |||
75 | device=$TARGET_DEVICE_NAME | ||
76 | |||
77 | # | ||
78 | # The udev automounter can cause pain here, kill it | ||
79 | # | ||
80 | rm -f /etc/udev/rules.d/automount.rules | ||
81 | rm -f /etc/udev/scripts/mount* | ||
82 | |||
83 | # | ||
84 | # Unmount anything the automounter had mounted | ||
85 | # | ||
86 | umount /dev/${device}* 2> /dev/null || /bin/true | ||
87 | |||
88 | if [ ! -b /dev/loop0 ] ; then | ||
89 | mknod /dev/loop0 b 7 0 | ||
90 | fi | ||
91 | |||
92 | mkdir -p /tmp | ||
93 | cat /proc/mounts > /etc/mtab | ||
94 | |||
95 | disk_size=$(parted /dev/${device} unit mb print | grep Disk | cut -d" " -f 3 | sed -e "s/MB//") | ||
96 | |||
97 | testfs_size=$((disk_size*testfs_ratio/100)) | ||
98 | rootfs_size=$((disk_size-boot_size-testfs_size)) | ||
99 | |||
100 | rootfs_start=$((boot_size)) | ||
101 | rootfs_end=$((rootfs_start+rootfs_size)) | ||
102 | testfs_start=$((rootfs_end)) | ||
103 | |||
104 | # MMC devices are special in a couple of ways | ||
105 | # 1) they use a partition prefix character 'p' | ||
106 | # 2) they are detected asynchronously (need rootwait) | ||
107 | rootwait="" | ||
108 | part_prefix="" | ||
109 | if [ ! "${device#mmcblk}" = "${device}" ]; then | ||
110 | part_prefix="p" | ||
111 | rootwait="rootwait" | ||
112 | fi | ||
113 | bootfs=/dev/${device}${part_prefix}1 | ||
114 | rootfs=/dev/${device}${part_prefix}2 | ||
115 | testfs=/dev/${device}${part_prefix}3 | ||
116 | |||
117 | echo "*****************" | ||
118 | echo "Boot partition size: $boot_size MB ($bootfs)" | ||
119 | echo "Rootfs partition size: $rootfs_size MB ($rootfs)" | ||
120 | echo "Testfs partition size: $testfs_size MB ($testfs)" | ||
121 | echo "*****************" | ||
122 | echo "Deleting partition table on /dev/${device} ..." | ||
123 | dd if=/dev/zero of=/dev/${device} bs=512 count=2 | ||
124 | |||
125 | echo "Creating new partition table on /dev/${device} ..." | ||
126 | parted /dev/${device} mklabel msdos | ||
127 | |||
128 | echo "Creating boot partition on $bootfs" | ||
129 | parted /dev/${device} mkpart primary 0% $boot_size | ||
130 | |||
131 | echo "Creating rootfs partition on $rootfs" | ||
132 | parted /dev/${device} mkpart primary $rootfs_start $rootfs_end | ||
133 | |||
134 | echo "Creating testfs partition on $testfs" | ||
135 | parted /dev/${device} mkpart primary $testfs_start 100% | ||
136 | |||
137 | parted /dev/${device} print | ||
138 | |||
139 | echo "Formatting $bootfs to ext3..." | ||
140 | mkfs.ext3 -L "boot" $bootfs | ||
141 | |||
142 | echo "Formatting $rootfs to ext3..." | ||
143 | mkfs.ext3 -L "rootfs" $rootfs | ||
144 | |||
145 | echo "Formatting $testfs to ext3..." | ||
146 | mkfs.ext3 -L "testrootfs" $testfs | ||
147 | |||
148 | mkdir /tgt_root | ||
149 | mkdir /src_root | ||
150 | mkdir -p /boot | ||
151 | |||
152 | # Handling of the target root partition | ||
153 | mount $rootfs /tgt_root | ||
154 | mount -o rw,loop,noatime,nodiratime /media/$1/$2 /src_root | ||
155 | echo "Copying rootfs files..." | ||
156 | cp -a /src_root/* /tgt_root | ||
157 | if [ -d /tgt_root/etc/ ] ; then | ||
158 | echo "$bootfs /boot ext3 defaults 1 2" >> /tgt_root/etc/fstab | ||
159 | # We dont want udev to mount our root device while we're booting... | ||
160 | if [ -d /tgt_root/etc/udev/ ] ; then | ||
161 | echo "/dev/${device}" >> /tgt_root/etc/udev/mount.blacklist | ||
162 | fi | ||
163 | fi | ||
164 | umount /tgt_root | ||
165 | umount /src_root | ||
166 | |||
167 | # Handling of the target boot partition | ||
168 | mount $bootfs /boot | ||
169 | echo "Preparing boot partition..." | ||
170 | if [ -f /etc/grub.d/40_custom ] ; then | ||
171 | echo "Preparing custom grub2 menu..." | ||
172 | GRUBCFG="/boot/grub/grub.cfg" | ||
173 | mkdir -p $(dirname $GRUBCFG) | ||
174 | cp /etc/grub.d/40_custom $GRUBCFG | ||
175 | sed -i "s@__ROOTFS__@$rootfs $rootwait@g" $GRUBCFG | ||
176 | sed -i "s/__VIDEO_MODE__/$3/g" $GRUBCFG | ||
177 | sed -i "s/__VGA_MODE__/$4/g" $GRUBCFG | ||
178 | sed -i "s/__CONSOLE__/$5/g" $GRUBCFG | ||
179 | sed -i "/#/d" $GRUBCFG | ||
180 | sed -i "/exec tail/d" $GRUBCFG | ||
181 | |||
182 | # Add the test label | ||
183 | echo -ne "\nmenuentry 'test' {\nlinux /test-kernel root=$testfs rw $rootwait quiet\n}\n" >> $GRUBCFG | ||
184 | |||
185 | chmod 0444 $GRUBCFG | ||
186 | fi | ||
187 | grub-install /dev/${device} | ||
188 | echo "(hd0) /dev/${device}" > /boot/grub/device.map | ||
189 | |||
190 | # If grub.cfg doesn't exist, assume GRUB 0.97 and create a menu.lst | ||
191 | if [ ! -f /boot/grub/grub.cfg ] ; then | ||
192 | echo "Preparing custom grub menu..." | ||
193 | echo "default 0" > /boot/grub/menu.lst | ||
194 | echo "timeout 30" >> /boot/grub/menu.lst | ||
195 | echo "title Live Boot/Install-Image" >> /boot/grub/menu.lst | ||
196 | echo "root (hd0,0)" >> /boot/grub/menu.lst | ||
197 | echo "kernel /vmlinuz root=$rootfs rw $3 $4 quiet" >> /boot/grub/menu.lst | ||
198 | fi | ||
199 | |||
200 | cp /media/$1/vmlinuz /boot/ | ||
201 | |||
202 | umount /boot | ||
203 | |||
204 | sync | ||
205 | |||
206 | echo "Remove your installation media, and press ENTER" | ||
207 | |||
208 | read enter | ||
209 | |||
210 | echo "Rebooting..." | ||
211 | reboot -f | ||
diff --git a/meta/recipes-core/initrdscripts/files/init-install.sh b/meta/recipes-core/initrdscripts/files/init-install.sh new file mode 100644 index 0000000000..8e433d5eda --- /dev/null +++ b/meta/recipes-core/initrdscripts/files/init-install.sh | |||
@@ -0,0 +1,208 @@ | |||
1 | #!/bin/sh -e | ||
2 | # | ||
3 | # Copyright (C) 2008-2011 Intel | ||
4 | # | ||
5 | # install.sh [device_name] [rootfs_name] [video_mode] [vga_mode] | ||
6 | # | ||
7 | |||
8 | PATH=/sbin:/bin:/usr/sbin:/usr/bin | ||
9 | |||
10 | # We need 20 Mb for the boot partition | ||
11 | boot_size=20 | ||
12 | |||
13 | # 5% for the swap | ||
14 | swap_ratio=5 | ||
15 | |||
16 | # Get a list of hard drives | ||
17 | hdnamelist="" | ||
18 | live_dev_name=${1%%/*} | ||
19 | |||
20 | echo "Searching for hard drives ..." | ||
21 | |||
22 | for device in `ls /sys/block/`; do | ||
23 | case $device in | ||
24 | loop*) | ||
25 | # skip loop device | ||
26 | ;; | ||
27 | ram*) | ||
28 | # skip ram device | ||
29 | ;; | ||
30 | *) | ||
31 | # skip the device LiveOS is on | ||
32 | # Add valid hard drive name to the list | ||
33 | if [ $device != $live_dev_name -a -e /dev/$device ]; then | ||
34 | hdnamelist="$hdnamelist $device" | ||
35 | fi | ||
36 | ;; | ||
37 | esac | ||
38 | done | ||
39 | |||
40 | TARGET_DEVICE_NAME="" | ||
41 | for hdname in $hdnamelist; do | ||
42 | # Display found hard drives and their basic info | ||
43 | echo "-------------------------------" | ||
44 | echo /dev/$hdname | ||
45 | if [ -r /sys/block/$hdname/device/vendor ]; then | ||
46 | echo -n "VENDOR=" | ||
47 | cat /sys/block/$hdname/device/vendor | ||
48 | fi | ||
49 | echo -n "MODEL=" | ||
50 | cat /sys/block/$hdname/device/model | ||
51 | cat /sys/block/$hdname/device/uevent | ||
52 | echo | ||
53 | # Get user choice | ||
54 | while true; do | ||
55 | echo -n "Do you want to install this image there? [y/n] " | ||
56 | read answer | ||
57 | if [ "$answer" = "y" -o "$answer" = "n" ]; then | ||
58 | break | ||
59 | fi | ||
60 | echo "Please answer y or n" | ||
61 | done | ||
62 | if [ "$answer" = "y" ]; then | ||
63 | TARGET_DEVICE_NAME=$hdname | ||
64 | break | ||
65 | fi | ||
66 | done | ||
67 | |||
68 | if [ -n "$TARGET_DEVICE_NAME" ]; then | ||
69 | echo "Installing image on /dev/$TARGET_DEVICE_NAME ..." | ||
70 | else | ||
71 | echo "No hard drive selected. Installation aborted." | ||
72 | exit 1 | ||
73 | fi | ||
74 | |||
75 | device=$TARGET_DEVICE_NAME | ||
76 | |||
77 | # | ||
78 | # The udev automounter can cause pain here, kill it | ||
79 | # | ||
80 | rm -f /etc/udev/rules.d/automount.rules | ||
81 | rm -f /etc/udev/scripts/mount* | ||
82 | |||
83 | # | ||
84 | # Unmount anything the automounter had mounted | ||
85 | # | ||
86 | umount /dev/${device}* 2> /dev/null || /bin/true | ||
87 | |||
88 | if [ ! -b /dev/loop0 ] ; then | ||
89 | mknod /dev/loop0 b 7 0 | ||
90 | fi | ||
91 | |||
92 | mkdir -p /tmp | ||
93 | cat /proc/mounts > /etc/mtab | ||
94 | |||
95 | disk_size=$(parted /dev/${device} unit mb print | grep Disk | cut -d" " -f 3 | sed -e "s/MB//") | ||
96 | |||
97 | swap_size=$((disk_size*swap_ratio/100)) | ||
98 | rootfs_size=$((disk_size-boot_size-swap_size)) | ||
99 | |||
100 | rootfs_start=$((boot_size)) | ||
101 | rootfs_end=$((rootfs_start+rootfs_size)) | ||
102 | swap_start=$((rootfs_end)) | ||
103 | |||
104 | # MMC devices are special in a couple of ways | ||
105 | # 1) they use a partition prefix character 'p' | ||
106 | # 2) they are detected asynchronously (need rootwait) | ||
107 | rootwait="" | ||
108 | part_prefix="" | ||
109 | if [ ! "${device#mmcblk}" = "${device}" ]; then | ||
110 | part_prefix="p" | ||
111 | rootwait="rootwait" | ||
112 | fi | ||
113 | bootfs=/dev/${device}${part_prefix}1 | ||
114 | rootfs=/dev/${device}${part_prefix}2 | ||
115 | swap=/dev/${device}${part_prefix}3 | ||
116 | |||
117 | echo "*****************" | ||
118 | echo "Boot partition size: $boot_size MB ($bootfs)" | ||
119 | echo "Rootfs partition size: $rootfs_size MB ($rootfs)" | ||
120 | echo "Swap partition size: $swap_size MB ($swap)" | ||
121 | echo "*****************" | ||
122 | echo "Deleting partition table on /dev/${device} ..." | ||
123 | dd if=/dev/zero of=/dev/${device} bs=512 count=2 | ||
124 | |||
125 | echo "Creating new partition table on /dev/${device} ..." | ||
126 | parted /dev/${device} mklabel msdos | ||
127 | |||
128 | echo "Creating boot partition on $bootfs" | ||
129 | parted /dev/${device} mkpart primary 0% $boot_size | ||
130 | |||
131 | echo "Creating rootfs partition on $rootfs" | ||
132 | parted /dev/${device} mkpart primary $rootfs_start $rootfs_end | ||
133 | |||
134 | echo "Creating swap partition on $swap" | ||
135 | parted /dev/${device} mkpart primary $swap_start 100% | ||
136 | |||
137 | parted /dev/${device} print | ||
138 | |||
139 | echo "Formatting $bootfs to ext3..." | ||
140 | mkfs.ext3 $bootfs | ||
141 | |||
142 | echo "Formatting $rootfs to ext3..." | ||
143 | mkfs.ext3 $rootfs | ||
144 | |||
145 | echo "Formatting swap partition...($swap)" | ||
146 | mkswap $swap | ||
147 | |||
148 | mkdir /tgt_root | ||
149 | mkdir /src_root | ||
150 | mkdir -p /boot | ||
151 | |||
152 | # Handling of the target root partition | ||
153 | mount $rootfs /tgt_root | ||
154 | mount -o rw,loop,noatime,nodiratime /media/$1/$2 /src_root | ||
155 | echo "Copying rootfs files..." | ||
156 | cp -a /src_root/* /tgt_root | ||
157 | if [ -d /tgt_root/etc/ ] ; then | ||
158 | echo "$swap swap swap defaults 0 0" >> /tgt_root/etc/fstab | ||
159 | echo "$bootfs /boot ext3 defaults 1 2" >> /tgt_root/etc/fstab | ||
160 | # We dont want udev to mount our root device while we're booting... | ||
161 | if [ -d /tgt_root/etc/udev/ ] ; then | ||
162 | echo "/dev/${device}" >> /tgt_root/etc/udev/mount.blacklist | ||
163 | fi | ||
164 | fi | ||
165 | umount /tgt_root | ||
166 | umount /src_root | ||
167 | |||
168 | # Handling of the target boot partition | ||
169 | mount $bootfs /boot | ||
170 | echo "Preparing boot partition..." | ||
171 | if [ -f /etc/grub.d/40_custom ] ; then | ||
172 | echo "Preparing custom grub2 menu..." | ||
173 | GRUBCFG="/boot/grub/grub.cfg" | ||
174 | mkdir -p $(dirname $GRUBCFG) | ||
175 | cp /etc/grub.d/40_custom $GRUBCFG | ||
176 | sed -i "s@__ROOTFS__@$rootfs $rootwait@g" $GRUBCFG | ||
177 | sed -i "s/__VIDEO_MODE__/$3/g" $GRUBCFG | ||
178 | sed -i "s/__VGA_MODE__/$4/g" $GRUBCFG | ||
179 | sed -i "s/__CONSOLE__/$5/g" $GRUBCFG | ||
180 | sed -i "/#/d" $GRUBCFG | ||
181 | sed -i "/exec tail/d" $GRUBCFG | ||
182 | chmod 0444 $GRUBCFG | ||
183 | fi | ||
184 | grub-install /dev/${device} | ||
185 | echo "(hd0) /dev/${device}" > /boot/grub/device.map | ||
186 | |||
187 | # If grub.cfg doesn't exist, assume GRUB 0.97 and create a menu.lst | ||
188 | if [ ! -f /boot/grub/grub.cfg ] ; then | ||
189 | echo "Preparing custom grub menu..." | ||
190 | echo "default 0" > /boot/grub/menu.lst | ||
191 | echo "timeout 30" >> /boot/grub/menu.lst | ||
192 | echo "title Live Boot/Install-Image" >> /boot/grub/menu.lst | ||
193 | echo "root (hd0,0)" >> /boot/grub/menu.lst | ||
194 | echo "kernel /vmlinuz root=$rootfs rw $3 $4 quiet" >> /boot/grub/menu.lst | ||
195 | fi | ||
196 | |||
197 | cp /media/$1/vmlinuz /boot/ | ||
198 | |||
199 | umount /boot | ||
200 | |||
201 | sync | ||
202 | |||
203 | echo "Remove your installation media, and press ENTER" | ||
204 | |||
205 | read enter | ||
206 | |||
207 | echo "Rebooting..." | ||
208 | reboot -f | ||
diff --git a/meta/recipes-core/initrdscripts/files/init-live.sh b/meta/recipes-core/initrdscripts/files/init-live.sh new file mode 100644 index 0000000000..9e53a25a51 --- /dev/null +++ b/meta/recipes-core/initrdscripts/files/init-live.sh | |||
@@ -0,0 +1,223 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | PATH=/sbin:/bin:/usr/sbin:/usr/bin | ||
4 | |||
5 | ROOT_MOUNT="/rootfs/" | ||
6 | ROOT_IMAGE="rootfs.img" | ||
7 | MOUNT="/bin/mount" | ||
8 | UMOUNT="/bin/umount" | ||
9 | ISOLINUX="" | ||
10 | |||
11 | # Copied from initramfs-framework. The core of this script probably should be | ||
12 | # turned into initramfs-framework modules to reduce duplication. | ||
13 | udev_daemon() { | ||
14 | OPTIONS="/sbin/udev/udevd /sbin/udevd /lib/udev/udevd /lib/systemd/systemd-udevd" | ||
15 | |||
16 | for o in $OPTIONS; do | ||
17 | if [ -x "$o" ]; then | ||
18 | echo $o | ||
19 | return 0 | ||
20 | fi | ||
21 | done | ||
22 | |||
23 | return 1 | ||
24 | } | ||
25 | |||
26 | _UDEV_DAEMON=`udev_daemon` | ||
27 | |||
28 | early_setup() { | ||
29 | mkdir -p /proc | ||
30 | mkdir -p /sys | ||
31 | mount -t proc proc /proc | ||
32 | mount -t sysfs sysfs /sys | ||
33 | mount -t devtmpfs none /dev | ||
34 | |||
35 | # support modular kernel | ||
36 | modprobe isofs 2> /dev/null | ||
37 | |||
38 | mkdir -p /run | ||
39 | mkdir -p /var/run | ||
40 | |||
41 | $_UDEV_DAEMON --daemon | ||
42 | udevadm trigger --action=add | ||
43 | } | ||
44 | |||
45 | read_args() { | ||
46 | [ -z "$CMDLINE" ] && CMDLINE=`cat /proc/cmdline` | ||
47 | for arg in $CMDLINE; do | ||
48 | optarg=`expr "x$arg" : 'x[^=]*=\(.*\)'` | ||
49 | case $arg in | ||
50 | root=*) | ||
51 | ROOT_DEVICE=$optarg ;; | ||
52 | rootimage=*) | ||
53 | ROOT_IMAGE=$optarg ;; | ||
54 | rootfstype=*) | ||
55 | modprobe $optarg 2> /dev/null ;; | ||
56 | LABEL=*) | ||
57 | label=$optarg ;; | ||
58 | video=*) | ||
59 | video_mode=$arg ;; | ||
60 | vga=*) | ||
61 | vga_mode=$arg ;; | ||
62 | console=*) | ||
63 | if [ -z "${console_params}" ]; then | ||
64 | console_params=$arg | ||
65 | else | ||
66 | console_params="$console_params $arg" | ||
67 | fi ;; | ||
68 | debugshell*) | ||
69 | if [ -z "$optarg" ]; then | ||
70 | shelltimeout=30 | ||
71 | else | ||
72 | shelltimeout=$optarg | ||
73 | fi | ||
74 | esac | ||
75 | done | ||
76 | } | ||
77 | |||
78 | boot_live_root() { | ||
79 | # Watches the udev event queue, and exits if all current events are handled | ||
80 | udevadm settle --timeout=3 --quiet | ||
81 | killall "${_UDEV_DAEMON##*/}" 2>/dev/null | ||
82 | |||
83 | # Move the mount points of some filesystems over to | ||
84 | # the corresponding directories under the real root filesystem. | ||
85 | for dir in `awk '/\/dev.* \/media/{print $2}' /proc/mounts`; do | ||
86 | mkdir -p ${ROOT_MOUNT}/$dir | ||
87 | mount -n --move $dir ${ROOT_MOUNT}/$dir | ||
88 | done | ||
89 | mount -n --move /proc ${ROOT_MOUNT}/proc | ||
90 | mount -n --move /sys ${ROOT_MOUNT}/sys | ||
91 | mount -n --move /dev ${ROOT_MOUNT}/dev | ||
92 | |||
93 | cd $ROOT_MOUNT | ||
94 | |||
95 | # busybox switch_root supports -c option | ||
96 | exec switch_root -c /dev/console $ROOT_MOUNT /sbin/init $CMDLINE || | ||
97 | fatal "Couldn't switch_root, dropping to shell" | ||
98 | } | ||
99 | |||
100 | fatal() { | ||
101 | echo $1 >$CONSOLE | ||
102 | echo >$CONSOLE | ||
103 | exec sh | ||
104 | } | ||
105 | |||
106 | early_setup | ||
107 | |||
108 | [ -z "$CONSOLE" ] && CONSOLE="/dev/console" | ||
109 | |||
110 | read_args | ||
111 | |||
112 | echo "Waiting for removable media..." | ||
113 | C=0 | ||
114 | while true | ||
115 | do | ||
116 | for i in `ls /media 2>/dev/null`; do | ||
117 | if [ -f /media/$i/$ROOT_IMAGE ] ; then | ||
118 | found="yes" | ||
119 | break | ||
120 | elif [ -f /media/$i/isolinux/$ROOT_IMAGE ]; then | ||
121 | found="yes" | ||
122 | ISOLINUX="isolinux" | ||
123 | break | ||
124 | fi | ||
125 | done | ||
126 | if [ "$found" = "yes" ]; then | ||
127 | break; | ||
128 | fi | ||
129 | # don't wait for more than $shelltimeout seconds, if it's set | ||
130 | if [ -n "$shelltimeout" ]; then | ||
131 | echo -n " " $(( $shelltimeout - $C )) | ||
132 | if [ $C -ge $shelltimeout ]; then | ||
133 | echo "..." | ||
134 | echo "Mounted filesystems" | ||
135 | mount | grep media | ||
136 | echo "Available block devices" | ||
137 | ls /dev/sd* | ||
138 | fatal "Cannot find $ROOT_IMAGE file in /media/* , dropping to a shell " | ||
139 | fi | ||
140 | C=$(( C + 1 )) | ||
141 | fi | ||
142 | sleep 1 | ||
143 | done | ||
144 | |||
145 | # Try to mount the root image read-write and then boot it up. | ||
146 | # This function distinguishes between a read-only image and a read-write image. | ||
147 | # In the former case (typically an iso), it tries to make a union mount if possible. | ||
148 | # In the latter case, the root image could be mounted and then directly booted up. | ||
149 | mount_and_boot() { | ||
150 | mkdir $ROOT_MOUNT | ||
151 | mknod /dev/loop0 b 7 0 2>/dev/null | ||
152 | |||
153 | if ! mount -o rw,loop,noatime,nodiratime /media/$i/$ISOLINUX/$ROOT_IMAGE $ROOT_MOUNT ; then | ||
154 | fatal "Could not mount rootfs image" | ||
155 | fi | ||
156 | |||
157 | if touch $ROOT_MOUNT/bin 2>/dev/null; then | ||
158 | # The root image is read-write, directly boot it up. | ||
159 | boot_live_root | ||
160 | fi | ||
161 | |||
162 | # determine which unification filesystem to use | ||
163 | union_fs_type="" | ||
164 | if grep -q -w "overlayfs" /proc/filesystems; then | ||
165 | union_fs_type="overlayfs" | ||
166 | elif grep -q -w "aufs" /proc/filesystems; then | ||
167 | union_fs_type="aufs" | ||
168 | else | ||
169 | union_fs_type="" | ||
170 | fi | ||
171 | |||
172 | # make a union mount if possible | ||
173 | case $union_fs_type in | ||
174 | "overlayfs") | ||
175 | mkdir -p /rootfs.ro /rootfs.rw | ||
176 | if ! mount -n --move $ROOT_MOUNT /rootfs.ro; then | ||
177 | rm -rf /rootfs.ro /rootfs.rw | ||
178 | fatal "Could not move rootfs mount point" | ||
179 | else | ||
180 | mount -t tmpfs -o rw,noatime,mode=755 tmpfs /rootfs.rw | ||
181 | mount -t overlayfs -o "lowerdir=/rootfs.ro,upperdir=/rootfs.rw" overlayfs $ROOT_MOUNT | ||
182 | mkdir -p $ROOT_MOUNT/rootfs.ro $ROOT_MOUNT/rootfs.rw | ||
183 | mount --move /rootfs.ro $ROOT_MOUNT/rootfs.ro | ||
184 | mount --move /rootfs.rw $ROOT_MOUNT/rootfs.rw | ||
185 | fi | ||
186 | ;; | ||
187 | "aufs") | ||
188 | mkdir -p /rootfs.ro /rootfs.rw | ||
189 | if ! mount -n --move $ROOT_MOUNT /rootfs.ro; then | ||
190 | rm -rf /rootfs.ro /rootfs.rw | ||
191 | fatal "Could not move rootfs mount point" | ||
192 | else | ||
193 | mount -t tmpfs -o rw,noatime,mode=755 tmpfs /rootfs.rw | ||
194 | mount -t aufs -o "dirs=/rootfs.rw=rw:/rootfs.ro=ro" aufs $ROOT_MOUNT | ||
195 | mkdir -p $ROOT_MOUNT/rootfs.ro $ROOT_MOUNT/rootfs.rw | ||
196 | mount --move /rootfs.ro $ROOT_MOUNT/rootfs.ro | ||
197 | mount --move /rootfs.rw $ROOT_MOUNT/rootfs.rw | ||
198 | fi | ||
199 | ;; | ||
200 | "") | ||
201 | mount -t tmpfs -o rw,noatime,mode=755 tmpfs $ROOT_MOUNT/media | ||
202 | ;; | ||
203 | esac | ||
204 | |||
205 | # boot the image | ||
206 | boot_live_root | ||
207 | } | ||
208 | |||
209 | case $label in | ||
210 | boot) | ||
211 | mount_and_boot | ||
212 | ;; | ||
213 | install|install-efi) | ||
214 | if [ -f /media/$i/$ISOLINUX/$ROOT_IMAGE ] ; then | ||
215 | ./$label.sh $i/$ISOLINUX $ROOT_IMAGE $video_mode $vga_mode $console_params | ||
216 | else | ||
217 | fatal "Could not find $label script" | ||
218 | fi | ||
219 | |||
220 | # If we're getting here, we failed... | ||
221 | fatal "Installation image failed" | ||
222 | ;; | ||
223 | esac | ||
diff --git a/meta/recipes-core/initrdscripts/initramfs-boot_1.0.bb b/meta/recipes-core/initrdscripts/initramfs-boot_1.0.bb new file mode 100644 index 0000000000..0ede20b15d --- /dev/null +++ b/meta/recipes-core/initrdscripts/initramfs-boot_1.0.bb | |||
@@ -0,0 +1,14 @@ | |||
1 | SUMMARY = "Extremely basic live image init script" | ||
2 | LICENSE = "MIT" | ||
3 | LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" | ||
4 | SRC_URI = "file://init-boot.sh" | ||
5 | |||
6 | PR = "r2" | ||
7 | |||
8 | do_install() { | ||
9 | install -m 0755 ${WORKDIR}/init-boot.sh ${D}/init | ||
10 | } | ||
11 | |||
12 | inherit allarch | ||
13 | |||
14 | FILES_${PN} += " /init " | ||
diff --git a/meta/recipes-core/initrdscripts/initramfs-framework/debug b/meta/recipes-core/initrdscripts/initramfs-framework/debug new file mode 100644 index 0000000000..00bfd7d3f5 --- /dev/null +++ b/meta/recipes-core/initrdscripts/initramfs-framework/debug | |||
@@ -0,0 +1,82 @@ | |||
1 | #!/bin/sh | ||
2 | # Copyright (C) 2011 O.S. Systems Software LTDA. | ||
3 | # Licensed on MIT | ||
4 | |||
5 | # Adds support to dynamic debugging of initramfs using bootparam in | ||
6 | # following format: | ||
7 | # shell : starts a shell before and after each module | ||
8 | # shell=before:<module> : starts a shell before <module> is loaded and run | ||
9 | # shell=after:<module> : starts a shell after <module> is loaded and run | ||
10 | # | ||
11 | # shell-debug : run set -x as soon as possible | ||
12 | # shell-debug=before:<module> : run set -x before <module> is loaded and run | ||
13 | # shell-debug=after:<module> : run set -x after <module> is loaded and run | ||
14 | |||
15 | DEBUG_SHELL="false" | ||
16 | |||
17 | debug_hook_handler() { | ||
18 | status=$1 | ||
19 | module=$2 | ||
20 | |||
21 | if [ -n "$bootparam_shell" ] && [ "$bootparam_shell" != "true" ]; then | ||
22 | shell_wanted_status=`expr $bootparam_shell : '\(.*\):.*'` | ||
23 | shell_wanted_module=`expr $bootparam_shell : '.*:\(.*\)'` | ||
24 | |||
25 | if [ "$shell_wanted_status" = "before" ]; then | ||
26 | shell_wanted_status=pre | ||
27 | else | ||
28 | shell_wanted_status=post | ||
29 | fi | ||
30 | fi | ||
31 | |||
32 | if [ "$bootparam_shell" = "true" ] || | ||
33 | ( [ "$status" = "$shell_wanted_status" ] && | ||
34 | [ "$module" = "$shell_wanted_module" ] ); then | ||
35 | if [ "$status" = "pre" ]; then | ||
36 | status_msg="before" | ||
37 | else | ||
38 | status_msg="after" | ||
39 | fi | ||
40 | |||
41 | msg "Starting shell $status_msg $module..." | ||
42 | sh | ||
43 | fi | ||
44 | |||
45 | if [ -n "$bootparam_shell_debug" ] && [ "$bootparam_shell_debug" != "true" ]; then | ||
46 | shell_debug_wanted_status=`expr $bootparam_shell_debug : '\(.*\):.*'` | ||
47 | shell_debug_wanted_module=`expr $bootparam_shell_debug : '.*:\(.*\)'` | ||
48 | |||
49 | if [ "$shell_debug_wanted_status" = "before" ]; then | ||
50 | shell_debug_wanted_status=pre | ||
51 | else | ||
52 | shell_debug_wanted_status=post | ||
53 | fi | ||
54 | fi | ||
55 | |||
56 | if [ "$bootparam_shell_debug" = "true" ] || | ||
57 | ( [ "$status" = "$shell_debug_wanted_status" ] && | ||
58 | [ "$module" = "$shell_debug_wanted_module" ] ); then | ||
59 | if [ "$DEBUG_SHELL" = "true" ]; then | ||
60 | return 0 | ||
61 | fi | ||
62 | |||
63 | if [ "$status" = "pre" ]; then | ||
64 | status_msg="before" | ||
65 | else | ||
66 | status_msg="after" | ||
67 | fi | ||
68 | |||
69 | msg "Starting shell debugging $status_msg $module..." | ||
70 | DEBUG_SHELL="true" | ||
71 | set -x | ||
72 | fi | ||
73 | } | ||
74 | |||
75 | debug_enabled() { | ||
76 | return 0 | ||
77 | } | ||
78 | |||
79 | debug_run() { | ||
80 | add_module_pre_hook "debug_hook_handler" | ||
81 | add_module_post_hook "debug_hook_handler" | ||
82 | } | ||
diff --git a/meta/recipes-core/initrdscripts/initramfs-framework/e2fs b/meta/recipes-core/initrdscripts/initramfs-framework/e2fs new file mode 100755 index 0000000000..29f801a7bd --- /dev/null +++ b/meta/recipes-core/initrdscripts/initramfs-framework/e2fs | |||
@@ -0,0 +1,28 @@ | |||
1 | #!/bin/sh | ||
2 | # Copyright (C) 2011 O.S. Systems Software LTDA. | ||
3 | # Licensed on MIT | ||
4 | |||
5 | e2fs_enabled() { | ||
6 | return 0 | ||
7 | } | ||
8 | |||
9 | e2fs_run() { | ||
10 | filesystems="ext4 ext3 ext2" | ||
11 | |||
12 | # load modules | ||
13 | for fs in $filesystems; do | ||
14 | load_kernel_module $fs | ||
15 | done | ||
16 | |||
17 | for fs in $filesystems; do | ||
18 | eval "fs_options=\$bootparam_${fs}" | ||
19 | if [ -n "$fs_options" ]; then | ||
20 | dev=`expr "$fs_options" : '\([^:]*\).*'` | ||
21 | path=`expr "$fs_options" : '[^:]*:\([^:]*\).*'` | ||
22 | |||
23 | info "Mounting $dev as $fs on $path as $fs..." | ||
24 | mkdir -p $path | ||
25 | mount -t $fs $dev $path | ||
26 | fi | ||
27 | done | ||
28 | } | ||
diff --git a/meta/recipes-core/initrdscripts/initramfs-framework/finish b/meta/recipes-core/initrdscripts/initramfs-framework/finish new file mode 100755 index 0000000000..325f47be40 --- /dev/null +++ b/meta/recipes-core/initrdscripts/initramfs-framework/finish | |||
@@ -0,0 +1,47 @@ | |||
1 | #!/bin/sh | ||
2 | # Copyright (C) 2011 O.S. Systems Software LTDA. | ||
3 | # Licensed on MIT | ||
4 | |||
5 | finish_enabled() { | ||
6 | return 0 | ||
7 | } | ||
8 | |||
9 | finish_run() { | ||
10 | if [ -n "$ROOTFS_DIR" ]; then | ||
11 | if [ -n "$bootparam_rootdelay" ]; then | ||
12 | debug "Sleeping for $rootdelay second(s) to wait root to settle..." | ||
13 | sleep $bootparam_rootdelay | ||
14 | fi | ||
15 | |||
16 | if [ -n "$bootparam_root" ]; then | ||
17 | debug "No e2fs compatible filesystem has been mounted, mounting $bootparam_root..." | ||
18 | |||
19 | if [ "`echo ${bootparam_root} | cut -c1-5`" = "UUID=" ]; then | ||
20 | root_uuid=`echo $bootparam_root | cut -c6-` | ||
21 | bootparam_root="/dev/disk/by-uuid/$root_uuid" | ||
22 | fi | ||
23 | |||
24 | if [ -e "$bootparam_root" ]; then | ||
25 | mount $bootparam_root $ROOTFS_DIR | ||
26 | else | ||
27 | debug "root '$bootparam_root' doesn't exist." | ||
28 | fi | ||
29 | fi | ||
30 | |||
31 | if [ ! -d $ROOTFS_DIR/dev ]; then | ||
32 | fatal "ERROR: There's no '/dev' on rootfs." | ||
33 | fi | ||
34 | |||
35 | info "Switching root to '$ROOTFS_DIR'..." | ||
36 | |||
37 | debug "Moving /dev, /proc and /sys onto rootfs..." | ||
38 | mount --move /dev $ROOTFS_DIR/dev | ||
39 | mount --move /proc $ROOTFS_DIR/proc | ||
40 | mount --move /sys $ROOTFS_DIR/sys | ||
41 | |||
42 | cd $ROOTFS_DIR | ||
43 | exec switch_root -c /dev/console $ROOTFS_DIR /sbin/init | ||
44 | else | ||
45 | debug "No rootfs has been set" | ||
46 | fi | ||
47 | } | ||
diff --git a/meta/recipes-core/initrdscripts/initramfs-framework/init b/meta/recipes-core/initrdscripts/initramfs-framework/init new file mode 100755 index 0000000000..95fa9fb1a0 --- /dev/null +++ b/meta/recipes-core/initrdscripts/initramfs-framework/init | |||
@@ -0,0 +1,140 @@ | |||
1 | #!/bin/sh | ||
2 | # Copyright (C) 2011 O.S. Systems Software LTDA. | ||
3 | # Licensed on MIT | ||
4 | # | ||
5 | # Provides the API to be used by the initramfs modules | ||
6 | # | ||
7 | # Modules need to provide the following functions: | ||
8 | # | ||
9 | # <module>_enabled : check if the module ought to run (return 1 to skip) | ||
10 | # <module>_run : do what is need | ||
11 | # | ||
12 | # Boot parameters are available on environment in the as: | ||
13 | # | ||
14 | # 'foo=value' as 'bootparam_foo=value' | ||
15 | # 'foo' as 'bootparam_foo=true' | ||
16 | |||
17 | # Register a function to be called before running a module | ||
18 | # The hook is called as: | ||
19 | # <function> pre <module> | ||
20 | add_module_pre_hook() { | ||
21 | MODULE_PRE_HOOKS="$MODULE_PRE_HOOKS $1" | ||
22 | } | ||
23 | |||
24 | # Register a function to be called after running a module | ||
25 | # The hook is called as: | ||
26 | # <function> post <module> | ||
27 | add_module_post_hook() { | ||
28 | MODULE_POST_HOOKS="$MODULE_POST_HOOKS $1" | ||
29 | } | ||
30 | |||
31 | # Load kernel module | ||
32 | load_kernel_module() { | ||
33 | if modprobe $1 >/dev/null 2>&1; then | ||
34 | info "Loaded module $1" | ||
35 | else | ||
36 | debug "Failed to load module $1" | ||
37 | fi | ||
38 | } | ||
39 | |||
40 | # Prints information | ||
41 | msg() { | ||
42 | echo "$@" >/dev/console | ||
43 | } | ||
44 | |||
45 | # Prints information if verbose bootparam is used | ||
46 | info() { | ||
47 | [ -n "$bootparam_verbose" ] && echo "$@" >/dev/console | ||
48 | } | ||
49 | |||
50 | # Prints information if debug bootparam is used | ||
51 | debug() { | ||
52 | [ -n "$bootparam_debug" ] && echo "DEBUG: $@" >/dev/console | ||
53 | } | ||
54 | |||
55 | # Prints a message and start a endless loop | ||
56 | fatal() { | ||
57 | echo $1 >/dev/console | ||
58 | echo >/dev/console | ||
59 | |||
60 | while [ "true" ]; do | ||
61 | sleep 3600 | ||
62 | done | ||
63 | } | ||
64 | |||
65 | # Variables shared amoung modules | ||
66 | ROOTFS_DIR="/rootfs" # where to do the switch root | ||
67 | MODULE_PRE_HOOKS="" # functions to call before running each module | ||
68 | MODULE_POST_HOOKS="" # functions to call after running each module | ||
69 | MODULES_DIR=/init.d # place to look for modules | ||
70 | |||
71 | # make mount stop complaining about missing /etc/fstab | ||
72 | touch /etc/fstab | ||
73 | |||
74 | # initialize /proc, /sys and /var/lock | ||
75 | mkdir -p /proc /sys /var/lock | ||
76 | mount -t proc proc /proc | ||
77 | mount -t sysfs sysfs /sys | ||
78 | |||
79 | # populate bootparam environment | ||
80 | for p in `cat /proc/cmdline`; do | ||
81 | opt=`echo $p | cut -d'=' -f1` | ||
82 | opt=`echo $opt | sed -e 's/-/_/'` | ||
83 | if [ "`echo $p | cut -d'=' -f1`" = "$p" ]; then | ||
84 | eval "bootparam_${opt}=true" | ||
85 | else | ||
86 | value="`echo $p | cut -d'=' -f2-`" | ||
87 | eval "bootparam_${opt}=\"${value}\"" | ||
88 | fi | ||
89 | done | ||
90 | |||
91 | # use /dev with devtmpfs | ||
92 | if grep -q devtmpfs /proc/filesystems; then | ||
93 | mkdir -p /dev | ||
94 | mount -t devtmpfs devtmpfs /dev | ||
95 | else | ||
96 | if [ ! -d /dev ]; then | ||
97 | fatal "ERROR: /dev doesn't exist and kernel doesn't has devtmpfs enabled." | ||
98 | fi | ||
99 | fi | ||
100 | |||
101 | mkdir $ROOTFS_DIR | ||
102 | |||
103 | # Load and run modules | ||
104 | for m in $MODULES_DIR/*; do | ||
105 | # Skip backup files | ||
106 | if [ "`echo $m | sed -e 's/\~$//'`" != "$m" ]; then | ||
107 | continue | ||
108 | fi | ||
109 | |||
110 | module=`basename $m | cut -d'-' -f 2` | ||
111 | debug "Loading module $module" | ||
112 | |||
113 | # pre hooks | ||
114 | for h in $MODULE_PRE_HOOKS; do | ||
115 | debug "Calling module hook (pre): $h" | ||
116 | eval "$h pre $module" | ||
117 | debug "Finished module hook (pre): $h" | ||
118 | done | ||
119 | |||
120 | # process module | ||
121 | . $m | ||
122 | |||
123 | if ! eval "${module}_enabled"; then | ||
124 | debug "Skipping module $module" | ||
125 | continue | ||
126 | fi | ||
127 | |||
128 | debug "Running ${module}_run" | ||
129 | eval "${module}_run" | ||
130 | |||
131 | # post hooks | ||
132 | for h in $MODULE_POST_HOOKS; do | ||
133 | debug "Calling module hook (post): $h" | ||
134 | eval "$h post $module" | ||
135 | debug "Finished module hook (post): $h" | ||
136 | done | ||
137 | done | ||
138 | |||
139 | # Catch all | ||
140 | fatal "ERROR: Initramfs failed to initialize the system." | ||
diff --git a/meta/recipes-core/initrdscripts/initramfs-framework/mdev b/meta/recipes-core/initrdscripts/initramfs-framework/mdev new file mode 100644 index 0000000000..a5df1d717a --- /dev/null +++ b/meta/recipes-core/initrdscripts/initramfs-framework/mdev | |||
@@ -0,0 +1,30 @@ | |||
1 | #!/bin/sh | ||
2 | # Copyright (C) 2011 O.S. Systems Software LTDA. | ||
3 | # Licensed on MIT | ||
4 | |||
5 | mdev_enabled() { | ||
6 | if [ ! -e /sbin/mdev ]; then | ||
7 | debug "/sbin/mdev doesn't exist" | ||
8 | return 1 | ||
9 | fi | ||
10 | |||
11 | return 0 | ||
12 | } | ||
13 | |||
14 | mdev_run() { | ||
15 | # setup the environment | ||
16 | mount -t tmpfs tmpfs /dev | ||
17 | |||
18 | mkdir -m 1777 /dev/shm | ||
19 | |||
20 | mkdir -m 0755 /dev/pts | ||
21 | mount -t devpts devpts /dev/pts | ||
22 | |||
23 | echo /sbin/mdev > /proc/sys/kernel/hotplug | ||
24 | mdev -s | ||
25 | |||
26 | # load modules for devices | ||
27 | find /sys -name modalias | while read m; do | ||
28 | load_kernel_module $(cat $m) | ||
29 | done | ||
30 | } | ||
diff --git a/meta/recipes-core/initrdscripts/initramfs-framework/udev b/meta/recipes-core/initrdscripts/initramfs-framework/udev new file mode 100644 index 0000000000..bb462dc448 --- /dev/null +++ b/meta/recipes-core/initrdscripts/initramfs-framework/udev | |||
@@ -0,0 +1,45 @@ | |||
1 | #!/bin/sh | ||
2 | # Copyright (C) 2011, 2012 O.S. Systems Software LTDA. | ||
3 | # Licensed on MIT | ||
4 | |||
5 | udev_shutdown_hook_handler() { | ||
6 | status=$1 | ||
7 | module=$2 | ||
8 | if [ "$status" = "pre" ] && [ "$module" = "finish" ]; then | ||
9 | killall `basename $_UDEV_DAEMON` 2>/dev/null | ||
10 | fi | ||
11 | } | ||
12 | |||
13 | udev_daemon() { | ||
14 | OPTIONS="/sbin/udev/udevd /sbin/udevd /lib/udev/udevd /lib/systemd/systemd-udevd" | ||
15 | |||
16 | for o in $OPTIONS; do | ||
17 | if [ -x "$o" ]; then | ||
18 | echo $o | ||
19 | return 0 | ||
20 | fi | ||
21 | done | ||
22 | |||
23 | return 1 | ||
24 | } | ||
25 | |||
26 | _UDEV_DAEMON=`udev_daemon` | ||
27 | |||
28 | udev_enabled() { | ||
29 | if [ -z "$_UDEV_DAEMON" ]; then | ||
30 | msg "WARNING: Cannot find the udev daemon; daemon will not be started in initramfs." | ||
31 | return 1 | ||
32 | fi | ||
33 | |||
34 | return 0 | ||
35 | } | ||
36 | |||
37 | udev_run() { | ||
38 | add_module_pre_hook "udev_shutdown_hook_handler" | ||
39 | |||
40 | mkdir -p /run | ||
41 | |||
42 | $_UDEV_DAEMON --daemon | ||
43 | udevadm trigger --action=add | ||
44 | udevadm settle | ||
45 | } | ||
diff --git a/meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb b/meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb new file mode 100644 index 0000000000..861bec363f --- /dev/null +++ b/meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb | |||
@@ -0,0 +1,59 @@ | |||
1 | SUMMARY = "Modular initramfs system" | ||
2 | LICENSE = "MIT" | ||
3 | LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" | ||
4 | RDEPENDS_${PN} += "busybox" | ||
5 | |||
6 | PR = "r2" | ||
7 | |||
8 | inherit allarch | ||
9 | |||
10 | SRC_URI = "file://init \ | ||
11 | file://finish \ | ||
12 | file://mdev \ | ||
13 | file://udev \ | ||
14 | file://e2fs \ | ||
15 | file://debug" | ||
16 | |||
17 | do_install() { | ||
18 | install -d ${D}/init.d | ||
19 | |||
20 | # base | ||
21 | install -m 0755 ${WORKDIR}/init ${D}/init | ||
22 | install -m 0755 ${WORKDIR}/finish ${D}/init.d/99-finish | ||
23 | |||
24 | # mdev | ||
25 | install -m 0755 ${WORKDIR}/mdev ${D}/init.d/01-mdev | ||
26 | |||
27 | # udev | ||
28 | install -m 0755 ${WORKDIR}/udev ${D}/init.d/01-udev | ||
29 | |||
30 | # e2fs | ||
31 | install -m 0755 ${WORKDIR}/e2fs ${D}/init.d/10-e2fs | ||
32 | |||
33 | # debug | ||
34 | install -m 0755 ${WORKDIR}/debug ${D}/init.d/00-debug | ||
35 | } | ||
36 | |||
37 | PACKAGES = "${PN}-base \ | ||
38 | initramfs-module-mdev \ | ||
39 | initramfs-module-udev \ | ||
40 | initramfs-module-e2fs \ | ||
41 | initramfs-module-debug" | ||
42 | |||
43 | FILES_${PN}-base = "/init /init.d/99-finish" | ||
44 | |||
45 | SUMMARY_initramfs-module-mdev = "initramfs support for mdev" | ||
46 | RDEPENDS_initramfs-module-mdev = "${PN}-base" | ||
47 | FILES_initramfs-module-mdev = "/init.d/01-mdev" | ||
48 | |||
49 | SUMMARY_initramfs-module-udev = "initramfs support for udev" | ||
50 | RDEPENDS_initramfs-module-udev = "${PN}-base udev udev-utils" | ||
51 | FILES_initramfs-module-udev = "/init.d/01-udev" | ||
52 | |||
53 | SUMMARY_initramfs-module-e2fs = "initramfs support for ext4/ext3/ext2 filesystems" | ||
54 | RDEPENDS_initramfs-module-e2fs = "${PN}-base" | ||
55 | FILES_initramfs-module-e2fs = "/init.d/10-e2fs" | ||
56 | |||
57 | SUMMARY_initramfs-module-debug = "initramfs dynamic debug support" | ||
58 | RDEPENDS_initramfs-module-debug = "${PN}-base" | ||
59 | FILES_initramfs-module-debug = "/init.d/00-debug" | ||
diff --git a/meta/recipes-core/initrdscripts/initramfs-live-boot_1.0.bb b/meta/recipes-core/initrdscripts/initramfs-live-boot_1.0.bb new file mode 100644 index 0000000000..2d378e2101 --- /dev/null +++ b/meta/recipes-core/initrdscripts/initramfs-live-boot_1.0.bb | |||
@@ -0,0 +1,17 @@ | |||
1 | SUMMARY = "Live image init script" | ||
2 | LICENSE = "MIT" | ||
3 | LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" | ||
4 | DEPENDS = "virtual/kernel" | ||
5 | RDEPENDS_${PN} = "udev udev-extraconf" | ||
6 | SRC_URI = "file://init-live.sh" | ||
7 | |||
8 | PR = "r11" | ||
9 | |||
10 | do_install() { | ||
11 | install -m 0755 ${WORKDIR}/init-live.sh ${D}/init | ||
12 | } | ||
13 | |||
14 | FILES_${PN} += " /init " | ||
15 | |||
16 | # Due to kernel depdendency | ||
17 | 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 new file mode 100644 index 0000000000..a54960c596 --- /dev/null +++ b/meta/recipes-core/initrdscripts/initramfs-live-install-efi-testfs_1.0.bb | |||
@@ -0,0 +1,14 @@ | |||
1 | SUMMARY = "Live image install script for with a second rootfs/kernel option" | ||
2 | LICENSE = "MIT" | ||
3 | LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" | ||
4 | SRC_URI = "file://init-install-efi-testfs.sh" | ||
5 | |||
6 | RDEPENDS_${PN} = "parted e2fsprogs-mke2fs dosfstools" | ||
7 | |||
8 | do_install() { | ||
9 | install -m 0755 ${WORKDIR}/init-install-efi-testfs.sh ${D}/install-efi.sh | ||
10 | } | ||
11 | |||
12 | INHIBIT_DEFAULT_DEPS = "1" | ||
13 | FILES_${PN} = " /install-efi.sh " | ||
14 | 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 new file mode 100644 index 0000000000..7195dc2718 --- /dev/null +++ b/meta/recipes-core/initrdscripts/initramfs-live-install-efi_1.0.bb | |||
@@ -0,0 +1,22 @@ | |||
1 | SUMMARY = "Live image install script for grub-efi" | ||
2 | LICENSE = "MIT" | ||
3 | LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" | ||
4 | SRC_URI = "file://init-install-efi.sh" | ||
5 | |||
6 | PR = "r1" | ||
7 | |||
8 | RDEPENDS_${PN} = "parted e2fsprogs-mke2fs dosfstools" | ||
9 | |||
10 | do_install() { | ||
11 | install -m 0755 ${WORKDIR}/init-install-efi.sh ${D}/install-efi.sh | ||
12 | } | ||
13 | |||
14 | # While this package maybe an allarch due to it being a | ||
15 | # simple script, reality is that it is Host specific based | ||
16 | # on the COMPATIBLE_HOST below, which needs to take precedence | ||
17 | #inherit allarch | ||
18 | INHIBIT_DEFAULT_DEPS = "1" | ||
19 | |||
20 | FILES_${PN} = " /install-efi.sh " | ||
21 | |||
22 | COMPATIBLE_HOST = "(i.86|x86_64).*-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 new file mode 100644 index 0000000000..db4cf544e8 --- /dev/null +++ b/meta/recipes-core/initrdscripts/initramfs-live-install-testfs_1.0.bb | |||
@@ -0,0 +1,14 @@ | |||
1 | SUMMARY = "Live image install script with a second rootfs/kernel" | ||
2 | LICENSE = "MIT" | ||
3 | LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" | ||
4 | SRC_URI = "file://init-install-testfs.sh" | ||
5 | |||
6 | RDEPENDS_${PN} = "grub parted e2fsprogs-mke2fs" | ||
7 | |||
8 | do_install() { | ||
9 | install -m 0755 ${WORKDIR}/init-install-testfs.sh ${D}/install.sh | ||
10 | } | ||
11 | |||
12 | INHIBIT_DEFAULT_DEPS = "1" | ||
13 | FILES_${PN} = " /install.sh " | ||
14 | 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 new file mode 100644 index 0000000000..7bf31c9cf8 --- /dev/null +++ b/meta/recipes-core/initrdscripts/initramfs-live-install_1.0.bb | |||
@@ -0,0 +1,22 @@ | |||
1 | SUMMARY = "Live image install script for grub" | ||
2 | LICENSE = "MIT" | ||
3 | LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" | ||
4 | SRC_URI = "file://init-install.sh" | ||
5 | |||
6 | PR = "r9" | ||
7 | |||
8 | RDEPENDS_${PN} = "grub parted e2fsprogs-mke2fs" | ||
9 | |||
10 | do_install() { | ||
11 | install -m 0755 ${WORKDIR}/init-install.sh ${D}/install.sh | ||
12 | } | ||
13 | |||
14 | # While this package maybe an allarch due to it being a | ||
15 | # simple script, reality is that it is Host specific based | ||
16 | # on the COMPATIBLE_HOST below, which needs to take precedence | ||
17 | #inherit allarch | ||
18 | INHIBIT_DEFAULT_DEPS = "1" | ||
19 | |||
20 | FILES_${PN} = " /install.sh " | ||
21 | |||
22 | COMPATIBLE_HOST = "(i.86|x86_64).*-linux" | ||