|
| 1 | +# kmake-image-packager |
| 2 | + |
| 3 | +Docker image for packaging bootable Linux kernel artifacts. |
| 4 | + |
| 5 | +This project focuse on generating bootable images (`efi.bin`, `dtb.bin`) from prebuilt kernel artifacts (kernel image and DTB). |
| 6 | + |
| 7 | + |
| 8 | +# TL;DR (Step-by-Step) |
| 9 | + |
| 10 | + |
| 11 | +### 1. Clone kmake-image |
| 12 | + |
| 13 | +```bash |
| 14 | +git clone git@github.com:qualcomm-linux/kmake-image.git |
| 15 | +cd kmake-image |
| 16 | +``` |
| 17 | + |
| 18 | +### 2. Build the Docker Image |
| 19 | + |
| 20 | +You can build the Docker image in one of the following ways. |
| 21 | + |
| 22 | +#### Option A: Simple build |
| 23 | + |
| 24 | +```bash |
| 25 | +docker build -f CI/Dockerfile.ci -t kmake-image-ci . |
| 26 | +``` |
| 27 | + |
| 28 | +#### Option B: Build with user mapping (recommended) |
| 29 | + |
| 30 | +This avoids file permission issues on generated artifacts. |
| 31 | + |
| 32 | +```bash |
| 33 | +docker build \ |
| 34 | + --build-arg USER_ID=$(id -u) \ |
| 35 | + --build-arg GROUP_ID=$(id -g) \ |
| 36 | + --build-arg USER_NAME=$(whoami) \ |
| 37 | + -f CI/Dockerfile.ci \ |
| 38 | + -t kmake-image-ci . |
| 39 | +``` |
| 40 | + |
| 41 | +### 3. Set up the alias in your `.bashrc` |
| 42 | + |
| 43 | +Add the following alias: |
| 44 | + |
| 45 | +```bash |
| 46 | +alias kmake-image-ci='docker run -it --rm \ |
| 47 | + --user $(id -u):$(id -g) \ |
| 48 | + --workdir="$PWD" \ |
| 49 | + -v "$(dirname "$PWD")":"$(dirname "$PWD")" \ |
| 50 | + kmake-image-ci' |
| 51 | +``` |
| 52 | + |
| 53 | +Apply the change: |
| 54 | + |
| 55 | +```bash |
| 56 | +source ~/.bashrc |
| 57 | +``` |
| 58 | + |
| 59 | +### Prerequisites (Required Artifacts) |
| 60 | + |
| 61 | +Before generating `efi.bin`, ensure the following artifacts are available locally: |
| 62 | + |
| 63 | +- **Kernel Image**: `Image` (uncompressed) |
| 64 | +- **Ramdisk**: `initrd.cpio.gz` |
| 65 | +- **Target DTB**: example `qcs6490-rb3gen2.dtb` |
| 66 | + |
| 67 | +### 4. Generate `efi.bin` |
| 68 | + |
| 69 | +Run the EFI image generation command: |
| 70 | + |
| 71 | +```bash |
| 72 | +kmake-image-ci generate_boot_bins.sh efi \ |
| 73 | + --ramdisk artifacts/initrd.cpio.gz \ |
| 74 | + --systemd-boot /artifacts/systemd/usr/lib/systemd/boot/efi/systemd-bootaa64.efi \ |
| 75 | + --stub /artifacts/systemd/usr/lib/systemd/boot/efi/linuxaa64.efi.stub \ |
| 76 | + --linux artifacts/Image \ |
| 77 | + --cmdline "console=ttyMSM0,115200n8 copy-modules rootdelay=10 root=PARTLABEL=rootfs rw rootwait qcom_geni_serial.con_enabled=1" \ |
| 78 | + --output images |
| 79 | +``` |
| 80 | + |
| 81 | +### 5. Generate `dtb.bin` |
| 82 | +*(For targets supporting a DTB partition)* |
| 83 | + |
| 84 | +```bash |
| 85 | +kmake-image-ci generate_boot_bins.sh dtb \ |
| 86 | + --input artifacts/qcs6490-rb3gen2.dtb \ |
| 87 | + --output images |
| 88 | +``` |
| 89 | + |
| 90 | +### 6. Output |
| 91 | + |
| 92 | +The generated files: |
| 93 | + |
| 94 | +- `efi.bin` |
| 95 | +- `dtb.bin` |
| 96 | + |
| 97 | +are available in the `images/` directory and are ready to be booted on |
| 98 | +**QCS6490 RB3Gen2**. |
| 99 | + |
0 commit comments