|
| 1 | +# Building |
| 2 | + |
| 3 | +We choose [Yocto Project](https://www.yoctoproject.org/) to prepare Dasharo |
| 4 | +Tools Suite system. DTS image can be built using publicly available sources. |
| 5 | +Thanks to publishing the build cache on |
| 6 | +[cache.dasharo.com](https://cache.dasharo.com/yocto/dts/) the time needed to |
| 7 | +finish the process should be significantly decreased. |
| 8 | + |
| 9 | +## Prerequisites |
| 10 | + |
| 11 | +The following must be met to build DTS: |
| 12 | + |
| 13 | +* Linux PC (tested on `Ubuntu 20.04 LTS`), |
| 14 | +* [docker](https://docs.docker.com/install/linux/docker-ce/ubuntu/) installed, |
| 15 | +* [kas-container 3.0.2](https://raw.githubusercontent.com/siemens/kas/3.0.2/kas-container) |
| 16 | + script downloaded and available in [PATH](https://en.wikipedia.org/wiki/PATH_(variable)), |
| 17 | + |
| 18 | +```bash |
| 19 | +wget -O ~/bin/kas-container https://raw.githubusercontent.com/siemens/kas/3.0.2/kas-container |
| 20 | +``` |
| 21 | + |
| 22 | +```bash |
| 23 | +chmod +x ~/bin/kas-container |
| 24 | +``` |
| 25 | + |
| 26 | +* `meta-dts` repository cloned. |
| 27 | + |
| 28 | +```bash |
| 29 | +mkdir yocto && cd yocto |
| 30 | +``` |
| 31 | + |
| 32 | +```bash |
| 33 | +git clone https://github.com/Dasharo/meta-dts.git |
| 34 | +``` |
| 35 | + |
| 36 | +## Build |
| 37 | + |
| 38 | +From `yocto` directory, run: |
| 39 | + |
| 40 | +```shell |
| 41 | +SHELL=/bin/bash kas-container build meta-dts/kas.yml |
| 42 | +``` |
| 43 | + |
| 44 | +Image build takes time, so be patient, and the build's finished, you should see |
| 45 | +something similar to (tasks number may differ): |
| 46 | + |
| 47 | +```shell |
| 48 | +Initialising tasks: 100% |###########################################################################################| Time: 0:00:01 |
| 49 | +Sstate summary: Wanted 2 Found 0 Missed 2 Current 931 (0% match, 99% complete) |
| 50 | +NOTE: Executing Tasks |
| 51 | +NOTE: Tasks Summary: Attempted 2532 tasks of which 2524 didn't need to be rerun and all succeeded. |
| 52 | +``` |
| 53 | +
|
| 54 | +Using the cache is enabled in `kas/cache.yml` file and can be disabled by |
| 55 | +removing content of that file. |
| 56 | +
|
| 57 | +```bash |
| 58 | +cat kas/cache.yml |
| 59 | +``` |
| 60 | +
|
| 61 | +output: |
| 62 | +
|
| 63 | +```bash |
| 64 | +--- |
| 65 | +header: |
| 66 | + version: 11 |
| 67 | +
|
| 68 | +local_conf_header: |
| 69 | + yocto-cache: | |
| 70 | + SSTATE_MIRRORS ?= "file://.* http://${LOCAL_PREMIRROR_SERVER}/${PROJECT_NAME}/sstate-cache/PATH" |
| 71 | + SOURCE_MIRROR_URL ?= "http://${LOCAL_PREMIRROR_SERVER}/${PROJECT_NAME}/downloads" |
| 72 | + INHERIT += "own-mirrors" |
| 73 | + LOCAL_PREMIRROR_SERVER ?= "cache.dasharo.com" |
| 74 | + PROJECT_NAME ?= "yocto/dts" |
| 75 | +``` |
| 76 | +
|
| 77 | +### Build image with UEFI Secure Boot support |
| 78 | +
|
| 79 | +From `yocto` directory run: |
| 80 | +
|
| 81 | +```shell |
| 82 | +SHELL=/bin/bash kas-container build meta-dts/kas-uefi-sb.yml |
| 83 | +``` |
| 84 | +
|
| 85 | +Image build takes time, so be patient and after build's finish you should see |
| 86 | +something similar to (the exact tasks numbers may differ): |
| 87 | + |
| 88 | +```shell |
| 89 | +Initialising tasks: 100% |###########################################################################################| Time: 0:00:04 |
| 90 | +Checking sstate mirror object availability: 100% |###################################################################| Time: 0:00:03 |
| 91 | +Sstate summary: Wanted 892 Local 672 Mirrors 212 Missed 8 Current 1560 (99% match, 99% complete) |
| 92 | +NOTE: Executing Tasks |
| 93 | +NOTE: Tasks Summary: Attempted 5860 tasks of which 5841 didn't need to be rerun and all succeeded. |
| 94 | +``` |
| 95 | + |
| 96 | +Image created with `kas-uefi-sb.yml` configuration file enable integration of |
| 97 | +UEFI Secure Boot into DTS using |
| 98 | +[meta-secure-core](https://github.com/jiazhang0/meta-secure-core/). Building the |
| 99 | +image allow to prepare a PoC version with [uses sample |
| 100 | +keys](https://github.com/jiazhang0/meta-secure-core/tree/master/meta-efi-secure-boot#sample-keys) |
| 101 | +which by no mean should used in production. For user keys the script |
| 102 | +[create-user-key-store.sh](https://github.com/jiazhang0/meta-secure-core/blob/master/meta-signing-key/scripts/create-user-key-store.sh) |
| 103 | +can be used but it was not tested yet. Quick start with instructions on how to |
| 104 | +use image are described in |
| 105 | +[meta-efi-secure-boot](https://github.com/jiazhang0/meta-secure-core/tree/master/meta-efi-secure-boot#quick-start-for-the-first-boot). |
| 106 | + |
| 107 | +## Flash |
| 108 | + |
| 109 | +* Find out your device name. |
| 110 | + |
| 111 | +```shell |
| 112 | +fdisk -l |
| 113 | +``` |
| 114 | + |
| 115 | +output: |
| 116 | + |
| 117 | +```shell |
| 118 | +(...) |
| 119 | +Device Boot Start End Sectors Size Id Type |
| 120 | +/dev/sdx1 * 8192 131433 123242 60,2M c W95 FAT32 (LBA) |
| 121 | +/dev/sdx2 139264 186667 47404 23,2M 83 Linux |
| 122 | +``` |
| 123 | + |
| 124 | +In this case the device name is `/dev/sdx`, **but be aware, in the next steps, |
| 125 | +replace `/dev/sdx` with the right device name on your platform, or else you can |
| 126 | +damage your system!** |
| 127 | + |
| 128 | +* From where you ran image build type. |
| 129 | + |
| 130 | +```shell |
| 131 | +sudo umount /dev/sdx* |
| 132 | +``` |
| 133 | + |
| 134 | +```shell |
| 135 | +cd build/tmp/deploy/images/genericx86-64 |
| 136 | +``` |
| 137 | + |
| 138 | +Here the file `dts-base-image-genericx86-64.wic.gz` should be available, which |
| 139 | +is the image of DTS. To flash image, you can use the same command shown in |
| 140 | +[running section](#launching-dts_1). Just change the file name. |
| 141 | + |
| 142 | +* Boot the platform. |
0 commit comments