-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinit
More file actions
executable file
·85 lines (63 loc) · 1.93 KB
/
Copy pathinit
File metadata and controls
executable file
·85 lines (63 loc) · 1.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/busybox sh
#
export _PATH="$PATH"
export PATH=/
# set busybox location, save busybox as we will move directories
BB="/busybox"
# initialize working dir and log
cd /
#/android/sbin/adbd &
$BB rm init
$BB echo "generating mount directories..."
$BB mkdir proc
$BB mkdir sys
$BB mkdir extSdCard
$BB mkdir output
$BB echo "mounting devices..." >> /output/output.txt
$BB mount -t proc proc /proc >> /output/output.txt
$BB mount -t sysfs sysfs /sys >> /output/output.txt
#$BB tar xvf /dev.tar >> /output/output.txt 2>&1
$BB mdev -s
$BB mkdir -p /dev/block
$BB echo "generating device nodes..." >> /output/output.txt
$BB mknod /dev/block/mmcblk1p1 b 179 17
$BB mknod /dev/tty c 5 0
$BB mknod /dev/console c 5 1
$BB mknod /dev/kmsg c 1 11
$BB ls -R /dev >> /dev/kmsg
echo "BB mount" >> /output/output.txt
$BB mount -t ext4 /dev/block/mmcblk1p1 /extSdCard >> /output/output.txt 2>&1
#$BB mount -t ext4 /dev/block/mmcblk1p1 / >> /output/output.txt 2>&1
$BB echo "Contents of extSdCard" >> /output/output.txt
$BB ls -R /extSdCard
$BB echo "detect if external sd card is inserted" >> /output/output.txt
if [ -f /extSdCard/boot/uImage ] ; then
$BB echo "***Arch Linux***" >> /output/output.txt
$BB echo "***Arch Linux***" >> /dev/kmsg
$BB cat /proc/kmsg
# Arch Linux Boot
#Gives bootloop
exec $BB switch_root -c /dev/console /extSdCard /sbin/init
#exec $BB sh
#$BB mkdir /extSdCard/mnt/initfs
#$BB cd /extSdCard
#$BB pivot_root . /extSdCard/mnt/initfs
#exec $BB chroot . /sbin/init 2 <dev/console >dev/console 2>&1
#Gets stuck on Samsung Screen
#exec sbin/init
#exec $BB sh
else
$BB echo "ANDROID BOOT" >> /output/output.txt
# Android Boot
$BB mv /android/* /
$BB umount /sys
$BB umount /proc
$BB umount /extSdCard
$BB rm -rf /archlinux
$BB rm -rf /android
$BB rm -fr /dev/*
# finally remove busybox
$BB rm /busybox
export PATH="${_PATH}"
exec /init
fi