Skip to content

Commit 3575d2f

Browse files
committed
README: Revamp as to merge RB1 instructions
Cleanup and simplify instructions, dropping RB1 specific section. Signed-off-by: Loïc Minier <[email protected]>
1 parent 4b170a2 commit 3575d2f

File tree

1 file changed

+64
-164
lines changed

1 file changed

+64
-164
lines changed

README.md

Lines changed: 64 additions & 164 deletions
Original file line numberDiff line numberDiff line change
@@ -12,37 +12,83 @@ main: Primary development branch. Contributors should develop submissions based
1212

1313
## Requirements
1414

15-
[debos](https://github.com/go-debos/debos) is required to build the debos recipes. Recent debos packages should be available in Debian and Ubuntu repositories; there are
16-
[debos installation instructions](https://github.com/go-debos/debos?tab=readme-ov-file#installation-from-source-under-debian) on the project's page, notably for Docker images and to build debos from source. Make sure to use at least version 1.1.5 which supports setting the sector size.
15+
[debos](https://github.com/go-debos/debos) is required to build the debos recipes. Recent debos packages should be available in Debian and Ubuntu repositories; there are [debos installation instructions](https://github.com/go-debos/debos?tab=readme-ov-file#installation-from-source-under-debian) on the project's page, notably for Docker images and to build debos from source. Make sure to use at least version 1.1.5 which supports setting the sector size.
1716

1817
[qdl](https://github.com/linux-msm/qdl) is typically used for flashing. While recent versions are available in Debian and Ubuntu, make sure to use at least version 2.1 as it contains important fixes.
1918

20-
## Usage
19+
### Optional requirements
2120

22-
To build flashable assets, run debos as follows:
21+
Building U-Boot for the RB1 requires the following build-dependencies:
2322
```bash
24-
# build tarballs of the root filesystem and DTBs
25-
debos debos-recipes/qualcomm-linux-debian-rootfs.yaml
26-
27-
# build disk and filesystem images from the root filesystem; the default is to
28-
# build an UFS image
29-
debos debos-recipes/qualcomm-linux-debian-image.yaml
23+
apt -y install git crossbuild-essential-arm64 make bison flex bc libssl-dev gnutls-dev xxd coreutils gzip mkbootimg
24+
```
3025

31-
# build flashable assets from the DTBs and UFS filesystem images; currently these
32-
# are only built for the RB3 Gen2 Vision Kit board
33-
debos debos-recipes/qualcomm-linux-debian-flash.yaml
26+
Building a Linux kernel deb requires the following build-dependencies:
27+
```bash
28+
apt -y install git crossbuild-essential-arm64 make flex bison bc libelf-dev libssl-dev libssl-dev:arm64 dpkg-dev debhelper-compat kmod python3 rsync coreutils
3429
```
3530

31+
## Usage
32+
33+
To build flashable assets for all supported boards, follow these steps:
34+
35+
1. (optional) build U-Boot for the RB1
36+
```bash
37+
scripts/build-u-boot-rb1.sh
38+
```
39+
40+
1. (optional) build a local Linux kernel deb from mainline with a recommended config fragment
41+
```bash
42+
scripts/build-linux-deb.sh kernel-configs/systemd-boot.config
43+
```
44+
45+
1. build tarballs of the root filesystem and DTBs
46+
```bash
47+
debos debos-recipes/qualcomm-linux-debian-rootfs.yaml
48+
49+
# (optional) if you've built a local kernel, copy it to local-debs/ and run
50+
# this instead:
51+
#debos -t localdebs:local-debs/ debos-recipes/qualcomm-linux-debian-rootfs.yaml
52+
```
53+
54+
1. build disk and filesystem images from the root filesystem tarball
55+
```bash
56+
# the default is to build an UFS image
57+
debos debos-recipes/qualcomm-linux-debian-image.yaml
58+
59+
# (optional) if you want SD card images or support for eMMC boards, run
60+
# this as well:
61+
debos -t imagetype:sdcard debos-recipes/qualcomm-linux-debian-image.yaml
62+
```
63+
64+
1. build flashable assets from downloaded boot binaries, the DTBs, and pointing at the UFS/SD card disk images
65+
```bash
66+
debos debos-recipes/qualcomm-linux-debian-flash.yaml
67+
68+
# (optional) if you've built U-Boot for the RB1, run this instead:
69+
#debos -t u_boot_rb1:u-boot/rb1-boot.img debos-recipes/qualcomm-linux-debian-flash.yaml
70+
```
71+
72+
1. enter Emergency Download Mode (see section below) and flash the resulting images with QDL
73+
```bash
74+
# for RB3 Gen2 Vision Kit or UFS boards in general
75+
cd flash_rb3gen2-vision-kit
76+
qdl --storage ufs prog_firehose_ddr.elf rawprogram[0-9].xml patch[0-9].xml
77+
78+
# for RB1 or eMMC boards in general
79+
qdl --allow-missing --storage emmc prog_firehose_ddr.elf rawprogram[0-9].xml patch[0-9].xml
80+
```
81+
3682
### Debos tips
3783

38-
By default, debos will try to pick a fast build backend; it will try to use its KVM backend ("-b kvm") when available, and otherwise an UML environment ("-b uml"). If none of these work, a solid backend is QEMU ("-b qemu"); because the target images are arm64, this can be really slow when building from another architecture such as amd64.
84+
By default, debos will try to pick a fast build backend. It will prefer to use its KVM backend (`-b kvm`) when available, and otherwise an UML environment (`-b uml`). If none of these work, a solid backend is QEMU (`-b qemu`). Because the target images are arm64, building under QEMU can be really slow, especially when building from another architecture such as amd64.
3985

4086
To build large images, the debos resource defaults might not be sufficient. Consider raising the default debos memory and scratchsize settings. This should provide a good set of minimum defaults:
4187
```bash
4288
debos --fakemachine-backend qemu --memory 1GiB --scratchsize 4GiB debos-recipes/qualcomm-linux-debian-image.yaml
4389
```
4490

45-
### Build options
91+
### Options for debos recipes
4692

4793
A few options are provided in the debos recipes; for the root filesystem recipe:
4894
- `experimentalkernel`: update the linux kernel to the version from experimental; default: don't update the kernel
@@ -70,12 +116,11 @@ debos -t dtb:qcom/qcs6490-rb3gen2.dtb debos-recipes/qualcomm-linux-debian-image.
70116
debos -t imagetype:sdcard debos-recipes/qualcomm-linux-debian-image.yaml
71117
```
72118

73-
## Flashing Instructions
74-
### Overview
119+
### Flashing tips
75120

76121
The `disk-sdcard.img` disk image can simply be written to a SD card, albeit most Qualcomm boards boot from internal storage by default. With an SD card, the board will use boot firmware from internal storage (eMMC or UFS) and do an EFI boot from the SD card if the firmware can't boot from internal storage.
77122
78-
If there is no need to update the boot firmware, the `disk-ufs.img` disk image can also be flashed on the first LUN of the internal UFS storage with [qdl](https://github.com/linux-msm/qdl). Create a `rawprogram-ufs.xml` file as follows:
123+
For UFS boards, if there is no need to update the boot firmware, the `disk-ufs.img` disk image can also be flashed on the first LUN of the internal UFS storage with [qdl](https://github.com/linux-msm/qdl). Create a `rawprogram-ufs.xml` file as follows:
79124
```xml
80125
<?xml version="1.0" ?>
81126
<data>
@@ -86,14 +131,7 @@ Put the board in "emergency download mode" (EDL; see next section) and run:
86131
```bash
87132
qdl --storage ufs prog_firehose_ddr.elf rawprogram-ufs.xml
88133
```
89-
Make sure to use `prog_firehose_ddr.elf` for the target platform, such as this [version from the QCM6490 boot binaries](https://softwarecenter.qualcomm.com/download/software/chip/qualcomm_linux-spf-1-0/qualcomm-linux-spf-1-0_test_device_public/r1.0_00058.0/qcm6490-le-1-0/common/build/ufs/bin/QCM6490_bootbinaries.zip).
90-
91-
To flash a complete set of assets on UFS internal storage, put the board in EDL mode and run:
92-
```bash
93-
# use the RB3 Gen2 Vision Kit flashable assets
94-
cd flash_rb3gen2-vision-kit
95-
qdl --storage ufs prog_firehose_ddr.elf rawprogram[0-9].xml patch[0-9].xml
96-
```
134+
Make sure to use `prog_firehose_ddr.elf` for the target platform, such as this [version from the QCM6490 boot binaries](https://softwarecenter.qualcomm.com/download/software/chip/qualcomm_linux-spf-1-0/qualcomm-linux-spf-1-0_test_device_public/r1.0_00058.0/qcm6490-le-1-0/common/build/ufs/bin/QCM6490_bootbinaries.zip) or this [version from the RB1 rescue image](https://releases.linaro.org/96boards/rb1/linaro/rescue/23.12/rb1-bootloader-emmc-linux-47528.zip).
97135
98136
### Emergency Download Mode (EDL)
99137
@@ -109,144 +147,6 @@ To enter EDL mode:
109147

110148
NB: It's also possible to run qdl from the host while the baord is not connected, and starting the board directly in EDL mode.
111149
112-
### RB1 instructions (alpha)
113-
114-
The RB1 board boots from eMMC by default and uses an Android style boot architecture. Read-on to flash a disk image to the eMMC storage of the RB1 board and emulate an UEFI boot architecture.
115-
116-
#### Build disk-sdcard.img with debos
117-
As above, build a SD card image as it's using a 512 sector size, like eMMC on the RB1:
118-
```bash
119-
debos \
120-
--fakemachine-backend qemu \
121-
--memory 1GiB \
122-
--scratchsize 4GiB \
123-
-t xfcedesktop:true \
124-
debos-recipes/qualcomm-linux-debian-rootfs.yaml
125-
debos \
126-
--fakemachine-backend qemu \
127-
--memory 1GiB \
128-
--scratchsize 4GiB \
129-
-t dtb:qcom/qrb2210-rb1.dtb \
130-
-t imagetype:sdcard \
131-
debos-recipes/qualcomm-linux-debian-image.yaml
132-
```
133-
134-
#### Build U-Boot with RB1 support
135-
136-
U-Boot will be chainloaded from the first Android boot partition.
137-
138-
A convenience shell script is provided to checkout the relevant U-Boot branch and to build U-Boot for RB1 and wrap it in an Android boot image.
139-
140-
```bash
141-
sudo apt install git build-essential crossbuild-essential-arm64 flex bison \
142-
libssl-dev gnutls-dev mkbootimg
143-
144-
scripts/build-u-boot-rb1.sh
145-
```
146-
147-
#### Build an upstream Linux kernel to workaround boot issues
148-
149-
Linux 6.14 or later will just work, but 6.13 kernels need `CONFIG_CLK_QCM2290_GPUCC=m` ([upstream submission](https://lore.kernel.org/linux-arm-msm/[email protected]/))
150-
151-
In any case, make sure to set `CONFIG_EFI_ZBOOT=y` as [systemd-boot won't implement support for compressed images (zImage)](https://github.com/systemd/systemd/issues/23788); the kernel config fragment in `kernel-configs/systemd-boot.config` does this.
152-
153-
1. A convenience shell script is provided to checkout the latest kernel and build a deb package from it with the above config.
154-
```bash
155-
sudo apt install git crossbuild-essential-arm64 make flex bison bc \
156-
libelf-dev libssl-dev dpkg-dev debhelper-compat kmod python3 rsync \
157-
coreutils
158-
scripts/build-linux-deb.sh kernel-configs/systemd-boot.config
159-
```
160-
161-
1. on an arm64 capable machine, chroot into the disk image's root filesystem, mount the ESP and install the kernel
162-
```bash
163-
# this mounts the image and starts a shell in the chroot
164-
host% sudo scripts/disk-image-edit.sh disk-sdcard.img 512
165-
chroot#
166-
167-
# in another shell on the host, copy the kernel .deb to /mnt/root
168-
host% chroot sudo cp linux-image-6.13.0_6.13.0-1_arm64.deb /mnt/root/
169-
170-
# from within the chroot, mount ESP and install the kernel
171-
chroot# mount /boot/efi
172-
chroot# dpkg -i /root/linux-image-6.13.0_6.13.0-1_arm64.deb
173-
# uncompress the kernel as systemd-boot doesn’t handle these
174-
chroot# zcat /boot/efi/*/6.13*/linux >/tmp/linux
175-
chroot# mv /tmp/linux /boot/efi/*/6.13*/linux
176-
# update systemd entry to point at uncompressed kernel
177-
vi /boot/efi/…
178-
chroot# umount /boot/efi
179-
180-
# leave chroot and unmount image
181-
chroot# exit
182-
```
183-
184-
#### Extract the root and ESP partitions from the disk image
185-
186-
This will create disk-sdcard.img1 and disk-sdcard.img2:
187-
```bash
188-
fdisk -l disk-sdcard.img | sed -n '1,/^Device/ d; p' |
189-
while read name start end sectors rest; do
190-
dd if=disk-sdcard.img of="${name}" bs=512 skip="${start}" count="${sectors}"
191-
done
192-
```
193-
194-
#### Prepare a flashable image
195-
196-
1. download and unpack the [Linux eMMC RB1 recovery image version 23.12 from Linaro](https://releases.linaro.org/96boards/rb1/linaro/rescue/23.12/)
197-
198-
1. edit rawprogram0.xml and change the filename for the following partitions to these values to match files generated earlier:
199-
200-
|label|filename|
201-
|---|---|
202-
|`boot_a`|`u-boot-abootimg.img`|
203-
|`esp`|`disk-sdcard.img1`|
204-
|`rootfs`|`disk-sdcard.img2`|
205-
206-
#### Flash the image
207-
208-
You probably want to connect to the serial port during the whole process, to follow what’s happening on the target. Plug the type-B USB cable to your host and access the serial console with 115200 8N1, e.g. with screen:
209-
210-
Linux (tweak the name of the device):
211-
```bash
212-
screen /dev/ttyUSB* 115200
213-
```
214-
macOS (tweak the name of the device):
215-
```bash
216-
screen /dev/cu.usbserial-* 115200
217-
```
218-
219-
Make sure that the 6th switch on the `DIP_SW_1` bank next to the eMMC is `ON` as to use the USB type-C port for flashing.
220-
221-
Put the board in "emergency download" mode (EDL) by removing any cable from the USB type-C port, and pressing the `F_DL` button while turning the power on.
222-
223-
Connect a cable from the flashing host to the USB type-C port on the board.
224-
225-
Unpack the pre-built tarball and run:
226-
```bash
227-
qdl --storage emmc prog_firehose_ddr.elf rawprogram*.xml patch*.xml
228-
```
229-
230-
You should see:
231-
```
232-
Waiting for EDL device
233-
waiting for programmer...
234-
flashed "xbl_a" successfully
235-
[...]
236-
partition 0 is now bootable
237-
```
238-
239-
And the board should boot to a LightDM greeter on HDMI. Login to the serial console or Xfce session with user / password debian / debian.
240-
241-
The USB ports and Ethernet should work after flipping the 6th switch on the `DIP_SW_1` bank next to the eMMC to `OFF`.
242-
243-
#### Installing “qbootctl” to reset the reboot counter on boot
244-
245-
In the installed Debian system, install “qbootctl” to make the current Android boot image as a successful:
246-
```bash
247-
sudo apt install qbootctl
248-
```
249-
250150
## Development
251151
252152
Want to join in the development? Changes welcome! See [CONTRIBUTING.md file](CONTRIBUTING.md) for step by step instructions.

0 commit comments

Comments
 (0)