-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbuild
More file actions
110 lines (110 loc) · 3.82 KB
/
Copy pathbuild
File metadata and controls
110 lines (110 loc) · 3.82 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#!/bin/sh
CORES=`cat /proc/cpuinfo | grep processor | wc -l`
echo "DARWIN BUILD SCRIPT V1.0.0"
echo "-------------------------------"
echo "This script is only compatible with Ubuntu 14.04.*,"
echo "as it has clang-3.4 which won't cause build errors."
echo "-------------------------------"
echo "CPU core number: $CORES"
echo "Make jobserver will be enabled: parameter: -j$CORES"
read -p "Check if you are satisfied. Enter to continue." i
echo "Installing dependencies (may need password)"
sudo apt install git-core qemu-system-arm -y
sudo apt install gcc-arm-none-eabi -y
sudo apt install dpkg-dev devscripts debhelper clang-3.4 llvm-dev \
uuid-dev libssl-dev libblocksruntime-dev libc6-dev \
gcc-multilib build-essential flex tcsh bison automake \
autogen libtool gobjc libdb-dev u-boot-tools -y
echo "Checking host architecture"
if [ $(getconf WORD_BIT) = '32' ] && [ $(getconf LONG_BIT) = '64' ] ; then
echo "ARCH: 64-bit, Installing libc6-dev-i386"
sudo apt install libc6-dev-i386 -y
else
echo "ARCH: 32-bit, nothing to do"
fi
echo "Downloading source code"
echo "[-- Downloading XNU kernel"
git clone https://gitee.com/pxesrv/xnu
echo "[-- Downloading GenericBooter"
git clone https://gitee.com/pxesrv/GenericBooter
echo "[-- Downloading xnu-deps-linux"
git clone https://gitee.com/pxesrv/xnu-deps-linux
echo "[-- Downloading dtc-AppleDeviceTree"
git clone https://gitee.com/pxesrv/dtc-AppleDeviceTree
echo "[-- Downloading DeviceTrees"
git clone https://gitee.com/pxesrv/DeviceTrees
echo "[-- Downloading ramdisk"
git clone https://gitee.com/pxesrv/ramdisk
echo "[-- Downloading image3maker"
git clone https://gitee.com/pxesrv/image3maker
echo "[-- Downloading darwin-sdk"
git clone https://gitee.com/pxesrv/darwin-sdk
echo "[-- Downloading xnu-patch"
git clone https://gitee.com/pxesrv/xnu-patch
echo "Done."
echo "------START COMPILATION------"
echo "]-- Compiling darwin-sdk"
echo "}---- Processing libtool version"
cd darwin-sdk/cctools
autoreconf -ivf
cd ..
make -j$CORES
echo "[!] Installing darwin-sdk may need to enter password please enter"
sudo make install
cd ..
echo "]-- Compiling xnu-deps-linux"
cd xnu-deps-linux
make -j$CORES
echo "[!] Installing xnu-deps-linux may need to enter password please enter"
sudo make install
cd ..
echo "]-- Compiling image3maker"
cd image3maker
make
cd ..
echo "]-- Compiling XNU Kernel"
echo "}---- Applying patches..."
patch -p0 < xnu-patch/vm_map_patch.patch
cd xnu
make TARGET_CONFIGS="debug arm armpba8" \
NO_DTRACE_SYMS=YES BUILD_INTEGRATED_ASSEMBLER=1 MAKEJOBS=-j$CORES
cd ..
echo "]-- Compiling dtc-AppleDeviceTree"
cd dtc-AppleDeviceTree
make -j$CORES
echo "[!] Installing dtc may need to enter password please enter"
sudo cp dtc /usr/local/bin
cd ..
echo "]-- Compiling DeviceTrees"
cd DeviceTrees
make
cd ..
echo "{-- Generating img3 for GenericBooter"
echo "}---- Kernel"
./image3maker/image3maker -t krnl -f xnu/BUILD/obj/DEBUG_ARM_ARMPBA8/mach_kernel -o GenericBooter/images/Mach.img3
echo "}---- DeviceTree"
./image3maker/image3maker -t dtre -f DeviceTrees/RealView.devicetree -o GenericBooter/images/DeviceTree.img3
echo "}---- Ramdisk"
./image3maker/image3maker -t rdsk -f ramdisk/ramdisk.dmg -o GenericBooter/images/Ramdisk.img3
echo "]-- Compiling GenericBooter"
cd GenericBooter/arch
mkdir ARCH; cd ARCH
echo "{-- Generating default config for GenericBooter"
echo "CONFIG_PROC_CORTEX_A8=y" > defconfig
echo "}---- CONFIG_PROC_CORTEX_A8 Done"
echo "CONFIG_BOARD_ARM_REALVIEW=y" >> defconfig
echo "}---- CONFIG_BOARD_ARM_REALVIEW Done"
echo "CONFIG_DT_SUPPORT_APPLE_FDT=y" >> defconfig
echo "}---- CONFIG_DT_SUPPORT_APPLE_FDT Done"
cd ../..
make defconfig
make -j$CORES CROSS_COMPILE=arm-none-eabi-
echo "[*] uImage generated"
cp uImage ../
cd ..
echo "---SUCCESS---"
echo "STARTING QEMU"
qemu-system-arm -machine realview-pb-a8 -m 512 \
-kernel uImage \
-append "rd=md0 debug=0x16e serial=3 -v symbolicate_panics=1" \
-serial stdio