]> git.ipfire.org Git - ipfire-2.x.git/blob - config/u-boot/boot.cmd
u-boot: split rpi aarch64 quirk into parts
[ipfire-2.x.git] / config / u-boot / boot.cmd
1 if test ${boot_dev} = ""; then
2 setenv boot_dev mmc;
3 setenv root_dev /dev/mmcblk0p3;
4 fi;
5
6 if test ${dev_num} = ""; then
7 setenv dev_num 0;
8 fi;
9
10 if test ${boot_part} = ""; then
11 setenv boot_part ${dev_num}:1;
12 fi;
13
14 if test ${cpu} = "armv8"; then
15 echo ;
16 else
17 setenv kernel_type -multi;
18 fi;
19
20 # Import uEnv txt...
21 if fatload ${boot_dev} ${boot_part} ${kernel_addr_r} uEnv.txt; then
22 echo Load uEnv.txt...;
23 env import -t ${kernel_addr_r} ${filesize};
24 if test "${uenvcmd}" = ""; then
25 echo ...;
26 else
27 echo Boot with uEnv.txt...;
28 run uenvcmd;
29 fi;
30 fi;
31
32 # for compatiblity reasons set DTBSUNXI if we run on sunxi
33 if test "${board}" = "sunxi"; then
34 setenv fdtfile ${DTBSUNXI};
35 fi;
36
37 # Quirk for RPi on aarch64 becuase u-boot cannot use the
38 # initrd on aarch64 and without ramdisk no UUID
39 if test ${cpu} = "armv8"; then
40 if test ${board} = "rpi"; then
41 setenv root_dev /dev/mmcblk0p3;
42 fi;
43 fi;
44
45 # Check if serial console is enabled
46 if test "${SERIAL-CONSOLE}" = "ON"; then
47 if test ${console} = ""; then
48 if test "${board}" = "rpi"; then
49 if test ${cpu} = "armv8"; then
50 if test "${fdtfile}" = "broadcom/bcm2837-rpi-3-b-plus.dtb"; then
51 setenv console ttyS1,115200n8;
52 else
53 if test "${fdtfile}" = "broadcom/bcm2837-rpi-3-b.dtb"; then
54 setenv console ttyS1,115200n8;
55 else
56 setenv console ttyAMA0,115200n8;
57 fi;
58 fi;
59 else
60 if test "${fdtfile}" = "bcm2837-rpi-3-b-plus.dtb"; then
61 setenv console ttyS1,115200n8;
62 else
63 if test "${fdtfile}" = "bcm2837-rpi-3-b.dtb"; then
64 setenv console ttyS1,115200n8;
65 else
66 setenv console ttyAMA0,115200n8;
67 fi;
68 fi;
69 fi;
70 else
71 setenv console ttyS0,115200n8;
72 fi;
73 fi
74 echo Set console to ${console};
75 setenv bootargs console=${console} root=${root_dev} rootwait;
76 else
77 echo Set console to tty1 ;
78 setenv bootargs console=tty1 root=${root_dev} rootwait;
79 fi;
80
81 setenv fdt_high ffffffff;
82 fatload ${boot_dev} ${boot_part} ${kernel_addr_r} vmlinuz-${KVER}-ipfire${kernel_type};
83 fatload ${boot_dev} ${boot_part} ${fdt_addr_r} dtb-${KVER}-ipfire${kernel_type}/${fdtfile};
84
85 if test "${FDTCMDS}" = ""; then
86 echo ;
87 else
88 fdt addr ${fdt_addr_r};
89 run FDTCMDS;
90 fi;
91
92 setenv ramdisk_addr ${ramdisk_addr_r}
93 if fatload ${boot_dev} ${boot_part} ${ramdisk_addr} uInit-${KVER}-ipfire${kernel_type}; then
94 echo Ramdisk loaded...;
95 else
96 echo Ramdisk not loaded...;
97 setenv ramdisk_addr -;
98 fi;
99
100 # Quirk for RPi on aarch64 becuase u-boot cannot use the
101 # initrd on aarch64
102 if test ${cpu} = "armv8"; then
103 if test ${board} = "rpi"; then
104 setenv ramdisk_addr -;
105 fi;
106 fi;
107
108 bootz ${kernel_addr_r} ${ramdisk_addr} ${fdt_addr_r};
109 booti ${kernel_addr_r} ${ramdisk_addr} ${fdt_addr_r};
110
111 bootz ${kernel_addr_r} - ${fdt_addr_r};
112 booti ${kernel_addr_r} - ${fdt_addr_r};
113
114 # Recompile with:
115 # mkimage -C none -A arm -T script -d /boot/boot.cmd /boot/boot.scr