├── LICENSE ├── README.md └── rk3328 ├── Dockerfile └── manual-image-guide.md /LICENSE: -------------------------------------------------------------------------------- 1 | Creative Commons Legal Code 2 | 3 | CC0 1.0 Universal 4 | 5 | CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE 6 | LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN 7 | ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS 8 | INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES 9 | REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS 10 | PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM 11 | THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED 12 | HEREUNDER. 13 | 14 | Statement of Purpose 15 | 16 | The laws of most jurisdictions throughout the world automatically confer 17 | exclusive Copyright and Related Rights (defined below) upon the creator 18 | and subsequent owner(s) (each and all, an "owner") of an original work of 19 | authorship and/or a database (each, a "Work"). 20 | 21 | Certain owners wish to permanently relinquish those rights to a Work for 22 | the purpose of contributing to a commons of creative, cultural and 23 | scientific works ("Commons") that the public can reliably and without fear 24 | of later claims of infringement build upon, modify, incorporate in other 25 | works, reuse and redistribute as freely as possible in any form whatsoever 26 | and for any purposes, including without limitation commercial purposes. 27 | These owners may contribute to the Commons to promote the ideal of a free 28 | culture and the further production of creative, cultural and scientific 29 | works, or to gain reputation or greater distribution for their Work in 30 | part through the use and efforts of others. 31 | 32 | For these and/or other purposes and motivations, and without any 33 | expectation of additional consideration or compensation, the person 34 | associating CC0 with a Work (the "Affirmer"), to the extent that he or she 35 | is an owner of Copyright and Related Rights in the Work, voluntarily 36 | elects to apply CC0 to the Work and publicly distribute the Work under its 37 | terms, with knowledge of his or her Copyright and Related Rights in the 38 | Work and the meaning and intended legal effect of CC0 on those rights. 39 | 40 | 1. Copyright and Related Rights. A Work made available under CC0 may be 41 | protected by copyright and related or neighboring rights ("Copyright and 42 | Related Rights"). Copyright and Related Rights include, but are not 43 | limited to, the following: 44 | 45 | i. the right to reproduce, adapt, distribute, perform, display, 46 | communicate, and translate a Work; 47 | ii. moral rights retained by the original author(s) and/or performer(s); 48 | iii. publicity and privacy rights pertaining to a person's image or 49 | likeness depicted in a Work; 50 | iv. rights protecting against unfair competition in regards to a Work, 51 | subject to the limitations in paragraph 4(a), below; 52 | v. rights protecting the extraction, dissemination, use and reuse of data 53 | in a Work; 54 | vi. database rights (such as those arising under Directive 96/9/EC of the 55 | European Parliament and of the Council of 11 March 1996 on the legal 56 | protection of databases, and under any national implementation 57 | thereof, including any amended or successor version of such 58 | directive); and 59 | vii. other similar, equivalent or corresponding rights throughout the 60 | world based on applicable law or treaty, and any national 61 | implementations thereof. 62 | 63 | 2. Waiver. To the greatest extent permitted by, but not in contravention 64 | of, applicable law, Affirmer hereby overtly, fully, permanently, 65 | irrevocably and unconditionally waives, abandons, and surrenders all of 66 | Affirmer's Copyright and Related Rights and associated claims and causes 67 | of action, whether now known or unknown (including existing as well as 68 | future claims and causes of action), in the Work (i) in all territories 69 | worldwide, (ii) for the maximum duration provided by applicable law or 70 | treaty (including future time extensions), (iii) in any current or future 71 | medium and for any number of copies, and (iv) for any purpose whatsoever, 72 | including without limitation commercial, advertising or promotional 73 | purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each 74 | member of the public at large and to the detriment of Affirmer's heirs and 75 | successors, fully intending that such Waiver shall not be subject to 76 | revocation, rescission, cancellation, termination, or any other legal or 77 | equitable action to disrupt the quiet enjoyment of the Work by the public 78 | as contemplated by Affirmer's express Statement of Purpose. 79 | 80 | 3. Public License Fallback. Should any part of the Waiver for any reason 81 | be judged legally invalid or ineffective under applicable law, then the 82 | Waiver shall be preserved to the maximum extent permitted taking into 83 | account Affirmer's express Statement of Purpose. In addition, to the 84 | extent the Waiver is so judged Affirmer hereby grants to each affected 85 | person a royalty-free, non transferable, non sublicensable, non exclusive, 86 | irrevocable and unconditional license to exercise Affirmer's Copyright and 87 | Related Rights in the Work (i) in all territories worldwide, (ii) for the 88 | maximum duration provided by applicable law or treaty (including future 89 | time extensions), (iii) in any current or future medium and for any number 90 | of copies, and (iv) for any purpose whatsoever, including without 91 | limitation commercial, advertising or promotional purposes (the 92 | "License"). The License shall be deemed effective as of the date CC0 was 93 | applied by Affirmer to the Work. Should any part of the License for any 94 | reason be judged legally invalid or ineffective under applicable law, such 95 | partial invalidity or ineffectiveness shall not invalidate the remainder 96 | of the License, and in such case Affirmer hereby affirms that he or she 97 | will not (i) exercise any of his or her remaining Copyright and Related 98 | Rights in the Work or (ii) assert any associated claims and causes of 99 | action with respect to the Work, in either case contrary to Affirmer's 100 | express Statement of Purpose. 101 | 102 | 4. Limitations and Disclaimers. 103 | 104 | a. No trademark or patent rights held by Affirmer are waived, abandoned, 105 | surrendered, licensed or otherwise affected by this document. 106 | b. Affirmer offers the Work as-is and makes no representations or 107 | warranties of any kind concerning the Work, express, implied, 108 | statutory or otherwise, including without limitation warranties of 109 | title, merchantability, fitness for a particular purpose, non 110 | infringement, or the absence of latent or other defects, accuracy, or 111 | the present or absence of errors, whether or not discoverable, all to 112 | the greatest extent permissible under applicable law. 113 | c. Affirmer disclaims responsibility for clearing rights of other persons 114 | that may apply to the Work or any use thereof, including without 115 | limitation any person's Copyright and Related Rights in the Work. 116 | Further, Affirmer disclaims responsibility for obtaining any necessary 117 | consents, permissions or other rights required for any use of the 118 | Work. 119 | d. Affirmer understands and acknowledges that Creative Commons is not a 120 | party to this document and has no duty or obligation with respect to 121 | this CC0 or use of the Work. 122 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Collaborative solution engineering 2 | 3 | This repository aims to be a place for Dogecoin enthusiasts 4 | to collaborate on hardware engineering, integration and 5 | working together on end-to-end open-source solutions. 6 | 7 | This space is under heavy construction, but feel free to 8 | [start a discussion](https://github.com/veryengineer/collab/discussions) 9 | in the meantime. 10 | 11 | ### Meetings 12 | 13 | We'll try to hold as many meetings as desired. Feel free to run your own! 14 | 15 | You can find the archives of past meetings 16 | [here](https://github.com/veryengineer/collab/wiki/Meetings). 17 | 18 | ### SBC Research 19 | 20 | A list of SBCs and test results can be found 21 | [at the wiki](https://github.com/veryengineer/collab/wiki/SBCs). 22 | 23 | ### Contributing 24 | 25 | - As the name implies, the best place to ask questions and have discussions is 26 | [Discussions](https://github.com/veryengineer/collab/discussions). 27 | - If you want write access to the wiki, please 28 | [open an issue](https://github.com/veryengineer/collab/issues/new). 29 | - We'll figure everything else out as we go. 30 | 31 | Contribution guidelines are in the making. 32 | 33 | ### License 34 | 35 | All work committed to this repository is made available under CC0, which means 36 | it is placed in the public domain. Please see the [License file](./LICENSE) or 37 | the [creative commons website](https://creativecommons.org/share-your-work/public-domain/cc0/) 38 | for more information. 39 | -------------------------------------------------------------------------------- /rk3328/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:22.04 AS deps 2 | ### DEPENDENCIES 3 | # Generic: build-essential gcc gcc-aarch64-linux-gnu curl ca-certificates 4 | # ARM Firmware: bison flex 5 | # UBOOT: python3 python3-dev python3-setuptools python3-pyelftools 6 | # libssl-dev bc swig uuid-dev 7 | # IMAGE ASSEMBLY: fdisk jq 8 | WORKDIR /build 9 | RUN apt update \ 10 | && apt install -y --no-install-recommends \ 11 | build-essential gcc gcc-aarch64-linux-gnu \ 12 | curl git bison flex device-tree-compiler \ 13 | python3 swig uuid-dev python3-dev \ 14 | libssl-dev python3-setuptools bc ca-certificates \ 15 | python3-pyelftools fdisk jq 16 | RUN mkdir -p /build/artifacts 17 | 18 | FROM deps AS download 19 | ARG ARM_FIRMWARE_TAG=lts-v2.8.9 20 | ARG ARM_FIRMWARE_SHASUM=9b1a9ce650e86017d274ed9389b3ff634e4c9c88f936ffffaf86c7d0cb22290e 21 | ARG UBOOT_TAG=2023.10 22 | ARG UBOOT_SHASUM=b22664ee56640bba87068a7cdcd7cb50f956973a348e844788d2fb882fe0dc55 23 | RUN curl -L -O https://github.com/ARM-software/arm-trusted-firmware/archive/refs/tags/${ARM_FIRMWARE_TAG}.tar.gz \ 24 | && echo "${ARM_FIRMWARE_SHASUM} ${ARM_FIRMWARE_TAG}.tar.gz" | shasum -c \ 25 | && tar xf ${ARM_FIRMWARE_TAG}.tar.gz \ 26 | && ln -s arm-trusted-firmware-${ARM_FIRMWARE_TAG} arm-trusted-firmware \ 27 | && curl -L -O https://github.com/u-boot/u-boot/archive/refs/tags/v${UBOOT_TAG}.tar.gz \ 28 | && echo "${UBOOT_SHASUM} v${UBOOT_TAG}.tar.gz" | shasum -c \ 29 | && tar xf v${UBOOT_TAG}.tar.gz \ 30 | && ln -s u-boot-${UBOOT_TAG} u-boot \ 31 | && rm ${ARM_FIRMWARE_TAG}.tar.gz v${UBOOT_TAG}.tar.gz 32 | 33 | 34 | FROM download AS build 35 | RUN cd arm-trusted-firmware \ 36 | && make CROSS_COMPILE=aarch64-linux-gnu- PLAT=rk3328 \ 37 | && cp build/rk3328/release/bl31/bl31.elf /build/artifacts/ \ 38 | && cd .. 39 | RUN cd u-boot \ 40 | && export BL31=/build/artifacts/bl31.elf \ 41 | && make roc-cc-rk3328_defconfig \ 42 | && make CROSS_COMPILE=aarch64-linux-gnu- \ 43 | && cp u-boot-rockchip.bin /build/artifacts/ 44 | 45 | FROM deps as assemble 46 | ARG SECTORS_TO_ADD=22528 47 | ARG IMG_FILE=20231014.2-jammy-preinstalled-server-arm64.img 48 | ARG IMG_URL=https://archive.very.engineer 49 | ARG IMG_SHASUM=8e19655b5a0f84d2a5f9c9c57404723355f4e215764a93b67d0d68249c44c442 50 | ARG OUT_IMG=rk3328-jammy-20231014.2.img 51 | COPY --from=build /build/artifacts/* /build/artifacts/ 52 | RUN curl -L -O ${IMG_URL}/${IMG_FILE}.xz \ 53 | && echo "${IMG_SHASUM} ${IMG_FILE}.xz" | shasum -c \ 54 | && unxz ${IMG_FILE}.xz \ 55 | && mv ${IMG_FILE} ${OUT_IMG} 56 | RUN export IMAGE_SIZE=$(sfdisk --json ${OUT_IMG} | jq ".partitiontable.lastlba + 1 + 64") \ 57 | && dd if=/dev/zero of=${OUT_IMG} bs=512 seek=${IMAGE_SIZE} \ 58 | count=${SECTORS_TO_ADD} \ 59 | && for p in 1 14 15; do \ 60 | echo "+${SECTORS_TO_ADD}," | sfdisk --move-data ${OUT_IMG} -N ${p}; \ 61 | done \ 62 | && dd if=artifacts/u-boot-rockchip.bin of=${OUT_IMG} \ 63 | bs=512 seek=64 conv=notrunc \ 64 | && mv ${OUT_IMG} artifacts/ \ 65 | && xz -T 0 artifacts/${OUT_IMG} 66 | -------------------------------------------------------------------------------- /rk3328/manual-image-guide.md: -------------------------------------------------------------------------------- 1 | # u-boot compile branch 2022.10 for roc-cc-rk3328 2 | 3 | ### Dependencies 4 | 5 | ``` 6 | sudo apt-get install gcc gcc-aarch64-linux-gnu bc bison build-essential coccinelle device-tree-compiler dfu-util efitools flex gdisk graphviz imagemagick liblz4-tool libgnutls28-dev libguestfs-tools libncurses-dev libpython3-dev libsdl2-dev libssl-dev lz4 lzma lzma-alone openssl pkg-config python3 python3-asteval python3-coverage python3-filelock python3-pkg-resources python3-pycryptodome python3-pyelftools python3-pytest python3-pytest-xdist python3-sphinxcontrib.apidoc python3-sphinx-rtd-theme python3-subunit python3-testtools python3-virtualenv swig uuid-dev 7 | ``` 8 | 9 | ### Update 10 | 11 | ``` 12 | sudo apt update 13 | sudo apt dist-upgrade 14 | ``` 15 | 16 | ### Clone Arm Trusted Firmware Repo and compile 17 | 18 | ``` 19 | git clone --depth 1 https://github.com/ARM-software/arm-trusted-firmware.git 20 | cd arm-trusted-firmware 21 | make realclean 22 | 23 | make CROSS_COMPILE=aarch64-linux-gnu- PLAT=rk3328 24 | ``` 25 | 26 | ### Exit directory 27 | 28 | ``` 29 | cd .. 30 | ``` 31 | 32 | ### Clone Libretech U-Boot branch 33 | 34 | ``` 35 | git clone -b "u-boot/v2022.10/roc-rk3328-cc" https://github.com/libre-computer-project/libretech-u-boot.git 36 | cd libretech-u-boot 37 | ``` 38 | 39 | ### Export Arm Trusted 40 | 41 | ``` 42 | export BL31=../arm-trusted-firmware/build/rk3328/release/bl31/bl31.elf 43 | ``` 44 | 45 | ### Define the configuration 46 | 47 | ``` 48 | make roc-cc-rk3328_defconfig 49 | ``` 50 | 51 | ### Compile boot loader files 52 | 53 | ``` 54 | make CROSS_COMPILE=aarch64-linux-gnu- 55 | ``` 56 | 57 | 58 | ## FDISK for Ubuntu Jammy/Lunar arm64 59 | 60 | Run fdisk as root: `sudo fdisk /dev/sdb` 61 | 62 | ``` 63 | Type g to set GPT Table 64 | Type p to list the current partitions. 65 | Note the starting sector of each partition you want to recreate (/dev/sdb14 and /dev/sdb15). 66 | Type n to create a new partition. 67 | Enter 1 as the partition number. 68 | Enter 235457 as the starting sector (the same as the previous /dev/sdb1 partition). 69 | For the ending sector, choose default. 70 | Type n again to create the next partition. 71 | Enter 14 as the partition number. 72 | Enter 227265 as the starting sector (the same as the previous /dev/sdb14 partition). 73 | Enter 235456 as the ending sector (the same as the previous /dev/sdb14 partition). 74 | Type n again to create the next partition. 75 | Enter 15 as the partition number. 76 | Enter 24512 as the starting sector (the same as the previous /dev/sdb15 partition). 77 | Enter 227264 as the ending sector (the same as the previous /dev/sdb15 partition). 78 | Type w to write the changes to disk. 79 | ``` 80 | 81 | After completing these steps, you should have approximately 13MB of empty space at the beginning of the image for a bootloader. 82 | 83 | 84 | ### Erase with 000000000000000000000 85 | 86 | ```console 87 | $ sudo dd if=/dev/zero of=/dev/sdb1 bs=1M 88 | 89 | #dd: error writing '/dev/sdb1': No space left on device 90 | #3667+0 records in 91 | #3666+0 records out 92 | #3844619264 bytes (3.8 GB, 3.6 GiB) copied, 614.812 s, 6.3 MB/s 93 | 94 | $ sudo dd if=/dev/zero of=/dev/sdb14 bs=1M 95 | 96 | #dd: error writing '/dev/sdb14': No space left on device 97 | #5+0 records in 98 | #4+0 records out 99 | #4194304 bytes (4.2 MB, 4.0 MiB) copied, 2.98357 s, 1.4 MB/s 100 | 101 | $ sudo dd if=/dev/zero of=/dev/sdb15 bs=1M 102 | 103 | #dd: error writing '/dev/sdb15': No space left on device 104 | #100+0 records in 105 | #99+0 records out 106 | #103809536 bytes (104 MB, 99 MiB) copied, 17.8615 s, 5.8 MB/s 107 | ``` 108 | 109 | ### erase boot loader: 110 | 111 | ```console 112 | $ sudo dd if=/dev/zero of=/dev/sdb bs=512 seek=64 count=24447 113 | 114 | #24447+0 records in 115 | #24447+0 records out 116 | #12516864 bytes (13 MB, 12 MiB) copied, 7.51947 s, 1.7 MB/s 117 | 118 | ``` 119 | 120 | ## Cloning 121 | 122 | Download ubuntu lunar preinstalled server: 123 | 124 | https://mirrors.cloud.tencent.com/ubuntu-cdimage/ubuntu-server/daily-preinstalled/current/lunar-preinstalled-server-arm64.img.xz 125 | 126 | ### Extract and mount image 127 | 128 | ``` 129 | sudo losetup -fP --show lunar-preinstalled-server-arm64.img 130 | ``` 131 | 132 | ### Clone each partition to each corresponding partition on the removable media. 133 | 134 | ``` 135 | sudo dd if=/dev/loop0p1 of=/dev/sb1 bs=1M status=progress 136 | sudo dd if=/dev/loop0p14 of=/dev/sb14 bs=1M status=progress 137 | sudo dd if=/dev/loop0p15 of=/dev/sb15 bs=1M status=progress 138 | ``` 139 | 140 | At this point I create an image AFTER you manage the bootflags to match the original image (boot, esp, legacy boot); this way the image has no #bootloader. 141 | 142 | 143 | ## Flash compiled boot loader 144 | 145 | ``` 146 | sudo dd if=u-boot-rockchip.bin of=/dev/sdb seek=64 147 | ``` 148 | --------------------------------------------------------------------------------