| 83 | |
| 84 | === Option C Details |
| 85 | |
| 86 | This involves a custom_rootfs script used in conjuction with the Venice BSP ([wiki:venice/bsp]) |
| 87 | |
| 88 | Before doing any of the following, be sure to build the Venice BSP once successfully before injecting any changes. |
| 89 | |
| 90 | In the Venice BSP Makefile, on line 256, there is a hook for a custom_rootfs script to be ran. |
| 91 | [https://github.com/Gateworks/bsp-venice/blob/master/Makefile#L256] |
| 92 | |
| 93 | Basically, drop a file inside of the main directory when building the Venice BSP with the name starting with custom_rootfs will be ran. Example file name is custom_rootfs_test.sh |
| 94 | {{{ |
| 95 | builder@jammy:~/venice$ ls |
| 96 | Makefile buildroot firmware-imx-8.10 ftdi-usb-spi linux-venice.tar.xz noble-venice.ext4.xz setup-environment uboot-env.bin |
| 97 | atf cryptodev-linux firmware-imx-8.10.bin gnss_devkit mkimage_jtag noble-venice.img.gz u-boot venice |
| 98 | build custom_rootfs_test.sh firmware.img linux noble-venice.ext4 nrc7292 ublox-dev-kit-README.txt venice-imx8mm-flash.bin |
| 99 | }}} |
| 100 | |
| 101 | Inside this file, run a script that runs on the build machine to create and grab files to be placed into the Ubuntu filesystem. |
| 102 | |
| 103 | The Ubuntu filesystem is of ext2 format, and thus e2tools must be used. In the example below, e2cp is a command that ends up copying files into the /root directory (default Gateworks home directory) when the Ubuntu OS is booted. |
| 104 | |
| 105 | The below example does some random things such as grabbing a tar ball, creating a readme and then copying it into the Ubuntu OS. |
| 106 | |
| 107 | After creating this file, re-run the make argument to rebuild the Gateworks BSP with the custom changes now integrated: |
| 108 | {{{ |
| 109 | make -j8 ubuntu-image |
| 110 | }}} |
| 111 | |
| 112 | The output should then be a file such as noble-venice.img.gz, which can then be flashed onto the Gateworks SBC and should contain the changes. |
| 113 | |
| 114 | |
| 115 | Example custom_rootfs_test.sh file: |
| 116 | {{{ |
| 117 | #!/bin/bash |
| 118 | |
| 119 | set -x # enable script debugging (see all commands executed) |
| 120 | set -e # exit on error |
| 121 | |
| 122 | IMAGE=$1 |
| 123 | KERNEL=linux |
| 124 | |
| 125 | # temp dir |
| 126 | TMP=$(mktemp -d -t tmp.XXXXXX) |
| 127 | |
| 128 | #grab a tarball of some GPS files |
| 129 | wget https://dev.gateworks.com/fae/gnss.tar -O $TMP/gnss.tar |
| 130 | |
| 131 | #create all files in TMP first |
| 132 | mkdir -p $TMP/gnss_devkit |
| 133 | tar -xvf $TMP/gnss.tar -C $TMP |
| 134 | chmod +x $TMP/gnss_devkit/setup.sh |
| 135 | |
| 136 | #Create a readme file that is going to be placed into the /root directory |
| 137 | cat <<\EOF > $TMP/ublox-dev-kit-README.txt |
| 138 | This is a basic readme file |
| 139 | EOF |
| 140 | |
| 141 | |
| 142 | rm -rf $TMP/gnss.tar |
| 143 | #now copy all TMP files into the actual Ubuntu Image at location specified |
| 144 | e2cp $TMP/* $IMAGE:/root/ |
| 145 | e2mkdir $IMAGE:/root/gnss_devkit |
| 146 | chmod +x $TMP/gnss_devkit/setup.sh |
| 147 | e2cp -p $TMP/gnss_devkit/* $IMAGE:/root/gnss_devkit/ |
| 148 | |
| 149 | #cleanup TMP |
| 150 | rm -rf $TMP |
| 151 | }}} |