-
Notifications
You must be signed in to change notification settings - Fork 50
/
Copy pathcompile_mmc.sh
185 lines (118 loc) · 6.28 KB
/
compile_mmc.sh
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
#!/bin/bash
##::[[--- Ubuntu 14 ClearFog MMC Image Creation ---]]::##
#================================================================
# Title: compile_mmc.sh
# Description: Creates the required U-Boot UART & MMC Images
# Author: JW0914
# Created: 2018.01.24
# Updated: 2018.01.24
# Version: 1.0
# Usage: chmod +x ./compile_mm.sh && ./compile_mmc.sh
#================================================================
# NOTE:
# Due to SolidRun not maintaining their repo, I recommend
# utilizing Ubuntu 14 (requires the least amount of hassle),
# as their repo requires a max GCC version of 4.x
# Paramaters #
#----------------------------------------------------------------
# User Name:
user="$(echo $USER)"
# Directories
WD="/home/$user/compile"
UB="$WD/u-boot-armada38x"
# Commands:
ag="sudo apt-get"
# Packages (U-Boot & OpenWrt)
PreReqs="asciidoc bash bc bcc bin86 binutils build-essential bzip2 cl-getopt cryptsetup fastjar flex gawk gcc gcc-arm-none-eabi gcc-multilib genisoimage gettext git-core intltool jikespg libboost1.55-dev libgtk-3-dev libncurses5-dev libssl-dev libusb-dev libxml-parser-perl make mercurial openjdk-7-jdk patch perl-modules python3-dev rsync ruby sdcc sharutils subversion u-boot-tools util-linux unzip wget xsltproc zlib1g-dev"
# Prepare #
#----------------------------------------------------------------
sudo echo
printf "\n\n\n # Prepararations #\n"
printf %b "============================================================\n"
# Update:
printf "\n\n\n...Updating Package Lists...\n"
printf %b "----------------------------\n\n"
$ag update && printf "\n\n ----- DONE: Updating Package Lists -----\n"
# Install Packages:
printf "\n\n\n...Installing Prequisite Packages...\n"
printf %b "------------------------------------\n\n"
$ag install $PreReqs && printf "\n\n ----- DONE: Installed Prerequisite Packages -----\n"
# Package Maintainance #
#----------------------------------------------------------------
printf "\n\n\n # Package Maintainance #\n"
printf %b "============================================================\n"
# Upgrade Packages:
printf "\n\n\n...Checking for Package Upgrades...\n"
printf %b "-----------------------------------\n\n"
$ag upgrade && printf "\n\n ----- DONE: Upgraded Any Required Packages -----\n"
# Remove Unused
printf "\n\n\n...Removing Unused Packages...\n"
printf %b "------------------------------\n\n"
$ag autoremove && printf "\n\n ----- DONE: Removed Any Unused Packages -----\n"
# Check Broken Dependencies
printf "\n\n\n...Checking for Broken Dependencies...\n"
printf %b "--------------------------------------\n\n"
$ag check && printf "\n\n ----- DONE: Checked for Broken Dependencies -----\n"
# Build Environment #
#----------------------------------------------------------------
printf "\n\n\n # Build Environment: Create #\n"
printf %b "============================================================\n"
# Clone:
printf "\n\n\n...Cloning U-Boot Armada38X Repo...\n"
printf %b "-----------------------------------\n\n"
mkdir -p $WD && cd $WD
git clone https://github.com/SolidRun/u-boot-armada38x.git
printf "\n\n ----- DONE: Armada38X Repo Cloned -----\n"
# Own & Enter:
printf "\n\n\n...Own & Enter...\n"
printf %b "-----------------\n\n"
sudo chown -R $user:$user $UB && cd $UB
printf "\n\n ----- DONE: Ownership Obtained & Directory Entered -----\n"
# Configure #
#----------------------------------------------------------------
printf "\n\n\n # Build Environment: Configure & Make #\n"
printf %b "============================================================\n"
# Update Repo:
printf "\n\n\n...Exporting Toolchain...\n"
printf %b "-------------------------\n\n"
export CROSS_COMPILE=arm-none-eabi- && printf "\n\n ----- DONE: Toolchain Prefix Exported -----\n"
# Make Config
printf "\n\n\n...Making Config...\n"
printf %b "-------------------\n\n"
make armada_38x_clearfog_config && printf "\n\n ----- DONE: ClearFog Armada38X Config Generated -----\n"
printf "\n\n\n...Making Boot Files...\n"
printf %b "-----------------------\n\n"
make u-boot.mmc && printf "\n\n ----- DONE: eMMC & UART Boot Files Created -----\n"
# Verify Created Files #
#----------------------------------------------------------------
printf "\n\n\n # Verify Created Files #\n"
printf %b "============================================================\n"
# Update Repo:
printf "\n\n\n...MMC Boot Files...\n"
printf %b "--------------------\n\n"
ls -AFls $UB/*.mmc
# Boot & Flash ClearFog #
#----------------------------------------------------------------
printf %b "\n\n\n============================================================\n"
printf " # Boot and Flash CLearFog #\n"
printf %b "============================================================\n"
# Boot from UART:
( printf "\n\n\n To boot in UART mode\n"
printf %b " ----------------------\n" )
printf "\n\n - Issue: sudo ./download-serial.sh /dev/ttyUSB0 u-boot-uart.mmc"
printf "\n - Loads UART image in memory to access U-Boot terminal"
printf "\n\n - Issue: sudo kwboot -t /dev/ttyUSB0 -B 115200n8"
printf "\n - Opens a serial terminal for U-Boot\n"
printf "\n\n Follow this wiki:"
printf "\n\n - https://clockworkbird9.wordpress.com/2016/10/06/armada-388-clearfog-install-lede-into-emmc-in-an-easy-way/"
printf %b "\n\n\n============================================================\n\n"
# Executing download-serial.sh
printf "\n\n\n...Executing download-serial.sh...\n"
printf %b "------------------------------------\n\n"
xterm -hold -T "Loading UART image into RAM" -e "sudo /home/$(echo $USER)/compile/u-boot-armada38x/download-serial.sh /dev/ttyUSB0 /home/$(echo $USER)/compile/u-boot-armada38x/u-boot-uart.mmc && sudo kwboot -t /dev/ttyUSB0 -B 115200n8" &
printf %b "\n\n ----- DONE: Loaded UART Image & U-Boot Terminal -----\n"
# Done #
#--------------------------------------
printf "\n\n\n...Script completed...\n"
printf %b "----------------------\n\n\n"
exit 0