mkcpio.sh 3.51 KB
Newer Older
longpanda's avatar
longpanda committed
1
2
3
4
5
#!/bin/bash

VENTOY_PATH=$PWD/../


6
7
8
9
10
11
if [ -d cpio_tmp ]; then
    rm -rf cpio_tmp
fi


############### cpio ############
longpanda's avatar
longpanda committed
12
chmod -R 777 cpio
13
rm -f ventoy.cpio ventoy_x86.cpio ventoy_arm64.cpio ventoy_mips64.cpio 
longpanda's avatar
longpanda committed
14
15
16
17
18
19
20
21
22
23

cp -a cpio	cpio_tmp

cd cpio_tmp
rm -f init
ln -s sbin/init init
ln -s sbin/init linuxrc

cd ventoy

longpanda's avatar
longpanda committed
24
find ./loop | cpio  -o -H newc --owner=root:root >loop.cpio
25
26
27
28
29
30
xz loop.cpio
rm -rf loop

xz ventoy_chain.sh
xz ventoy_loop.sh

longpanda's avatar
longpanda committed
31
find ./hook | cpio  -o -H newc --owner=root:root >hook.cpio
32
33
34
35
xz hook.cpio
rm -rf hook
cd ..

longpanda's avatar
longpanda committed
36
find .| cpio  -o -H newc --owner=root:root >../ventoy.cpio
37
38
39

cd ..
rm -rf cpio_tmp
longpanda's avatar
longpanda committed
40

41
42
43
44
45
46
47
48
49
50
51
52
53
54
55



########## cpio_x86 ##############
chmod -R 777 cpio_x86
cp -a cpio_x86	cpio_tmp

cd cpio_tmp/ventoy

cp -a $VENTOY_PATH/DMSETUP/dmsetup32 tool/
cp -a $VENTOY_PATH/DMSETUP/dmsetup64 tool/
cp -a $VENTOY_PATH/SQUASHFS/unsquashfs_32 tool/
cp -a $VENTOY_PATH/SQUASHFS/unsquashfs_64 tool/
cp -a $VENTOY_PATH/FUSEISO/vtoy_fuse_iso_32 tool/
cp -a $VENTOY_PATH/FUSEISO/vtoy_fuse_iso_64 tool/
56
cp -a $VENTOY_PATH/VtoyTool/vtoytool tool/
57
58
59
60
rm -f tool/vtoytool/00/vtoytool_aa64
rm -f tool/vtoytool/00/vtoytool_m64e
cp -a $VENTOY_PATH/VBLADE/vblade-master/vblade_32 tool/
cp -a $VENTOY_PATH/VBLADE/vblade-master/vblade_64 tool/
longpanda's avatar
longpanda committed
61

longpanda's avatar
longpanda committed
62
63
cp -a $VENTOY_PATH/LZIP/lunzip32 tool/
cp -a $VENTOY_PATH/LZIP/lunzip64 tool/
64

longpanda's avatar
longpanda committed
65
66
67
cp -a $VENTOY_PATH/cryptsetup/veritysetup32 tool/
cp -a $VENTOY_PATH/cryptsetup/veritysetup64 tool/

68
chmod -R 777 ./tool
longpanda's avatar
longpanda committed
69

longpanda's avatar
longpanda committed
70
find ./tool | cpio  -o -H newc --owner=root:root >tool.cpio
longpanda's avatar
longpanda committed
71
72
73
xz tool.cpio
rm -rf tool

74
cd ..
longpanda's avatar
longpanda committed
75
find .| cpio  -o -H newc --owner=root:root >../ventoy_x86.cpio
longpanda's avatar
update  
longpanda committed
76

77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
cd ..
rm -rf cpio_tmp


########## cpio_arm64 ##############
chmod -R 777 cpio_arm64
cp -a cpio_arm64	cpio_tmp
cp -a cpio_x86/ventoy/tool/*.sh cpio_tmp/ventoy/tool/

cd cpio_tmp/ventoy

cp -a $VENTOY_PATH/DMSETUP/dmsetupaa64 tool/
cp -a $VENTOY_PATH/SQUASHFS/unsquashfs_aa64 tool/
cp -a $VENTOY_PATH/FUSEISO/vtoy_fuse_iso_aa64 tool/
cp -a $VENTOY_PATH/VtoyTool/vtoytool tool/
rm -f tool/vtoytool/00/vtoytool_32
rm -f tool/vtoytool/00/vtoytool_64
rm -f tool/vtoytool/00/vtoytool_m64e
cp -a $VENTOY_PATH/VBLADE/vblade-master/vblade_aa64 tool/

cp -a $VENTOY_PATH/LZIP/lunzipaa64 tool/

chmod -R 777 ./tool

longpanda's avatar
longpanda committed
101
find ./tool | cpio  -o -H newc --owner=root:root >tool.cpio
102
103
xz tool.cpio
rm -rf tool
longpanda's avatar
longpanda committed
104
105

cd ..
longpanda's avatar
longpanda committed
106
find .| cpio  -o -H newc --owner=root:root >../ventoy_arm64.cpio
107
108
109

cd ..
rm -rf cpio_tmp
longpanda's avatar
longpanda committed
110

111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132


########## cpio_mips64 ##############
chmod -R 777 cpio_mips64
cp -a cpio_mips64	cpio_tmp
cp -a cpio_x86/ventoy/tool/*.sh cpio_tmp/ventoy/tool/

cd cpio_tmp/ventoy

cp -a $VENTOY_PATH/DMSETUP/dmsetupm64e tool/
# cp -a $VENTOY_PATH/SQUASHFS/unsquashfs_m64e tool/
# cp -a $VENTOY_PATH/FUSEISO/vtoy_fuse_iso_m64e tool/
cp -a $VENTOY_PATH/VtoyTool/vtoytool tool/
rm -f tool/vtoytool/00/vtoytool_32
rm -f tool/vtoytool/00/vtoytool_64
rm -f tool/vtoytool/00/vtoytool_aa64
# cp -a $VENTOY_PATH/VBLADE/vblade-master/vblade_m64e tool/

# cp -a $VENTOY_PATH/LZIP/lunzipaa64 tool/

chmod -R 777 ./tool

longpanda's avatar
longpanda committed
133
find ./tool | cpio  -o -H newc --owner=root:root >tool.cpio
134
135
136
137
xz tool.cpio
rm -rf tool

cd ..
longpanda's avatar
longpanda committed
138
find .| cpio  -o -H newc --owner=root:root >../ventoy_mips64.cpio
longpanda's avatar
longpanda committed
139
140
141
142

cd ..
rm -rf cpio_tmp

143
144
145



longpanda's avatar
longpanda committed
146
147
echo '======== SUCCESS ============='

longpanda's avatar
longpanda committed
148
149
150
151
152
153
154
155
rm -f $VENTOY_PATH/INSTALL/ventoy/ventoy.cpio
rm -f $VENTOY_PATH/INSTALL/ventoy/ventoy_x86.cpio
rm -f $VENTOY_PATH/INSTALL/ventoy/ventoy_arm64.cpio
rm -f $VENTOY_PATH/INSTALL/ventoy/ventoy_mips64.cpio
cp -a ventoy.cpio $VENTOY_PATH/INSTALL/ventoy/
cp -a ventoy_x86.cpio $VENTOY_PATH/INSTALL/ventoy/
cp -a ventoy_arm64.cpio $VENTOY_PATH/INSTALL/ventoy/
cp -a ventoy_mips64.cpio $VENTOY_PATH/INSTALL/ventoy/
longpanda's avatar
longpanda committed
156