├── LICENSE ├── README.md ├── debian └── armhf │ └── image-wb │ ├── debimage-wb.yaml │ ├── gen-bootscript.sh │ ├── networkd │ └── etc │ │ └── systemd │ │ └── network │ │ └── wired.network │ ├── setup-networking.sh │ └── setup-user.sh ├── lepotato ├── README ├── debimage-lepotato.yaml └── scripts │ └── setup-user.sh ├── pine-a64-plus ├── debian.yaml ├── overlays │ ├── network-setup │ │ └── etc │ │ │ └── network │ │ │ └── interfaces.d │ │ │ └── eth0 │ └── u-boot │ │ └── etc │ │ └── default │ │ └── u-boot └── scripts │ └── setup-user.sh ├── rpi3 ├── debimage-rpi3.yaml ├── overlays │ ├── fw-config │ │ └── config.txt │ ├── networkd │ │ └── etc │ │ │ └── systemd │ │ │ └── network │ │ │ └── wired.network │ └── u-boot-menu │ │ ├── etc │ │ └── default │ │ │ └── u-boot │ │ └── usr │ │ └── sbin │ │ └── u-boot-update └── scripts │ ├── setup-networking.sh │ └── setup-user.sh └── rpi64 ├── debimage-rpi64.yaml ├── overlays ├── fw-config │ └── config.txt ├── modules │ └── etc │ │ └── modules-load.d │ │ └── i2c-dev.conf ├── networkd │ └── etc │ │ └── systemd │ │ └── network │ │ └── wired.network └── u-boot-menu │ └── etc │ └── default │ └── u-boot └── scripts ├── setup-networking.sh └── setup-user.sh /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # debos-recipes 2 | Collection of recipes for ['debos' tool](https://github.com/go-debos/debos). 3 | 4 | * `rpi3` contains a recipe for building an image for `stretch`. 5 | * `rpi64` contains a recipe for building an unified image for Raspberry Pi 3 and 4. 6 | It has been tested with `bullseye` and `sid` by using additional parameters: 7 | debos -t suite:sid -t kernel:linux-image-5.8.0-1-arm64-unsigned rpi64/debimage-rpi64.yaml 8 | Use login 'user' with password 'user' to log in. 9 | * `lepotato` contains a recipe for building an image for `bookworm`. 10 | 11 | Initial recipes for Debian are based on previous work located at https://git.apertis.org/cgit/apertis-workshop.git 12 | -------------------------------------------------------------------------------- /debian/armhf/image-wb/debimage-wb.yaml: -------------------------------------------------------------------------------- 1 | {{- $image := or .image "debian-wb.img" -}} 2 | 3 | architecture: armhf 4 | 5 | actions: 6 | - action: debootstrap 7 | suite: "buster" 8 | components: 9 | - main 10 | mirror: https://deb.debian.org/debian 11 | variant: minbase 12 | 13 | - action: apt 14 | packages: [ sudo, openssh-server, adduser, systemd-sysv] 15 | 16 | - action: run 17 | chroot: true 18 | script: setup-user.sh 19 | 20 | - action: run 21 | chroot: true 22 | command: echo wandboard > /etc/hostname 23 | 24 | - action: overlay 25 | source: networkd 26 | 27 | - action: run 28 | chroot: true 29 | script: setup-networking.sh 30 | 31 | - action: apt 32 | recommends: false 33 | packages: 34 | - linux-image-armmp 35 | - u-boot-imx 36 | 37 | # Note: cma reserves continuous video memory for graphics 38 | - action: run 39 | chroot: true 40 | command: echo console=ttymxc0,115200 quiet cma=256M > /etc/kernel/cmdline 41 | 42 | # Make dtb easy to find (normally flash-kernel does this for us) 43 | - action: run 44 | chroot: true 45 | command: ln -rsf /usr/lib/linux-image-*-armmp/imx6q-wandboard.dtb /boot/dtb 46 | 47 | # generate a boot.scr and put in $ROOTDIR/boot/boot.scr 48 | - action: run 49 | script: gen-bootscript.sh 50 | 51 | # partition table 52 | - action: image-partition 53 | imagename: {{ $image }} 54 | imagesize: 1GB 55 | partitiontype: msdos 56 | mountpoints: 57 | - mountpoint: / 58 | partition: root 59 | partitions: 60 | - name: root 61 | fs: ext4 62 | start: 1M 63 | end: 100% 64 | flags: [ boot ] 65 | 66 | - action: filesystem-deploy 67 | description: Deploying filesystem onto image 68 | 69 | # Write u-boot SPL and full version 70 | # (note: must be done after partition table writing or will be wiped!) 71 | - action: raw 72 | origin: filesystem 73 | source: /usr/lib/u-boot/wandboard/SPL 74 | offset: 1024 # bs=1k seek=1 75 | 76 | - action: raw 77 | origin: filesystem 78 | source: /usr/lib/u-boot/wandboard/u-boot.img 79 | offset: 70656 # bs=1k seek=69 80 | 81 | - action: run 82 | postprocess: true 83 | command: bmaptool create {{ $image }} > {{ $image }}.bmap 84 | 85 | - action: run 86 | postprocess: true 87 | command: gzip -f {{ $image }} 88 | -------------------------------------------------------------------------------- /debian/armhf/image-wb/gen-bootscript.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Puts below info in a script and generate boot.scr 3 | # This script assumes it's executed from 'artifact directory' (/scratch) 4 | 5 | cat << 'EOF' > bootscr.txt 6 | # debos wandboard boot script 7 | # loadaddr=0x12000000 8 | # ramdiskaddr=0x13000000 9 | # fdt_addr=0x18000000 10 | # console=ttymxc0,115200 11 | 12 | setenv prepbootargs 'if test -n "${console}"; then setenv bootargs "${bootargs} console=${console}" ; fi ; setenv bootargs ${bootargs} cma=256M ; setenv bootargs ${bootargs} root=LABEL=root' 13 | #setenv bootargs ${bootargs} quiet 14 | 15 | setenv loadkernel 'load mmc 0 ${loadaddr} /vmlinuz' 16 | setenv loadfdt 'load mmc 0 ${fdt_addr} /boot/dtb' 17 | setenv loadrd 'load mmc 0 ${ramdiskaddr} /initrd.img && setenv rdsize $filesize' 18 | setenv loadall 'run loadkernel; run loadfdt; run loadrd' 19 | 20 | setenv bootmmc 'mmc dev 0; run prepbootargs; run loadall; bootz ${loadaddr} ${ramdiskaddr}:${rdsize} ${fdt_addr}' 21 | 22 | run bootmmc 23 | 24 | EOF 25 | 26 | mkimage -A arm -T script -C none -n "Debos Wandboard script" -d bootscr.txt $ROOTDIR/boot/boot.scr 27 | -------------------------------------------------------------------------------- /debian/armhf/image-wb/networkd/etc/systemd/network/wired.network: -------------------------------------------------------------------------------- 1 | [Match] 2 | Name=e* 3 | 4 | [Network] 5 | DHCP=yes 6 | 7 | -------------------------------------------------------------------------------- /debian/armhf/image-wb/setup-networking.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | # Network management 6 | systemctl enable systemd-networkd 7 | # DNS resolving 8 | systemctl enable systemd-resolved 9 | # NTP client 10 | systemctl enable systemd-timesyncd 11 | 12 | ln -sf /lib/systemd/resolv.conf /etc/resolv.conf || true 13 | -------------------------------------------------------------------------------- /debian/armhf/image-wb/setup-user.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | adduser --gecos user \ 4 | --disabled-password \ 5 | --shell /bin/bash \ 6 | user 7 | adduser user sudo 8 | echo "user:user" | chpasswd 9 | -------------------------------------------------------------------------------- /lepotato/README: -------------------------------------------------------------------------------- 1 | Amlogic does not provide sources for the firmware and tools needed to create a 2 | bootloader image so it is necessary to use some proprietary binaries. This is 3 | described in u-boot-amlogic documentation (cf. doc/board/amlogic/libretech-cc.rst 4 | in u-boot sources). 5 | 6 | The libretech-cc's u-boot.bin file from u-boot-amlogic package installed on the 7 | target image, and used to create the bootloader is automatically extracted 8 | during target image build. 9 | -------------------------------------------------------------------------------- /lepotato/debimage-lepotato.yaml: -------------------------------------------------------------------------------- 1 | {{- $mirror := or .mirror "http://deb.debian.org/debian" -}} 2 | {{- $suite := or .suite "bookworm" -}} 3 | {{- $adminusername := or .adminusername "user" -}} 4 | {{ $image := or .image (printf "debian-lepotato-%s.img" $suite) }} 5 | 6 | architecture: arm64 7 | 8 | actions: 9 | - action: debootstrap 10 | suite: {{ $suite }} 11 | components: 12 | - main 13 | mirror: {{ $mirror }} 14 | variant: minbase 15 | 16 | - action: apt 17 | description: Install Kernel, U-Boot and extra packages 18 | packages: [ sudo, adduser, systemd-sysv, initramfs-tools, u-boot-tools, u-boot-menu, util-linux, 19 | openssh-server, iproute2, network-manager, libnss-myhostname, 20 | linux-image-arm64, u-boot-amlogic, zstd ] 21 | 22 | - action: run 23 | description: Add hostname 24 | chroot: true 25 | command: echo lepotato > /etc/hostname 26 | 27 | - action: run 28 | description: Set up user 29 | chroot: true 30 | script: scripts/setup-user.sh {{ $adminusername }} 31 | 32 | - action: image-partition 33 | imagename: {{ $image }} 34 | imagesize: 2GB 35 | partitiontype: msdos 36 | mountpoints: 37 | - mountpoint: / 38 | partition: root 39 | partitions: 40 | - name: root 41 | fs: ext4 42 | start: 2MB 43 | end: 100% 44 | flags: [ boot ] 45 | 46 | - action: filesystem-deploy 47 | description: Deploying filesystem onto image 48 | 49 | # Update U-Boot menu after creation of image partitions and filesystem 50 | # deployment to get correct root information from /etc/fstab 51 | - action: run 52 | description: Update U-Boot menu 53 | chroot: true 54 | command: u-boot-update 55 | 56 | - action: run 57 | description: Create block map file 58 | postprocess: true 59 | command: bmaptool create {{ $image }} > {{ $image }}.bmap 60 | 61 | - action: run 62 | description: Compressing final image 63 | postprocess: true 64 | command: gzip -f {{ $image }} 65 | 66 | # see https://github.com/u-boot/u-boot/blob/master/doc/board/amlogic/libretech-cc.rst and 67 | # and https://github.com/u-boot/u-boot/blob/master/doc/board/amlogic/pre-generated-fip.rst 68 | # to install u-boot 69 | - action: run 70 | description: Extract bootloader u-boot.bin 71 | chroot: false 72 | command: cp ${ROOTDIR}/usr/lib/u-boot/libretech-cc/u-boot.bin ${ARTIFACTDIR}/u-boot.bin 73 | -------------------------------------------------------------------------------- /lepotato/scripts/setup-user.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -eu 4 | 5 | USER=${1:-user} 6 | 7 | adduser --gecos "$USER" \ 8 | --disabled-password \ 9 | --shell /bin/bash \ 10 | "$USER" 11 | adduser "$USER" sudo 12 | echo "$USER:$USER" | chpasswd 13 | -------------------------------------------------------------------------------- /pine-a64-plus/debian.yaml: -------------------------------------------------------------------------------- 1 | {{- $board := or .board "pine64_plus" -}} 2 | {{- $suite := or .suite "bullseye" -}} 3 | {{- $mirror := or .mirror "http://deb.debian.org/debian" -}} 4 | {{- $hostname := or .hostname "debian-pine-a64plus" -}} 5 | {{- $image := or .image (printf "debos-debian-%s-%s.img" $suite $board) -}} 6 | 7 | architecture: "arm64" 8 | 9 | actions: 10 | - action: debootstrap 11 | suite: {{ $suite }} 12 | components: 13 | - main 14 | - contrib 15 | - non-free 16 | mirror: {{ $mirror }} 17 | variant: minbase 18 | 19 | - action: apt 20 | description: Install some packages 21 | recommends: false 22 | packages: 23 | - sudo 24 | - openssh-server 25 | - isc-dhcp-client 26 | - iproute2 27 | - ifupdown 28 | 29 | # Boot and kernel setup 30 | 31 | - action: apt 32 | description: Install kernel, bootloader and init packages 33 | update: false 34 | recommends: false 35 | packages: 36 | - u-boot-menu 37 | - u-boot-sunxi 38 | - linux-image-arm64 39 | - init 40 | 41 | - action: overlay 42 | source: overlays/u-boot 43 | 44 | - action: run 45 | description: U-Boot menu update 46 | chroot: true 47 | command: /usr/sbin/u-boot-update 48 | 49 | # End of kernel and boot setup 50 | 51 | - action: run 52 | description: Setup hostname 53 | chroot: true 54 | command: | 55 | echo "{{ $hostname }}" >/etc/hostname 56 | echo "127.0.0.1 localhost {{ $hostname }}" >/etc/hosts 57 | 58 | - action: run 59 | description: Setup user 60 | chroot: true 61 | script: scripts/setup-user.sh 62 | 63 | - action: overlay 64 | description: Network setup 65 | source: overlays/network-setup 66 | 67 | - action: image-partition 68 | imagename: {{ $image }} 69 | imagesize: 1GB 70 | partitiontype: msdos 71 | mountpoints: 72 | - mountpoint: / 73 | partition: root 74 | partitions: 75 | - name: root 76 | fs: ext4 77 | start: 2MB 78 | end: 100% 79 | flags: [ boot ] 80 | 81 | - action: filesystem-deploy 82 | description: Deploying filesystem onto image 83 | 84 | - action: raw 85 | description: Writing U-Boot SPL image 86 | origin: filesystem 87 | source: /usr/lib/u-boot/{{ $board }}/sunxi-spl.bin 88 | offset: {{ sector 16 }} 89 | 90 | - action: raw 91 | description: Writing U-Boot FIT image 92 | origin: filesystem 93 | source: /usr/lib/u-boot/{{ $board }}/u-boot-sunxi-with-spl.fit.itb 94 | offset: {{ sector 80 }} 95 | 96 | - action: run 97 | description: Create block map (bmap) 98 | postprocess: true 99 | command: bmaptool create {{ $image }} > {{ $image }}.bmap 100 | 101 | - action: run 102 | description: Pack result image 103 | postprocess: true 104 | command: xz -z -v -f -T 0 {{ $image }} 105 | -------------------------------------------------------------------------------- /pine-a64-plus/overlays/network-setup/etc/network/interfaces.d/eth0: -------------------------------------------------------------------------------- 1 | auto eth0 2 | iface eth0 inet dhcp 3 | -------------------------------------------------------------------------------- /pine-a64-plus/overlays/u-boot/etc/default/u-boot: -------------------------------------------------------------------------------- 1 | ## /etc/default/u-boot - configuration file for u-boot-update(8) 2 | 3 | #U_BOOT_UPDATE="true" 4 | 5 | #U_BOOT_ALTERNATIVES="default recovery" 6 | U_BOOT_DEFAULT="5" 7 | #U_BOOT_ENTRIES="all" 8 | U_BOOT_MENU_LABEL="Debian GNU/Linux on Pine A64+" 9 | U_BOOT_PARAMETERS="root=/dev/disk/by-label/root ro quiet" 10 | #U_BOOT_ROOT="" 11 | #U_BOOT_TIMEOUT="50" 12 | #U_BOOT_FDT="" 13 | #U_BOOT_FDT_DIR="/usr/lib/linux-image-" 14 | 15 | -------------------------------------------------------------------------------- /pine-a64-plus/scripts/setup-user.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | echo "I: create user" 6 | useradd --comment "User" --create-home --shell /bin/bash user 7 | 8 | echo "user ALL=NOPASSWD: ALL" >/etc/sudoers.d/user 9 | chmod 440 /etc/sudoers.d/user 10 | 11 | echo "I: set user password" 12 | echo "user:user" | chpasswd 13 | -------------------------------------------------------------------------------- /rpi3/debimage-rpi3.yaml: -------------------------------------------------------------------------------- 1 | {{- $firmware_version := or .firmware_version "1.20180919" -}} 2 | {{- $image := or .image "debian-rpi3.img" -}} 3 | 4 | architecture: arm64 5 | 6 | actions: 7 | # Download all needed proprietary stuff first 8 | - action: download 9 | url: https://github.com/raspberrypi/firmware/archive/{{ $firmware_version }}.tar.gz 10 | unpack: true # Unpack downloaded file 11 | name: firmware # name for usage directory with unpacked content in other actions 12 | 13 | - action: debootstrap 14 | suite: "stretch" 15 | components: 16 | - main 17 | mirror: https://deb.debian.org/debian 18 | variant: minbase 19 | 20 | - action: apt 21 | packages: [ sudo, openssh-server, adduser, systemd-sysv] 22 | 23 | - action: run 24 | chroot: true 25 | script: scripts/setup-user.sh 26 | 27 | - action: run 28 | chroot: true 29 | command: echo rpi3 > /etc/hostname 30 | 31 | - action: overlay 32 | source: overlays/networkd 33 | 34 | - action: run 35 | chroot: true 36 | script: scripts/setup-networking.sh 37 | 38 | - action: apt 39 | recommends: false 40 | packages: 41 | - linux-image-arm64 42 | - u-boot-rpi 43 | 44 | # add firmware 45 | - action: overlay 46 | origin: firmware 47 | source: firmware-{{ $firmware_version }}/boot 48 | destination: /boot/firmware 49 | 50 | - action: run 51 | chroot: true 52 | command: rm -rf /boot/firmware/kernel*.img /boot/firmware/*.dtb /boot/firmware/overlays 53 | 54 | - action: run 55 | chroot: true 56 | command: cp /usr/lib/u-boot/rpi_3/* /boot/firmware/ 57 | 58 | - action: overlay 59 | source: overlays/fw-config 60 | destination: /boot/firmware 61 | 62 | - action: run 63 | chroot: true 64 | command: echo console=ttyS0,115200 > /etc/kernel/cmdline 65 | 66 | - action: overlay 67 | source: overlays/u-boot-menu 68 | 69 | - action: run 70 | chroot: true 71 | command: u-boot-update 72 | 73 | - action: image-partition 74 | imagename: {{ $image }} 75 | imagesize: 1GB 76 | partitiontype: msdos 77 | mountpoints: 78 | - mountpoint: / 79 | partition: root 80 | - mountpoint: /boot/firmware 81 | partition: firmware 82 | options: [ x-systemd.automount ] 83 | partitions: 84 | - name: firmware 85 | fs: fat32 86 | start: 0% 87 | end: 64MB 88 | - name: root 89 | fs: ext4 90 | start: 64MB 91 | end: 100% 92 | flags: [ boot ] 93 | 94 | - action: filesystem-deploy 95 | description: Deploying filesystem onto image 96 | 97 | - action: run 98 | postprocess: true 99 | command: bmaptool create {{ $image }} > {{ $image }}.bmap 100 | 101 | - action: run 102 | postprocess: true 103 | command: gzip -f {{ $image }} 104 | -------------------------------------------------------------------------------- /rpi3/overlays/fw-config/config.txt: -------------------------------------------------------------------------------- 1 | arm_64bit=1 2 | enable_uart=1 3 | kernel=u-boot.bin 4 | -------------------------------------------------------------------------------- /rpi3/overlays/networkd/etc/systemd/network/wired.network: -------------------------------------------------------------------------------- 1 | [Match] 2 | Name=e* 3 | 4 | [Network] 5 | DHCP=yes 6 | 7 | -------------------------------------------------------------------------------- /rpi3/overlays/u-boot-menu/etc/default/u-boot: -------------------------------------------------------------------------------- 1 | ## /etc/default/u-boot - configuration file for u-boot-update(8) 2 | 3 | U_BOOT_UPDATE="true" 4 | 5 | U_BOOT_ALTERNATIVES="default recovery" 6 | U_BOOT_DEFAULT="l0" 7 | U_BOOT_ENTRIES="all" 8 | U_BOOT_MENU_LABEL="Debian GNU/Linux" 9 | U_BOOT_PARAMETERS="root=/dev/mmcblk0p2 ro rootwait console=ttyS0,115200" 10 | U_BOOT_ROOT="" 11 | U_BOOT_TIMEOUT="50" 12 | U_BOOT_FDT="broadcom/bcm2837-rpi-3-b.dtb" 13 | #U_BOOT_FDT_DIR="/boot/dtbs/" 14 | 15 | -------------------------------------------------------------------------------- /rpi3/overlays/u-boot-menu/usr/sbin/u-boot-update: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ## Copyright (C) 2006-2012 Daniel Baumann 4 | ## Copyright (C) 2016-2017 Riku Voipio 5 | ## 6 | ## This program comes with ABSOLUTELY NO WARRANTY; for details see COPYING. 7 | ## This is free software, and you are welcome to redistribute it 8 | ## under certain conditions; see COPYING for details. 9 | 10 | set -e 11 | 12 | _U_BOOT_DIRECTORY="/boot/extlinux" 13 | 14 | Update () 15 | { 16 | # Upate target file using source content 17 | _TARGET="${1}" 18 | _SOURCE="${2}" 19 | 20 | _TMPFILE="${_TARGET}.tmp" 21 | rm -f "${_TMPFILE}" 22 | 23 | echo "${_SOURCE}" > "${_TMPFILE}" 24 | 25 | if [ -e "${_TARGET}" ] && cmp -s "${_TARGET}" "${_TMPFILE}" 26 | then 27 | rm -f "${_TMPFILE}" 28 | else 29 | # FIXME: should use fsync here 30 | echo "P: Updating ${_TARGET}..." 31 | mv -f "${_TMPFILE}" "${_TARGET}" 32 | fi 33 | } 34 | 35 | # FIXME: switch to check extlinux file can be written to 36 | # User is unprivileged 37 | if [ "$(id -u)" -ne 0 ] 38 | then 39 | echo "E: need root privileges" 40 | exit 1 41 | fi 42 | 43 | # Redirect stdout to stderr due Debconf usage 44 | exec 1>&2 45 | 46 | # Reading the default file 47 | if [ -e /etc/default/u-boot ] 48 | then 49 | . /etc/default/u-boot 50 | fi 51 | 52 | U_BOOT_UPDATE="${U_BOOT_UPDATE:-true}" 53 | 54 | if [ "${U_BOOT_UPDATE}" != "true" ] 55 | then 56 | echo "P: u-boot-update is disabled in /etc/default/u-boot." 57 | 58 | exit 0 59 | fi 60 | 61 | # Checking extlinux directory 62 | echo -n "P: Checking for EXTLINUX directory..." 63 | 64 | # Creating extlinux directory 65 | if [ ! -e "${_U_BOOT_DIRECTORY}" ] 66 | then 67 | echo " not found." 68 | 69 | echo -n "P: Creating EXTLINUX directory..." 70 | mkdir -p "${_U_BOOT_DIRECTORY}" 71 | echo " done: ${_U_BOOT_DIRECTORY}" 72 | else 73 | echo " found." 74 | fi 75 | 76 | # Setting defaults if /etc/default/u-boot is missing 77 | 78 | U_BOOT_ALTERNATIVES="${U_BOOT_ALTERNATIVES:-default recovery}" 79 | U_BOOT_DEFAULT="${U_BOOT_DEFAULT:-l0}" 80 | U_BOOT_ENTRIES="${U_BOOT_ENTRIES:-all}" 81 | U_BOOT_TIMEOUT="${U_BOOT_TIMEOUT:-50}" 82 | U_BOOT_MENU_LABEL="Debian GNU/Linux kernel" 83 | U_BOOT_FDT_DIR="${U_BOOT_FDT_DIR:-/usr/lib/linux-image-}" 84 | 85 | # Find parameter for root from fstab 86 | if [ -z "${U_BOOT_ROOT}" ] 87 | then 88 | # Find root partition 89 | while read _LINE 90 | do 91 | 92 | read _FS_SPEC _FS_FILE _FS_VFSTYPE _FS_MNTOPS _FS_FREQ _FS_PASSNO << EOF 93 | ${_LINE} 94 | EOF 95 | 96 | if [ "${_FS_SPEC}" != "#" ] && [ "${_FS_FILE}" = "/" ] 97 | then 98 | U_BOOT_ROOT="root=${_FS_SPEC}" 99 | break 100 | fi 101 | done < /etc/fstab 102 | fi 103 | 104 | # if not in fsrab, try from current kernel arguments 105 | if [ -z "${U_BOOT_ROOT}" ] 106 | then 107 | for param in `cat /proc/cmdline` 108 | do 109 | if [[ $param == root=* ]] 110 | then 111 | U_BOOT_ROOT="$param" 112 | break 113 | fi 114 | done 115 | fi 116 | 117 | 118 | # Create extlinux.conf 119 | _CONFIG="\ 120 | ## ${_U_BOOT_DIRECTORY}/extlinux.conf 121 | ## 122 | ## IMPORTANT WARNING 123 | ## 124 | ## The configuration of this file is generated automatically. 125 | ## Do not edit this file manually, use: u-boot-update 126 | 127 | default ${U_BOOT_DEFAULT} 128 | menu title U-Boot menu 129 | prompt 0 130 | timeout ${U_BOOT_TIMEOUT} 131 | " 132 | 133 | # Find linux versions 134 | _VERSIONS="$(linux-version list | linux-version sort --reverse)" 135 | 136 | if [ "$(stat --printf %d /)" = "$(stat --printf %d /boot)" ] 137 | then 138 | # / and /boot are on the same filesystem 139 | _BOOT_DIRECTORY="/boot" 140 | else 141 | # / and /boot are not on the same filesystem 142 | _BOOT_DIRECTORY="" 143 | fi 144 | 145 | 146 | for _VERSION in ${_VERSIONS} 147 | do 148 | echo "P: Writing config for /boot/vmlinuz-${_VERSION}..." 149 | 150 | _NUMBER="${_NUMBER:-0}" 151 | _ENTRY="${_ENTRY:-1}" 152 | 153 | if [ -e /boot/initrd.img-${_VERSION} ] 154 | then 155 | _INITRD="initrd ${_BOOT_DIRECTORY}/initrd.img-${_VERSION}" 156 | else 157 | _INITRD="" 158 | fi 159 | if [ -e ${U_BOOT_FDT_DIR}${_VERSION}/${U_BOOT_FDT} ] && [ -n "${U_BOOT_FDT}" ] 160 | then 161 | _FDT="fdt ${U_BOOT_FDT_DIR}${_VERSION}/${U_BOOT_FDT}" 162 | elif [ -d ${U_BOOT_FDT_DIR}${_VERSION}/ ] 163 | then 164 | _FDT="fdtdir ${U_BOOT_FDT_DIR}${_VERSION}/" 165 | else 166 | _FDT="" 167 | fi 168 | 169 | if echo ${U_BOOT_ALTERNATIVES} | grep -q default 170 | then 171 | 172 | # Writing default entry 173 | _CONFIG="${_CONFIG} 174 | 175 | label l${_NUMBER} 176 | menu label ${U_BOOT_MENU_LABEL} ${_VERSION} 177 | linux ${_BOOT_DIRECTORY}/vmlinuz-${_VERSION} 178 | ${_INITRD} 179 | ${_FDT} 180 | append ${U_BOOT_ROOT} ${U_BOOT_PARAMETERS}" 181 | 182 | fi 183 | 184 | if echo ${U_BOOT_ALTERNATIVES} | grep -q recovery 185 | then 186 | 187 | # Writing recovery entry 188 | _CONFIG="${_CONFIG} 189 | 190 | label l${_NUMBER}r 191 | menu label ${U_BOOT_MENU_LABEL} ${_VERSION} (rescue target) 192 | linux ${_BOOT_DIRECTORY}/vmlinuz-${_VERSION} 193 | ${_INITRD} 194 | ${_FDT} 195 | append ${U_BOOT_ROOT} $(echo ${U_BOOT_PARAMETERS} | sed -e 's| quiet||') systemd.unit=rescue.target 196 | " 197 | 198 | fi 199 | 200 | _NUMBER="$((${_NUMBER} + 1))" 201 | 202 | if [ "${U_BOOT_ENTRIES}" = "${_ENTRY}" ] 203 | then 204 | break 205 | fi 206 | done 207 | 208 | _NUMBER="" 209 | 210 | Update "${_U_BOOT_DIRECTORY}/extlinux.conf" "${_CONFIG}" 211 | 212 | -------------------------------------------------------------------------------- /rpi3/scripts/setup-networking.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | # Network management 6 | systemctl enable systemd-networkd 7 | # DNS resolving 8 | systemctl enable systemd-resolved 9 | # NTP client 10 | systemctl enable systemd-timesyncd 11 | -------------------------------------------------------------------------------- /rpi3/scripts/setup-user.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | adduser --gecos user \ 4 | --disabled-password \ 5 | --shell /bin/bash \ 6 | user 7 | adduser user sudo 8 | echo "user:user" | chpasswd 9 | -------------------------------------------------------------------------------- /rpi64/debimage-rpi64.yaml: -------------------------------------------------------------------------------- 1 | {{- $firmware_version := or .firmware_version "1.20201022" -}} 2 | {{- $mirror := or .mirror "http://deb.debian.org/debian" -}} 3 | {{- $suite := or .suite "bullseye" -}} 4 | {{- $kernel := or .kernel "linux-image-arm64" -}} 5 | {{- $cmdline := or .cmdline " rootwait ro fsck.mode=auto fsck.repair=yes console=ttyS1,115200" -}} 6 | {{- $image := or .image "debian-rpi64.img" -}} 7 | 8 | architecture: arm64 9 | 10 | actions: 11 | {{ if ne $firmware_version "debian" }} 12 | # Download all needed proprietary stuff first 13 | - action: download 14 | description: Download latest version of the firmware from GitHub 15 | url: http://github.com/raspberrypi/firmware/archive/{{ $firmware_version }}.tar.gz 16 | unpack: true # Unpack downloaded file 17 | name: firmware # name for usage directory with unpacked content in other actions 18 | {{ end }} 19 | 20 | - action: debootstrap 21 | suite: {{ $suite }} 22 | components: 23 | - main 24 | - non-free 25 | mirror: {{ $mirror }} 26 | variant: minbase 27 | 28 | - action: apt 29 | description: Install extra packages 30 | packages: 31 | - adduser 32 | - bluetooth 33 | - ca-certificates 34 | - dbus-user-session 35 | - iproute2 36 | - i2c-tools 37 | - libnss-resolve 38 | - openssh-server 39 | - sudo 40 | - systemd-sysv 41 | - u-boot-menu 42 | - u-boot-rpi 43 | - vim-tiny 44 | - systemd-timesyncd 45 | 46 | - action: overlay 47 | description: Install U-Boot menu configuration 48 | source: overlays/u-boot-menu 49 | 50 | - action: apt 51 | description: Install kernel and firmware packages for RPi 52 | packages: 53 | - {{ $kernel}} 54 | - firmware-brcm80211 55 | - rpi.gpio-common 56 | 57 | - action: overlay 58 | description: Copy config.txt 59 | source: overlays/fw-config 60 | destination: /boot/firmware 61 | 62 | - action: run 63 | description: Install U-Boot 64 | chroot: false 65 | command: sh -c "cp -av ${ROOTDIR}/usr/lib/u-boot/rpi_arm64/u-boot.bin ${ROOTDIR}/boot/firmware/" 66 | 67 | - action: run 68 | description: Copy DTBs for the kernel 69 | chroot: false 70 | command: sh -c "mkdir -p ${ROOTDIR}/boot/dtbs; cp -rav ${ROOTDIR}/usr/lib/linux-image-*-arm64/broadcom ${ROOTDIR}/boot/dtbs/" 71 | 72 | {{ if ne $firmware_version "debian" }} 73 | - action: overlay 74 | description: Install RPi boot firmware ({{ $firmware_version }}) 75 | origin: firmware 76 | source: firmware-{{ $firmware_version }}/boot 77 | destination: /boot/firmware 78 | 79 | {{ else }} 80 | - action: apt 81 | description: Install RPi firmware package 82 | packages: 83 | - raspi-firmware 84 | 85 | - action: run 86 | description: Install RPi boot firmware (Debian) 87 | chroot: false 88 | command: sh -c "cp -av ${ROOTDIR}/usr/lib/raspi-firmware/* ${ROOTDIR}/boot/firmware/" 89 | 90 | - action: run 91 | description: Copy DTBs from the kernel 92 | chroot: false 93 | command: sh -c "cp -av ${ROOTDIR}/usr/lib/linux-image-*-arm64/broadcom/* ${ROOTDIR}/boot/firmware/" 94 | 95 | - action: run 96 | description: Use upstream DTBs naming 97 | chroot: false 98 | command: sh -c "echo upstream_kernel=1 >> ${ROOTDIR}/boot/firmware/config.txt" 99 | 100 | # Do not need to keep firmware package after firmware partition setup. 101 | # raspi-firmware contains kernel postinstall script incompatible with U-Boot 102 | - action: run 103 | description: Remove RPi firmware package 104 | chroot: true 105 | command: dpkg -P raspi-firmware 106 | {{ end }} 107 | 108 | - action: run 109 | description: Cleanup firmware partition 110 | chroot: false 111 | command: sh -c "rm -rf ${ROOTDIR}/boot/firmware/kernel* ${ROOTDIR}/boot/firmware/vmlinuz* ${ROOTDIR}/boot/firmware/initrd.img*" 112 | 113 | - action: run 114 | description: Set up user 115 | chroot: true 116 | script: scripts/setup-user.sh 117 | 118 | - action: run 119 | description: Add hostname 120 | chroot: true 121 | command: echo rpi64 > /etc/hostname 122 | 123 | - action: overlay 124 | description: Autoload modules 125 | source: overlays/modules 126 | 127 | - action: overlay 128 | source: overlays/networkd 129 | 130 | - action: run 131 | chroot: true 132 | script: scripts/setup-networking.sh 133 | 134 | - action: image-partition 135 | imagename: {{ $image }} 136 | imagesize: 4GB 137 | partitiontype: msdos 138 | mountpoints: 139 | - mountpoint: / 140 | partition: root 141 | - mountpoint: /boot/firmware 142 | partition: firmware 143 | options: [ x-systemd.automount ] 144 | partitions: 145 | - name: firmware 146 | fs: fat32 147 | start: 0% 148 | end: 64MB 149 | - name: root 150 | fs: ext4 151 | start: 64MB 152 | end: 100% 153 | flags: [ boot ] 154 | 155 | - action: filesystem-deploy 156 | description: Deploying filesystem onto image 157 | setup-kernel-cmdline: true 158 | append-kernel-cmdline: {{ $cmdline }} 159 | 160 | - action: run 161 | description: Create block map file 162 | postprocess: true 163 | command: bmaptool create {{ $image }} > {{ $image }}.bmap 164 | 165 | - action: run 166 | description: Compressing final image 167 | postprocess: true 168 | command: gzip -f {{ $image }} 169 | -------------------------------------------------------------------------------- /rpi64/overlays/fw-config/config.txt: -------------------------------------------------------------------------------- 1 | arm_64bit=1 2 | enable_uart=1 3 | kernel=u-boot.bin 4 | -------------------------------------------------------------------------------- /rpi64/overlays/modules/etc/modules-load.d/i2c-dev.conf: -------------------------------------------------------------------------------- 1 | i2c-dev 2 | -------------------------------------------------------------------------------- /rpi64/overlays/networkd/etc/systemd/network/wired.network: -------------------------------------------------------------------------------- 1 | [Match] 2 | Name=e* 3 | 4 | [Network] 5 | DHCP=yes 6 | 7 | -------------------------------------------------------------------------------- /rpi64/overlays/u-boot-menu/etc/default/u-boot: -------------------------------------------------------------------------------- 1 | ## /etc/default/u-boot - configuration file for u-boot-update(8) 2 | 3 | U_BOOT_UPDATE="true" 4 | 5 | U_BOOT_ALTERNATIVES="default recovery" 6 | U_BOOT_DEFAULT="l0" 7 | U_BOOT_ENTRIES="all" 8 | U_BOOT_MENU_LABEL="Debian GNU/Linux" 9 | U_BOOT_PARAMETERS="root=LABEL=root ro rootwait console=ttyS1,115200" 10 | U_BOOT_ROOT="" 11 | U_BOOT_TIMEOUT="50" 12 | 13 | -------------------------------------------------------------------------------- /rpi64/scripts/setup-networking.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | # Network management 6 | systemctl enable systemd-networkd 7 | # DNS resolving 8 | systemctl enable systemd-resolved 9 | # NTP client 10 | systemctl enable systemd-timesyncd 11 | -------------------------------------------------------------------------------- /rpi64/scripts/setup-user.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | adduser --gecos user \ 4 | --disabled-password \ 5 | --shell /bin/bash \ 6 | user 7 | adduser user sudo 8 | echo "user:user" | chpasswd 9 | --------------------------------------------------------------------------------