-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDownloading & Building U-Boot.sh
More file actions
54 lines (46 loc) · 1.39 KB
/
Copy pathDownloading & Building U-Boot.sh
File metadata and controls
54 lines (46 loc) · 1.39 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
#!/bin/bash
# 1. Update package lists
echo "Updating package lists..."
sudo apt update
# 2. Install Dependencies
# Combined into a single command for efficiency.
# Removed duplicate entries (device-tree-compiler).
echo "Installing dependencies..."
sudo apt install -y \
gcc-arm-linux-gnueabihf \
build-essential \
git \
device-tree-compiler \
qemu-system-arm \
flex \
bison \
libssl-dev \
bc
# 3. Clone U-Boot Repository
echo "Cloning U-Boot repository..."
git clone git://git.denx.de/u-boot.git
cd u-boot || { echo "Failed to enter u-boot directory"; exit 1; }
# 4. Checkout specific version
# Corrected typo from 'v.2023.10' to standard tag format 'v2023.10'
echo "Checking out version v2023.10..."
git checkout v2023.10
# 5. Set Environment Variables
# Setting these exports ensures the makefile targets the correct architecture
export ARCH=arm
export CROSS_COMPILE=arm-linux-gnueabihf-
# 6. Configure U-Boot for Raspberry Pi Zero W
# 'rpi_0_w_defconfig' is the specific configuration for RPi Zero W
echo "Configuring U-Boot..."
make rpi_0_w_defconfig
# 7. Build U-Boot
# -j$(nproc) uses all available CPU cores to speed up compilation
echo "Building U-Boot..."
make -j$(nproc)
# 8. Test U-Boot on QEMU
echo "Starting QEMU..."
# Note: Ensure you have a QEMU version that supports the 'raspi0' machine
qemu-system-arm \
-M raspi0 \
-m 512M \
-nographic \
-kernel u-boot