-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall-arch-arch-rpi5.sh
More file actions
56 lines (43 loc) · 1.6 KB
/
install-arch-arch-rpi5.sh
File metadata and controls
56 lines (43 loc) · 1.6 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
#!/bin/sh
# Variables:
export SDDEV="/dev/sdX"
export SDPARTBOOT="${SDDEV}1"
export SDPARTROOT="${SDDEV}2"
export SDMOUNT="/mnt/sdrpi"
export DOWNLOADDIR="/tmp/pi"
export DISTURL="https://fl.us.mirror.archlinuxarm.org/os/ArchLinuxARM-rpi-aarch64-latest.tar.gz"
# Crear directorio de descarga
mkdir -p "$DOWNLOADDIR"
# Descargar Arch Linux ARM
(
cd "$DOWNLOADDIR" || exit 1
curl -JLO "$DISTURL"
)
# Desmontar particiones si están montadas (para evitar errores)
umount "$SDPARTBOOT" 2>/dev/null
umount "$SDPARTROOT" 2>/dev/null
# Formatear particiones
mkfs.vfat -n BOOT -F32 "$SDPARTBOOT"
mkfs.ext4 -L ROOT -E lazy_itable_init=0,lazy_journal_init=0 -F "$SDPARTROOT"
# Montar particiones
mkdir -p "$SDMOUNT"
mount "$SDPARTROOT" "$SDMOUNT"
mkdir -p "${SDMOUNT}/boot"
mount "$SDPARTBOOT" "${SDMOUNT}/boot"
# Extraer sistema de archivos Arch Linux ARM
bsdtar -xpf "${DOWNLOADDIR}/ArchLinuxARM-rpi-aarch64-latest.tar.gz" -C "$SDMOUNT"
# Eliminar U-Boot y el kernel principal manualmente
rm -rf "${SDMOUNT}/boot/*"
# Agregar el kernel de la Fundación Raspberry Pi
mkdir -p "${DOWNLOADDIR}/linux-rpi"
pushd "${DOWNLOADDIR}/linux-rpi" || exit 1
# Si el enlace no funciona, encuentra una nueva versión aquí: http://fl.us.mirror.archlinuxarm.org/aarch64/core/
curl -JLO http://fl.us.mirror.archlinuxarm.org/aarch64/core/linux-rpi-6.12.6-1-aarch64.pkg.tar.xz
# Extracción y copia del kernel
tar xf linux-rpi*aarch64.pkg.tar.xz
cp -rf boot/* "${SDMOUNT}/boot/"
popd
# Desmontar la tarjeta SD de manera segura
sync
umount -R "$SDMOUNT"
echo "Ahora, retire la tarjeta microSD y arranque su Raspberry Pi para completar la instalación."