Browse Source

first commit

next_step
Luigi Cruz 3 years ago
parent
commit
2ec9641caa
100 changed files with 1325 additions and 1456 deletions
  1. +2
    -16
      .gitignore
  2. +22
    -12
      Dockerfile
  3. +0
    -21
      LICENSE
  4. +11
    -0
      Makefile
  5. +0
    -103
      README.md
  6. +11
    -0
      ansible/00_base.yaml
  7. +14
    -0
      ansible/01_headless.yaml
  8. +11
    -0
      ansible/02_desktop.yaml
  9. +12
    -0
      ansible/03_grub.yaml
  10. +19
    -0
      ansible/03_tegra.yaml
  11. +489
    -0
      ansible/ansible.cfg
  12. +12
    -0
      ansible/group_vars/all.yaml
  13. +5
    -0
      ansible/hosts.yaml
  14. +110
    -0
      ansible/roles/base/tasks/main.yaml
  15. +21
    -0
      ansible/roles/base/templates/etc/apt/sources.list
  16. +6
    -0
      ansible/roles/base/templates/etc/netplan/netcfg.yaml
  17. +0
    -0
      ansible/roles/base/templates/etc/pisdr/build.dirs
  18. +1
    -0
      ansible/roles/base/templates/etc/pisdr/optimizations_amd64.cmake
  19. +5
    -0
      ansible/roles/base/templates/etc/pisdr/optimizations_arm64.cmake
  20. +0
    -0
      ansible/roles/base/templates/etc/pisdr/udev.paths
  21. +9
    -0
      ansible/roles/desktop/tasks/main.yml
  22. +56
    -0
      ansible/roles/gnuradio/tasks/main.yaml
  23. +17
    -0
      ansible/roles/grub/tasks/main.yaml
  24. +57
    -0
      ansible/roles/limesdr/tasks/main.yaml
  25. +68
    -0
      ansible/roles/soapysdr/tasks/main.yaml
  26. +35
    -0
      ansible/roles/tegra_post/tasks/main.yaml
  27. +39
    -0
      ansible/roles/tegra_pre/tasks/main.yaml
  28. +30
    -0
      ansible/roles/uhd/tasks/main.yaml
  29. +26
    -0
      ansible/tasks/cleanup.yaml
  30. +9
    -0
      ansible/tasks/mount.yaml
  31. +9
    -0
      ansible/tasks/umount.yaml
  32. +0
    -108
      build-docker.sh
  33. +64
    -263
      build.sh
  34. +36
    -0
      build_base.sh
  35. +13
    -0
      build_desktop.sh
  36. +18
    -0
      build_grub.sh
  37. +13
    -0
      build_headless.sh
  38. +75
    -0
      build_tegra.sh
  39. +0
    -19
      depends
  40. +0
    -10
      docker-compose.yml
  41. +0
    -9
      export-image/00-allow-rerun/00-run.sh
  42. +0
    -7
      export-image/01-set-sources/01-run.sh
  43. +0
    -3
      export-image/02-network/01-run.sh
  44. +0
    -1
      export-image/02-network/files/resolv.conf
  45. +0
    -13
      export-image/03-set-partuuid/00-run.sh
  46. +0
    -101
      export-image/04-finalise/01-run.sh
  47. +0
    -61
      export-image/prerun.sh
  48. +0
    -100
      scripts/common
  49. +0
    -38
      scripts/dependencies_check
  50. +0
    -11
      scripts/remove-comments.sed
  51. +0
    -19
      stage0/00-configure-apt/00-run.sh
  52. +0
    -1
      stage0/00-configure-apt/files/51cache
  53. +0
    -30
      stage0/00-configure-apt/files/raspberrypi.gpg.key
  54. +0
    -3
      stage0/00-configure-apt/files/raspi.list
  55. +0
    -3
      stage0/00-configure-apt/files/sources.list
  56. +0
    -6
      stage0/01-locale/00-debconf
  57. +0
    -1
      stage0/01-locale/00-packages
  58. +0
    -2
      stage0/02-firmware/01-packages
  59. BIN
      stage0/files/raspberrypi.gpg
  60. +0
    -5
      stage0/prerun.sh
  61. +0
    -4
      stage1/00-boot-files/00-run.sh
  62. +0
    -1
      stage1/00-boot-files/files/cmdline.txt
  63. +0
    -65
      stage1/00-boot-files/files/config.txt
  64. +0
    -33
      stage1/01-sys-tweaks/00-patches/01-bashrc.diff
  65. +0
    -1
      stage1/01-sys-tweaks/00-patches/series
  66. +0
    -15
      stage1/01-sys-tweaks/00-run.sh
  67. +0
    -3
      stage1/01-sys-tweaks/files/fstab
  68. +0
    -2
      stage1/01-sys-tweaks/files/noclear.conf
  69. +0
    -1
      stage1/02-net-tweaks/00-packages
  70. +0
    -6
      stage1/02-net-tweaks/00-run.sh
  71. +0
    -1
      stage1/03-install-packages/00-packages
  72. +0
    -5
      stage1/prerun.sh
  73. +0
    -1
      stage2/00-copies-and-fills/01-packages
  74. +0
    -6
      stage2/00-copies-and-fills/02-run.sh
  75. +0
    -26
      stage2/01-sys-tweaks/00-debconf
  76. +0
    -31
      stage2/01-sys-tweaks/00-packages
  77. +0
    -1
      stage2/01-sys-tweaks/00-packages-nr
  78. +0
    -22
      stage2/01-sys-tweaks/00-patches/01-useradd.diff
  79. +0
    -13
      stage2/01-sys-tweaks/00-patches/02-swap.diff
  80. +0
    -12
      stage2/01-sys-tweaks/00-patches/04-inputrc.diff
  81. +0
    -26
      stage2/01-sys-tweaks/00-patches/05-path.diff
  82. +0
    -5
      stage2/01-sys-tweaks/00-patches/07-resize-init.diff
  83. +0
    -5
      stage2/01-sys-tweaks/00-patches/series
  84. +0
    -56
      stage2/01-sys-tweaks/01-run.sh
  85. +0
    -5
      stage2/01-sys-tweaks/files/50raspi
  86. +0
    -3
      stage2/01-sys-tweaks/files/90-qemu.rules
  87. +0
    -16
      stage2/01-sys-tweaks/files/console-setup
  88. +0
    -20
      stage2/01-sys-tweaks/files/rc.local
  89. +0
    -25
      stage2/01-sys-tweaks/files/resize2fs_once
  90. +0
    -2
      stage2/01-sys-tweaks/files/ttyoutput.conf
  91. +0
    -4
      stage2/02-net-tweaks/00-packages
  92. +0
    -31
      stage2/02-net-tweaks/01-run.sh
  93. +0
    -3
      stage2/02-net-tweaks/files/wait.conf
  94. +0
    -2
      stage2/02-net-tweaks/files/wpa_supplicant.conf
  95. +0
    -2
      stage2/03-accept-mathematica-eula/00-debconf
  96. +0
    -8
      stage2/03-set-timezone/02-run.sh
  97. +0
    -5
      stage2/prerun.sh
  98. +0
    -2
      stage3/00-install-packages/00-debconf
  99. +0
    -15
      stage3/00-install-packages/00-packages
  100. +0
    -6
      stage3/00-install-packages/00-packages-nr

+ 2
- 16
.gitignore View File

@@ -1,16 +1,2 @@
*.gem
.bundle
.sass-cache
_site
Gemfile.lock
node_modules
.DS_Store
deploy/*
work/*
config
postrun.sh
SKIP
SKIP_IMAGES
.pc
*-pc
apt-cacher-ng/
build
export

+ 22
- 12
Dockerfile View File

@@ -1,15 +1,25 @@
FROM i386/debian:buster
FROM amd64/ubuntu:groovy

ENV DEBIAN_FRONTEND noninteractive
RUN apt update
RUN apt install -y --no-install-recommends \
git \
wget \
python \
python3 \
python3-pip \
ubuntu-keyring \
qemu-user-static \
binfmt-support \
debootstrap \
coreutils \
parted \
gdisk \
bzip2 \
kpartx \
lbzip2 \
sudo \
e2fsprogs

RUN apt-get -y update && \
apt-get -y install --no-install-recommends \
git vim parted \
quilt coreutils qemu-user-static debootstrap zerofree zip dosfstools \
bsdtar libcap2-bin rsync grep udev xz-utils curl xxd file kmod bc\
binfmt-support ca-certificates \
&& rm -rf /var/lib/apt/lists/*
RUN python3 -m pip install ansible

COPY . /pi-gen/

VOLUME [ "/pi-gen/work", "/pi-gen/deploy"]
ENTRYPOINT ["bash", "target/build.sh"]

+ 0
- 21
LICENSE View File

@@ -1,21 +0,0 @@
MIT License

Copyright (c) 2019 Luigi Freitas Cruz

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

+ 11
- 0
Makefile View File

@@ -0,0 +1,11 @@
build:
docker build -t pisdr_v2 .

run:
sudo docker run -e PISDR_ARCH=$(arch) -v /dev:/dev --privileged -v $(shell pwd):/target pisdr_v2

login:
sudo chroot $(rootfs) /bin/bash -i

clean:
sudo rm -fr build export

+ 0
- 103
README.md View File

@@ -1,103 +0,0 @@
# 🥧 PiSDR: The SDR Linux Distro for Your Pi
#### Modified Raspbian image with the latest SDR software pre-installed and ready to go. Compatible with every Raspberry Pi.

[![Github All Downloads](https://img.shields.io/github/downloads/luigifreitas/pisdr-image/total)]()
[![Github Latest Version](https://img.shields.io/github/v/release/luigifreitas/pisdr-image)]()

The PiSDR is a Raspbian based operating system for the Raspberry Pi pre-loaded with multiple Software Defined Radio software. It was created to serve as a fast and reliable bootstrap for SDR projects.

## Documentation
This is a single person project with limited time and resources to acquire expensive SDRs. Only radios validated by tests are supported by this image. This is a limitation to maintain a certain level of quality. If you are a vendor and want your SDR supported by this image, consider donating one unit to the project. The latest version of the PiSDR supports every Raspberry Pi model (Zero, 1, 2, 3 and 4).

### Software
List of pre-installed software:
- [UHD](https://github.com/EttusResearch/uhd/tree/UHD-3.15.LTS)
- [GQRX](https://github.com/csete/gqrx)
- [GNURadio](https://github.com/gnuradio/gnuradio)
- [LimeVNA](https://github.com/myriadrf/pyLMS7002Soapy)
- [Soapy Remote](https://github.com/pothosware/SoapyRemote)
- [Soapy](https://github.com/pothosware/SoapySDR)
- [SDR Angel](https://github.com/f4exb/sdrangel)
- [LimeSuite](https://github.com/myriadrf/LimeSuite)
- [RTLSDR-Airband](https://github.com/szpajder/RTLSDR-Airband)
- [LimeSDR_toolbox](https://github.com/emvivre/limesdr_toolbox)
- [osmo-fl2k](https://osmocom.org/projects/osmo-fl2k/wiki)
- [hamlib](https://hamlib.github.io/)
- [VaporTrail](https://github.com/inguardians/VaporTrail)
- [Universal Radio Hacker](https://github.com/jopohl/urh)
- [dump1090](https://github.com/antirez/dump1090)
- [FoxTelem](https://github.com/ac2cz/FoxTelem)
- [Quisk](http://james.ahlstrom.name/quisk/)
- [0xCoto/VIRGO](https://github.com/0xCoto/VIRGO)
- [0xCoto/CygnusRFI](https://github.com/0xCoto/CygnusRFI)
- [F5OEO/rpitx](https://github.com/F5OEO/rpitx)
- [merbanan/rtl_433](https://github.com/merbanan/rtl_433)
- [TLeconte/acarsdec](https://github.com/TLeconte/acarsdec)
- [gpredict](https://github.com/csete/gpredict)
- [EliasOenal/multimon-ng](https://github.com/EliasOenal/multimon-ng)
- [pabr/leansdr](https://github.com/pabr/leansdr)

### Radios
We currently support the following SDR:
- [RTL-SDR](https://www.rtl-sdr.com/about-rtl-sdr/)
- [LimeSDR USB](https://wiki.myriadrf.org/LimeSDR-USB)
- [LimeSDR Mini](https://wiki.myriadrf.org/LimeSDR-Mini)
- [LimeNET Micro](https://wiki.myriadrf.org/LimeNET_Micro)
- [PlutoSDR](https://wiki.analog.com/university/tools/pluto)
- [Airspy R2](https://airspy.com/airspy-r2)
- [Airspy Mini](https://airspy.com/airspy-mini/)
- [Airspy HF Discovery](https://airspy.com/airspy-hf-discovery)
- [Airspy HF+](https://airspy.com/airspy-hf-plus/)
- [HackRF One](https://greatscottgadgets.com/hackrf/one/)
- [USRP](https://www.ettus.com/products/)

## Getting started

### Download
The download file is hosted on GitHub Releases. Click in the button below to go to the latest release and choose the `.tar.xz` file to start downloading your PiSDR image. No `.xz` extraction is required. Use this file directly with the flashing software.

[Download Latest Image](https://github.com/luigifcruz/pisdr-image/releases/latest)

### Installation
The installation process is the same as the vanilla Raspbian. You will need a MicroSD card with at least 8GB of capacity. To transfer the image file to the memory card we recommend the open-source and multi-platform [balenaEtcher](https://www.balena.io/etcher/) or the official [Raspberry Pi Imager](https://www.raspberrypi.org/blog/raspberry-pi-imager-imaging-utility/).

If you are feeling quite adventurous, you can copy the image to the memory card using `dd`. **Warning:** One should be extremely cautious using `dd`, as with any command of this kind it can destroy data irreversibly.
```bash
$ dd bs=4M if=pisdr.img of=/dev/sdX conv=fsync
```
### Usage
This image can be used as a standard Raspbian desktop environment. The HDMI Output, SSH, and Remote VNC are enabled by default. For usage information about any pre-installed software, please refer to our [Software Page](https://pisdr.luigi.ltd/docs/software/software/index).

**Warning: It is important to change the credentials after the first login to ensure your security.**

#### SSH
To access the system with this option, you will need an SSH client. This is built-in inside the Command-Line of most operating systems (Linux, macOS and Windows 10). As a GUI alternative, we recommend using the PuTTY application available for Linux and Windows.

```bash
$ ssh pi@pisdr.local
Password: raspberry
```

#### VNC
The remote desktop can be accessed using any VNC client. The credentials are the same from the SSH. The default screen resolution is set to 720p. This setting can be easily changed inside the `raspi-config` menu (Advanced > Resolution). _Note: The Remmina Client is known to be incompatible with this VNC Server._

## About the project
PiSDR Project was created and maintained since 2019 by [Luigi F. Cruz](https://luigi.ltd).

### Donation
Donations are welcome. This would help offset the development cost.
- [Patreon](https://www.patreon.com/luigifcruz)
- [Buy Me a Coffee](https://www.buymeacoffee.com/luigi)
- [PayPal](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=TAA65AJMC7498&source=url)

### Support
Feel free to hit me up on [Twitter](https://twitter.com/luigifcruz) or [Email](mailto:luigifcruz@gmail.com) if your question isn't answered by this documentation. If you found a bug, please, report it directly on [GitHub Issues](https://github.com/luigifreitas/pisdr-image/issues).

### License
PiSDR is distributed by an [MIT license](https://raw.githubusercontent.com/luigifreitas/pisdr-image/master/LICENSE).

### Disclaimer
This project isn't in any way associated with the Raspberry Pi Foundation.

### Contributing
Everyone is very welcome to contribute to our project. Project icon made by [Smashicons](https://www.flaticon.com/authors/smashicons).

+ 11
- 0
ansible/00_base.yaml View File

@@ -0,0 +1,11 @@
---

- name: Install base system
hosts: pisdr
connection: chroot
pre_tasks:
- include: tasks/mount.yaml
roles:
- base
post_tasks:
- include: tasks/umount.yaml

+ 14
- 0
ansible/01_headless.yaml View File

@@ -0,0 +1,14 @@
---

- name: Install headless system
hosts: pisdr
connection: chroot
pre_tasks:
- include: tasks/mount.yaml
roles:
- uhd
- gnuradio
- soapysdr
- limesdr
post_tasks:
- include: tasks/umount.yaml

+ 11
- 0
ansible/02_desktop.yaml View File

@@ -0,0 +1,11 @@
---

- name: Install desktop system
hosts: pisdr
connection: chroot
pre_tasks:
- include: tasks/mount.yaml
roles:
- desktop
post_tasks:
- include: tasks/umount.yaml

+ 12
- 0
ansible/03_grub.yaml View File

@@ -0,0 +1,12 @@
---

- name: Install GRUB patches
hosts: pisdr
connection: chroot
pre_tasks:
- include: tasks/mount.yaml
roles:
- grub
post_tasks:
- include: tasks/cleanup.yaml
- include: tasks/umount.yaml

+ 19
- 0
ansible/03_tegra.yaml View File

@@ -0,0 +1,19 @@
---

- name: Install Tegra patches
hosts: pisdr
connection: chroot
pre_tasks:
- include: tasks/mount.yaml
tags:
- always
roles:
- {role: 'tegra_pre', tags: 'pre'}
- {role: 'tegra_post', tags: 'post'}
post_tasks:
- include: tasks/cleanup.yaml
tags:
- post
- include: tasks/umount.yaml
tags:
- always

+ 489
- 0
ansible/ansible.cfg View File

@@ -0,0 +1,489 @@
# config file for ansible -- https://ansible.com/
# ===============================================

# nearly all parameters can be overridden in ansible-playbook
# or with command line flags. ansible will read ANSIBLE_CONFIG,
# ansible.cfg in the current working directory, .ansible.cfg in
# the home directory or /etc/ansible/ansible.cfg, whichever it
# finds first

[defaults]

# some basic default values...

inventory = ./hosts.yaml
stdout_callback = debug
#library = /usr/share/my_modules/
#module_utils = /usr/share/my_module_utils/
#local_tmp = ~/.ansible/tmp
#plugin_filters_cfg = /etc/ansible/plugin_filters.yml
#forks = 5
#poll_interval = 15
#sudo_user = root
#ask_sudo_pass = True
#ask_pass = True
#transport = smart
#remote_port = 22
#module_lang = C
#module_set_locale = False

# plays will gather facts by default, which contain information about
# the remote system.
#
# smart - gather by default, but don't regather if already gathered
# implicit - gather by default, turn off with gather_facts: False
# explicit - do not gather by default, must say gather_facts: True
#gathering = implicit

# This only affects the gathering done by a play's gather_facts directive,
# by default gathering retrieves all facts subsets
# all - gather all subsets
# network - gather min and network facts
# hardware - gather hardware facts (longest facts to retrieve)
# virtual - gather min and virtual facts
# facter - import facts from facter
# ohai - import facts from ohai
# You can combine them using comma (ex: network,virtual)
# You can negate them using ! (ex: !hardware,!facter,!ohai)
# A minimal set of facts is always gathered.
#gather_subset = all

# some hardware related facts are collected
# with a maximum timeout of 10 seconds. This
# option lets you increase or decrease that
# timeout to something more suitable for the
# environment.
# gather_timeout = 10

# Ansible facts are available inside the ansible_facts.* dictionary
# namespace. This setting maintains the behaviour which was the default prior
# to 2.5, duplicating these variables into the main namespace, each with a
# prefix of 'ansible_'.
# This variable is set to True by default for backwards compatibility. It
# will be changed to a default of 'False' in a future release.
# ansible_facts.
# inject_facts_as_vars = True

# additional paths to search for roles in, colon separated
#roles_path = /etc/ansible/roles

# uncomment this to disable SSH key host checking
#host_key_checking = False

# change the default callback, you can only have one 'stdout' type enabled at a time.
#stdout_callback = skippy


## Ansible ships with some plugins that require whitelisting,
## this is done to avoid running all of a type by default.
## These setting lists those that you want enabled for your system.
## Custom plugins should not need this unless plugin author specifies it.

# enable callback plugins, they can output to stdout but cannot be 'stdout' type.
#callback_whitelist = timer, mail

# Determine whether includes in tasks and handlers are "static" by
# default. As of 2.0, includes are dynamic by default. Setting these
# values to True will make includes behave more like they did in the
# 1.x versions.
#task_includes_static = False
#handler_includes_static = False

# Controls if a missing handler for a notification event is an error or a warning
#error_on_missing_handler = True

# change this for alternative sudo implementations
#sudo_exe = sudo

# What flags to pass to sudo
# WARNING: leaving out the defaults might create unexpected behaviours
#sudo_flags = -H -S -n

# SSH timeout
#timeout = 10

# default user to use for playbooks if user is not specified
# (/usr/bin/ansible will use current user as default)
#remote_user = root

# logging is off by default unless this path is defined
# if so defined, consider logrotate
#log_path = /var/log/ansible.log

# default module name for /usr/bin/ansible
#module_name = command

# use this shell for commands executed under sudo
# you may need to change this to bin/bash in rare instances
# if sudo is constrained
#executable = /bin/sh

# if inventory variables overlap, does the higher precedence one win
# or are hash values merged together? The default is 'replace' but
# this can also be set to 'merge'.
#hash_behaviour = replace

# by default, variables from roles will be visible in the global variable
# scope. To prevent this, the following option can be enabled, and only
# tasks and handlers within the role will see the variables there
#private_role_vars = yes

# list any Jinja2 extensions to enable here:
#jinja2_extensions = jinja2.ext.do,jinja2.ext.i18n

# if set, always use this private key file for authentication, same as
# if passing --private-key to ansible or ansible-playbook
#private_key_file = /path/to/file

# If set, configures the path to the Vault password file as an alternative to
# specifying --vault-password-file on the command line.

# format of string {{ ansible_managed }} available within Jinja2
# templates indicates to users editing templates files will be replaced.
# replacing {file}, {host} and {uid} and strftime codes with proper values.
#ansible_managed = Ansible managed: {file} modified on %Y-%m-%d %H:%M:%S by {uid} on {host}
# {file}, {host}, {uid}, and the timestamp can all interfere with idempotence
# in some situations so the default is a static string:
#ansible_managed = Ansible managed

# by default, ansible-playbook will display "Skipping [host]" if it determines a task
# should not be run on a host. Set this to "False" if you don't want to see these "Skipping"
# messages. NOTE: the task header will still be shown regardless of whether or not the
# task is skipped.
#display_skipped_hosts = True

# by default, if a task in a playbook does not include a name: field then
# ansible-playbook will construct a header that includes the task's action but
# not the task's args. This is a security feature because ansible cannot know
# if the *module* considers an argument to be no_log at the time that the
# header is printed. If your environment doesn't have a problem securing
# stdout from ansible-playbook (or you have manually specified no_log in your
# playbook on all of the tasks where you have secret information) then you can
# safely set this to True to get more informative messages.
#display_args_to_stdout = False

# by default (as of 1.3), Ansible will raise errors when attempting to dereference
# Jinja2 variables that are not set in templates or action lines. Uncomment this line
# to revert the behavior to pre-1.3.
#error_on_undefined_vars = False

# by default (as of 1.6), Ansible may display warnings based on the configuration of the
# system running ansible itself. This may include warnings about 3rd party packages or
# other conditions that should be resolved if possible.
# to disable these warnings, set the following value to False:
#system_warnings = True

# by default (as of 1.4), Ansible may display deprecation warnings for language
# features that should no longer be used and will be removed in future versions.
# to disable these warnings, set the following value to False:
#deprecation_warnings = True

# (as of 1.8), Ansible can optionally warn when usage of the shell and
# command module appear to be simplified by using a default Ansible module
# instead. These warnings can be silenced by adjusting the following
# setting or adding warn=yes or warn=no to the end of the command line
# parameter string. This will for example suggest using the git module
# instead of shelling out to the git command.
# command_warnings = False


# set plugin path directories here, separate with colons
#action_plugins = /usr/share/ansible/plugins/action
#become_plugins = /usr/share/ansible/plugins/become
#cache_plugins = /usr/share/ansible/plugins/cache
#callback_plugins = /usr/share/ansible/plugins/callback
#connection_plugins = /usr/share/ansible/plugins/connection
#lookup_plugins = /usr/share/ansible/plugins/lookup
#inventory_plugins = /usr/share/ansible/plugins/inventory
#vars_plugins = /usr/share/ansible/plugins/vars
#filter_plugins = /usr/share/ansible/plugins/filter
#test_plugins = /usr/share/ansible/plugins/test
#terminal_plugins = /usr/share/ansible/plugins/terminal
#strategy_plugins = /usr/share/ansible/plugins/strategy


# by default, ansible will use the 'linear' strategy but you may want to try
# another one
#strategy = free

# by default callbacks are not loaded for /bin/ansible, enable this if you
# want, for example, a notification or logging callback to also apply to
# /bin/ansible runs
#bin_ansible_callbacks = False


# don't like cows? that's unfortunate.
# set to 1 if you don't want cowsay support or export ANSIBLE_NOCOWS=1
#nocows = 1

# set which cowsay stencil you'd like to use by default. When set to 'random',
# a random stencil will be selected for each task. The selection will be filtered
# against the `cow_whitelist` option below.
#cow_selection = default
#cow_selection = random

# when using the 'random' option for cowsay, stencils will be restricted to this list.
# it should be formatted as a comma-separated list with no spaces between names.
# NOTE: line continuations here are for formatting purposes only, as the INI parser
# in python does not support them.
#cow_whitelist=bud-frogs,bunny,cheese,daemon,default,dragon,elephant-in-snake,elephant,eyes,\
# hellokitty,kitty,luke-koala,meow,milk,moofasa,moose,ren,sheep,small,stegosaurus,\
# stimpy,supermilker,three-eyes,turkey,turtle,tux,udder,vader-koala,vader,www

# don't like colors either?
# set to 1 if you don't want colors, or export ANSIBLE_NOCOLOR=1
#nocolor = 1

# if set to a persistent type (not 'memory', for example 'redis') fact values
# from previous runs in Ansible will be stored. This may be useful when
# wanting to use, for example, IP information from one group of servers
# without having to talk to them in the same playbook run to get their
# current IP information.
#fact_caching = memory

#This option tells Ansible where to cache facts. The value is plugin dependent.
#For the jsonfile plugin, it should be a path to a local directory.
#For the redis plugin, the value is a host:port:database triplet: fact_caching_connection = localhost:6379:0

#fact_caching_connection=/tmp



# retry files
# When a playbook fails a .retry file can be created that will be placed in ~/
# You can enable this feature by setting retry_files_enabled to True
# and you can change the location of the files by setting retry_files_save_path

retry_files_enabled = False
#retry_files_save_path = ~/.ansible-retry

# squash actions
# Ansible can optimise actions that call modules with list parameters
# when looping. Instead of calling the module once per with_ item, the
# module is called once with all items at once. Currently this only works
# under limited circumstances, and only with parameters named 'name'.
#squash_actions = apk,apt,dnf,homebrew,pacman,pkgng,yum,zypper

# prevents logging of task data, off by default
#no_log = False

# prevents logging of tasks, but only on the targets, data is still logged on the master/controller
#no_target_syslog = False

# controls whether Ansible will raise an error or warning if a task has no
# choice but to create world readable temporary files to execute a module on
# the remote machine. This option is False by default for security. Users may
# turn this on to have behaviour more like Ansible prior to 2.1.x. See
# https://docs.ansible.com/ansible/become.html#becoming-an-unprivileged-user
# for more secure ways to fix this than enabling this option.
#allow_world_readable_tmpfiles = False

# controls the compression level of variables sent to
# worker processes. At the default of 0, no compression
# is used. This value must be an integer from 0 to 9.
#var_compression_level = 9

# controls what compression method is used for new-style ansible modules when
# they are sent to the remote system. The compression types depend on having
# support compiled into both the controller's python and the client's python.
# The names should match with the python Zipfile compression types:
# * ZIP_STORED (no compression. available everywhere)
# * ZIP_DEFLATED (uses zlib, the default)
# These values may be set per host via the ansible_module_compression inventory
# variable
#module_compression = 'ZIP_DEFLATED'

# This controls the cutoff point (in bytes) on --diff for files
# set to 0 for unlimited (RAM may suffer!).
#max_diff_size = 1048576

# This controls how ansible handles multiple --tags and --skip-tags arguments
# on the CLI. If this is True then multiple arguments are merged together. If
# it is False, then the last specified argument is used and the others are ignored.
# This option will be removed in 2.8.
#merge_multiple_cli_flags = True

# Controls showing custom stats at the end, off by default
#show_custom_stats = True

# Controls which files to ignore when using a directory as inventory with
# possibly multiple sources (both static and dynamic)
#inventory_ignore_extensions = ~, .orig, .bak, .ini, .cfg, .retry, .pyc, .pyo

# This family of modules use an alternative execution path optimized for network appliances
# only update this setting if you know how this works, otherwise it can break module execution
#network_group_modules=eos, nxos, ios, iosxr, junos, vyos

# When enabled, this option allows lookups (via variables like {{lookup('foo')}} or when used as
# a loop with `with_foo`) to return data that is not marked "unsafe". This means the data may contain
# jinja2 templating language which will be run through the templating engine.
# ENABLING THIS COULD BE A SECURITY RISK
#allow_unsafe_lookups = False

# set default errors for all plays
#any_errors_fatal = False

[inventory]
# enable inventory plugins, default: 'host_list', 'script', 'auto', 'yaml', 'ini', 'toml'
#enable_plugins = host_list, virtualbox, yaml, constructed

# ignore these extensions when parsing a directory as inventory source
#ignore_extensions = .pyc, .pyo, .swp, .bak, ~, .rpm, .md, .txt, ~, .orig, .ini, .cfg, .retry

# ignore files matching these patterns when parsing a directory as inventory source
#ignore_patterns=

# If 'true' unparsed inventory sources become fatal errors, they are warnings otherwise.
#unparsed_is_failed=False

[privilege_escalation]
#become=True
#become_method=sudo
#become_user=root
#become_ask_pass=False

[paramiko_connection]

# uncomment this line to cause the paramiko connection plugin to not record new host
# keys encountered. Increases performance on new host additions. Setting works independently of the
# host key checking setting above.
#record_host_keys=False

# by default, Ansible requests a pseudo-terminal for commands executed under sudo. Uncomment this
# line to disable this behaviour.
#pty=False

# paramiko will default to looking for SSH keys initially when trying to
# authenticate to remote devices. This is a problem for some network devices
# that close the connection after a key failure. Uncomment this line to
# disable the Paramiko look for keys function
#look_for_keys = False

# When using persistent connections with Paramiko, the connection runs in a
# background process. If the host doesn't already have a valid SSH key, by
# default Ansible will prompt to add the host key. This will cause connections
# running in background processes to fail. Uncomment this line to have
# Paramiko automatically add host keys.
#host_key_auto_add = True

[ssh_connection]

# ssh arguments to use
# Leaving off ControlPersist will result in poor performance, so use
# paramiko on older platforms rather than removing it, -C controls compression use
#ssh_args = -C -o ControlMaster=auto -o ControlPersist=60s

# The base directory for the ControlPath sockets.
# This is the "%(directory)s" in the control_path option
#
# Example:
# control_path_dir = /tmp/.ansible/cp
#control_path_dir = ~/.ansible/cp

# The path to use for the ControlPath sockets. This defaults to a hashed string of the hostname,
# port and username (empty string in the config). The hash mitigates a common problem users
# found with long hostnames and the conventional %(directory)s/ansible-ssh-%%h-%%p-%%r format.
# In those cases, a "too long for Unix domain socket" ssh error would occur.
#
# Example:
# control_path = %(directory)s/%%h-%%r
#control_path =

# Enabling pipelining reduces the number of SSH operations required to
# execute a module on the remote server. This can result in a significant
# performance improvement when enabled, however when using "sudo:" you must
# first disable 'requiretty' in /etc/sudoers
#
# By default, this option is disabled to preserve compatibility with
# sudoers configurations that have requiretty (the default on many distros).
#
#pipelining = False

# Control the mechanism for transferring files (old)
# * smart = try sftp and then try scp [default]
# * True = use scp only
# * False = use sftp only
#scp_if_ssh = smart

# Control the mechanism for transferring files (new)
# If set, this will override the scp_if_ssh option
# * sftp = use sftp to transfer files
# * scp = use scp to transfer files
# * piped = use 'dd' over SSH to transfer files
# * smart = try sftp, scp, and piped, in that order [default]
#transfer_method = smart

# if False, sftp will not use batch mode to transfer files. This may cause some
# types of file transfer failures impossible to catch however, and should
# only be disabled if your sftp version has problems with batch mode
#sftp_batch_mode = False

# The -tt argument is passed to ssh when pipelining is not enabled because sudo
# requires a tty by default.
#usetty = True

# Number of times to retry an SSH connection to a host, in case of UNREACHABLE.
# For each retry attempt, there is an exponential backoff,
# so after the first attempt there is 1s wait, then 2s, 4s etc. up to 30s (max).
#retries = 3

[persistent_connection]

# Configures the persistent connection timeout value in seconds. This value is
# how long the persistent connection will remain idle before it is destroyed.
# If the connection doesn't receive a request before the timeout value
# expires, the connection is shutdown. The default value is 30 seconds.
#connect_timeout = 30

# The command timeout value defines the amount of time to wait for a command
# or RPC call before timing out. The value for the command timeout must
# be less than the value of the persistent connection idle timeout (connect_timeout)
# The default value is 30 second.
#command_timeout = 30

[accelerate]
#accelerate_port = 5099
#accelerate_timeout = 30
#accelerate_connect_timeout = 5.0

# The daemon timeout is measured in minutes. This time is measured
# from the last activity to the accelerate daemon.
#accelerate_daemon_timeout = 30

# If set to yes, accelerate_multi_key will allow multiple
# private keys to be uploaded to it, though each user must
# have access to the system via SSH to add a new key. The default
# is "no".
#accelerate_multi_key = yes

[selinux]
# file systems that require special treatment when dealing with security context
# the default behaviour that copies the existing context or uses the user default
# needs to be changed to use the file system dependent context.
#special_context_filesystems=nfs,vboxsf,fuse,ramfs,9p,vfat

# Set this to yes to allow libvirt_lxc connections to work without SELinux.
#libvirt_lxc_noseclabel = yes

[colors]
#highlight = white
#verbose = blue
#warn = bright purple
#error = red
#debug = dark gray
#deprecate = purple
#skip = cyan
#unreachable = red
#ok = green
#changed = yellow
#diff_add = green
#diff_remove = red
#diff_lines = cyan


[diff]
# Always print diff when running ( same as always running with -D/--diff )
# always = no

# Set how many context lines to show in diff
# context = 3

+ 12
- 0
ansible/group_vars/all.yaml View File

@@ -0,0 +1,12 @@
---

user:
shell: /bin/bash
name: "{{ lookup('env', 'PISDR_USER') }}"
password: "{{ lookup('env', 'PISDR_PASS') }}"

config_dir: "/etc/pisdr"
install_dir: "/home/{{ user.name }}/PiSDR"
ubuntu_release: "{{ lookup('env', 'PISDR_RELEASE') }}"
environment: "{{ lookup('env', 'PISDR_ENVIRONMENT') }}"
base_dir: "{{ lookup('env', 'ANSIBLE_ROOTFS_DIR') }}"

+ 5
- 0
ansible/hosts.yaml View File

@@ -0,0 +1,5 @@
all:
hosts:
pisdr:
ansible_host: "{{ lookup('env', 'ANSIBLE_ROOTFS_DIR') }}"
ansible_executable: /bin/bash

+ 110
- 0
ansible/roles/base/tasks/main.yaml View File

@@ -0,0 +1,110 @@
---

- name: Update sources.list
template:
src: etc/apt/sources.list
dest: /etc/apt/sources.list
owner: root
group: root
mode: 0644

- name: Upgrade packages
apt:
upgrade: dist
update_cache: yes

- name: Install packages
apt:
name: "{{ item }}"
loop:
- ubuntu-minimal
- ifupdown
- bridge-utils
- bash-completion
- net-tools
- pciutils
- python3-dev
- python3-pip
- ssh
- usbutils
- unzip
- pkg-config
- iotop
- re2c
- ninja-build
- cmake
- build-essential

- name: Install Ubuntu Server
apt:
name: ubuntu-server
install_recommends: no

- name: Generate locales
locale_gen:
name: en_US.UTF-8
state: present

- name: Enable services
shell: systemctl enable {{ item }}
loop:
- ssh
- systemd-networkd
- systemd-resolved

- name: Create network conf
template:
src: etc/netplan/netcfg.yaml
dest: /etc/netplan/netcfg.yaml
owner: root
group: root
mode: 0644

- name: Create new user
user:
name: "{{ user.name }}"
shell: "{{ user.shell }}"
password: "{{ user.password | password_hash('sha512') }}"
create_home: yes
groups: sudo,sys,video,uucp,lp,input,audio,plugdev
state: present

- name: Creates PiSDR directories
file:
path: "{{ item }}"
state: directory
loop:
- "{{ config_dir }}"
- "{{ install_dir }}"

- name: Update build directories
template:
src: "etc/pisdr/{{ item }}"
dest: "{{ config_dir }}/{{ item }}"
owner: root
group: root
mode: 0764
loop:
- "build.dirs"
- "udev.paths"

- name: Update CMake optimization for ARM64
template:
src: etc/pisdr/optimizations_arm64.cmake
dest: "{{ config_dir }}/optimizations.cmake"
owner: root
group: root
mode: 0644
when: ansible_architecture == "aarch64"

- name: Update CMake optimization for AMD64
template:
src: etc/pisdr/optimizations_amd64.cmake
dest: "{{ config_dir }}/optimizations.cmake"
owner: root
group: root
mode: 0644
when: ansible_architecture == "x86_64"

- name: Ensure default multi-user target
shell: systemctl set-default multi-user.target

+ 21
- 0
ansible/roles/base/templates/etc/apt/sources.list View File

@@ -0,0 +1,21 @@
deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ {{ ubuntu_release }} main restricted
deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ {{ ubuntu_release }}-updates main restricted
deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ {{ ubuntu_release }} universe
deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ {{ ubuntu_release }}-updates universe
deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ {{ ubuntu_release }} multiverse
deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ {{ ubuntu_release }}-updates multiverse
deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ {{ ubuntu_release }}-backports main restricted universe multiverse
deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ {{ ubuntu_release }}-security main restricted
deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ {{ ubuntu_release }}-security universe
deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ {{ ubuntu_release }}-security multiverse

deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ {{ ubuntu_release }} main restricted
deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ {{ ubuntu_release }}-updates main restricted
deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ {{ ubuntu_release }} universe
deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ {{ ubuntu_release }}-updates universe
deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ {{ ubuntu_release }} multiverse
deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ {{ ubuntu_release }}-updates multiverse
deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ {{ ubuntu_release }}-backports main restricted universe multiverse
deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ {{ ubuntu_release }}-security main restricted
deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ {{ ubuntu_release }}-security universe
deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ {{ ubuntu_release }}-security multiverse

+ 6
- 0
ansible/roles/base/templates/etc/netplan/netcfg.yaml View File

@@ -0,0 +1,6 @@
network:
version: 2
renderer: networkd
ethernets:
eth0:
dhcp4: true

+ 0
- 0
ansible/roles/base/templates/etc/pisdr/build.dirs View File


+ 1
- 0
ansible/roles/base/templates/etc/pisdr/optimizations_amd64.cmake View File

@@ -0,0 +1 @@
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "" FORCE)

+ 5
- 0
ansible/roles/base/templates/etc/pisdr/optimizations_arm64.cmake View File

@@ -0,0 +1,5 @@
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "" FORCE)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=armv8-a" CACHE STRING "" FORCE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=armv8-a" CACHE STRING "" FORCE)
set(DCMAKE_ASM_FLAGS "${DCMAKE_ASM_FLAGS} -march=armv8-a" CACHE STRING "" FORCE)

+ 0
- 0
ansible/roles/base/templates/etc/pisdr/udev.paths View File


+ 9
- 0
ansible/roles/desktop/tasks/main.yml View File

@@ -0,0 +1,9 @@
---

- name: Install ubuntu desktop minimal
apt:
name: ubuntu-desktop-minimal
install_recommends: yes

- name: Ensure default graphical target
shell: systemctl set-default graphical.target

+ 56
- 0
ansible/roles/gnuradio/tasks/main.yaml View File

@@ -0,0 +1,56 @@
---

- name: Install Dependencies
apt:
name: "{{ item }}"
loop:
- libboost-all-dev
- swig
- libzmq3-dev
- libfftw3-dev
- libgsl-dev
- libsdl1.2-dev
- libusb-1.0-0-dev
- libasound2-dev
- portaudio19-dev
- libportaudio2
- pulseaudio
- libjack-dev
- libgmp-dev
- libsdl1.2-dev
- liblog4cpp5-dev
- libqwt-qt5-dev
- libqt5opengl5-dev
- python3-numpy
- python3-mako
- python3-sphinx
- python3-lxml
- python3-pyqt5
- python3-yaml
- python3-click
- python3-click-plugins
- python3-zmq
- python3-scipy
- python3-pip
- python3-gi
- python3-gi-cairo
- gobject-introspection
- gir1.2-gtk-3.0

- name: Git checkout
git:
repo: "https://github.com/gnuradio/gnuradio.git"
dest: "{{ install_dir }}/gnuradio"
version: maint-3.8
recursive: yes

- name: Build
shell: |
set -e
cd {{ install_dir }}/gnuradio
mkdir -p build
cd build
cmake -GNinja -DCMAKE_TOOLCHAIN_FILE=/etc/pisdr/optimizations.cmake ../
ninja install
ldconfig
echo "$(pwd)" >> {{ config_dir }}/build.dirs

+ 17
- 0
ansible/roles/grub/tasks/main.yaml View File

@@ -0,0 +1,17 @@
---

- name: Install generic Linux kernel
apt:
name: linux-image-generic
install_recommends: yes

- name: Install GRUB Bootloader
apt:
name: grub2

- name: Install Linux firmware
apt:
name: "{{ item }}"
install_recommends: yes
loop:
- linux-firmware

+ 57
- 0
ansible/roles/limesdr/tasks/main.yaml View File

@@ -0,0 +1,57 @@
---

- name: Install Dependencies
apt:
name: "{{ item }}"
loop:
- swig
- libsqlite3-dev
- libi2c-dev
- libusb-1.0-0-dev
- libwxgtk3.0-gtk3-dev
- freeglut3-dev

- name: Git checkout
git:
repo: "https://github.com/myriadrf/LimeSuite.git"
dest: "{{ install_dir }}/LimeSuite"
version: master
recursive: yes
depth: 1

- name: Build
shell: |
set -e
cd {{ install_dir }}/LimeSuite
mkdir -p build
cd build
cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS=-latomic ../
ninja install
ldconfig
echo "$(pwd)" >> {{ config_dir }}/build.dirs

- name: Install UDEV Rules
shell: |
set -e
cd {{ install_dir }}/LimeSuite/udev-rules
./install.sh
echo "/etc/udev/rules.d/64-limesuite.rules" >> {{ config_dir }}/udev.paths

- name: Git checkout gr-limesdr
git:
repo: "https://github.com/myriadrf/gr-limesdr.git"
dest: "{{ install_dir }}/gr-limesdr"
version: gr-3.8
recursive: yes
depth: 1

- name: Build gr-limesdr
shell: |
set -e
cd {{ install_dir }}/gr-limesdr
mkdir -p build
cd build
cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS=-latomic ../
ninja install
ldconfig
echo "$(pwd)" >> {{ config_dir }}/build.dirs

+ 68
- 0
ansible/roles/soapysdr/tasks/main.yaml View File

@@ -0,0 +1,68 @@
---

- name: Install Dependencies
apt:
name: "{{ item }}"
loop:
- swig
- avahi-daemon
- libavahi-client-dev
- libusb-1.0-0-dev
- python3-dev

- name: Git checkout SoapySDR
git:
repo: "https://github.com/pothosware/SoapySDR.git"
dest: "{{ install_dir }}/SoapySDR"
version: master
recursive: yes
depth: 1

- name: Build SoapySDR
shell: |
set -e
cd {{ install_dir }}/SoapySDR
mkdir -p build
cd build
cmake -GNinja -DCMAKE_TOOLCHAIN_FILE=/etc/pisdr/optimizations.cmake ../
ninja install
ldconfig
echo "$(pwd)" >> {{ config_dir }}/build.dirs

- name: Git checkout SoapySDR Remote
git:
repo: "https://github.com/pothosware/SoapyRemote.git"
dest: "{{ install_dir }}/SoapyRemote"
version: master
recursive: yes
depth: 1

- name: Build SoapySDR Remote
shell: |
set -e
cd {{ install_dir }}/SoapyRemote
mkdir -p build
cd build
cmake -GNinja -DCMAKE_BUILD_TYPE=Release ../
ninja install
ldconfig
echo "$(pwd)" >> {{ config_dir }}/build.dirs

- name: Git checkout gr-soapy
git:
repo: "https://gitlab.com/librespacefoundation/gr-soapy.git"
dest: "{{ install_dir }}/gr-soapy"
version: master
recursive: yes
depth: 1

- name: Build gr-soapy
shell: |
set -e
cd {{ install_dir }}/gr-soapy
mkdir -p build
cd build
cmake -GNinja -DCMAKE_BUILD_TYPE=Release ../
ninja install
ldconfig
echo "$(pwd)" >> {{ config_dir }}/build.dirs

+ 35
- 0
ansible/roles/tegra_post/tasks/main.yaml View File

@@ -0,0 +1,35 @@
---

- name: Hold modules
ignore_errors: yes
shell: "apt-mark hold {{ item }}"
with_items:
- nvidia-l4t-tools
- nvidia-l4t-bootloader

- name: Fix Screen Manager
ignore_errors: yes
shell: |
mv /usr/share/xsessions/ux-ubuntu.desktop /usr/share/xsessions/ubuntu.desktop
rm -fr /usr/share/xsessions/gnome*.desktop

- name: Fix nvpmodel_indicator logo
shell: rm -fr /usr/share/nvpmodel_indicator/nv_logo.svg
ignore_errors: yes

- name: Delete oem-config
shell: "rm -r {{ item }}"
loop:
- /etc/systemd/nv-oem-config*.sh
- /etc/systemd/nvweston.sh
- /etc/systemd/system/nvweston.service
- /etc/nv-oem-config.conf
- /usr/sbin/nv-oem-config-firstboot
- /lib/systemd/system/nv-oem-config*.*
ignore_errors: yes

- name: Append resize command to first boot
shell: |
sed -i '$ d' /etc/systemd/nvfb.sh
echo "./usr/lib/nvidia/resizefs/nvresizefs.sh" >> /etc/systemd/nvfb.sh
echo "rm -rf /etc/nv/nvfirstboot" >> /etc/systemd/nvfb.sh

+ 39
- 0
ansible/roles/tegra_pre/tasks/main.yaml View File

@@ -0,0 +1,39 @@
---
- name: Install dependencies
apt:
name: "{{ item }}"
loop:
- libgstreamer-plugins-bad1.0-0
- libgstreamer-plugins-base1.0-0
- libevdev2
- libinput10
- libjpeg-turbo8
- libwayland-cursor0
- libgles2-mesa-dev
- libwayland-egl1-mesa
- libxkbcommon0
- libgstreamer1.0-0
- device-tree-compiler
- libcairo2
- libdatrie1
- libfontconfig1
- libharfbuzz0b
- libpangoft2-1.0-0
- libpixman-1-0
- libxrender1
- libpango-1.0-0
- libpangocairo-1.0-0
- libunwind8
- libappindicator3-dev
- gdisk
- parted

- name: Download libffi6
get_url:
url: http://ports.ubuntu.com/pool/main/libf/libffi/libffi6_3.2.1-8_arm64.deb
dest: /tmp/libffi6_3.2.1-8_arm64.deb

- name: Install a libffi6 package
apt:
deb: /tmp/libffi6_3.2.1-8_arm64.deb

+ 30
- 0
ansible/roles/uhd/tasks/main.yaml View File

@@ -0,0 +1,30 @@
---

- name: Install Dependencies
apt:
name: "{{ item }}"
loop:
- libboost-all-dev
- libusb-1.0-0-dev
- python3-mako

- name: Git checkout
git:
repo: "https://github.com/EttusResearch/uhd.git"
dest: "{{ install_dir }}/uhd"
version: UHD-3.15.LTS
recursive: yes

- name: Build
shell: |
set -e
cd {{ install_dir }}/uhd/host
mkdir -p build
cd build
cmake -GNinja -DCMAKE_TOOLCHAIN_FILE=/etc/pisdr/optimizations.cmake ../
ninja install
cp /usr/local/lib/uhd/utils/uhd-usrp.rules /etc/udev/rules.d/
uhd_images_downloader
ldconfig
echo "$(pwd)" >> {{ config_dir }}/build.dirs
echo "/etc/udev/rules.d/uhd-usrp.rules" >> {{ config_dir }}/udev.paths

+ 26
- 0
ansible/tasks/cleanup.yaml View File

@@ -0,0 +1,26 @@
---

- name: Clean apt cache
command: apt clean
become: yes

- name: Clean build directories
ignore_errors: yes
shell: |
for f in $(cat {{ config_dir }}/build.dirs); do
echo "Deleting build dir: $f"
rm -r "$f"
done

- name: Sync Python modules
ignore_errors: yes
shell: ln -s /usr/local/lib/python3/dist-packages/* /usr/lib/python3/dist-packages

- name: Set udev rules
shell: |
for f in $(cat {{ config_dir }}/udev.paths); do
echo "Owning udev rule: $f"
chown pi:pi "$f"
done
udevadm control --reload-rules
udevadm trigger

+ 9
- 0
ansible/tasks/mount.yaml View File

@@ -0,0 +1,9 @@
---

- name: Mount pseudo filesystems
connection: local
shell: mount -o bind '{{ item }}' '{{ lookup('env', 'ANSIBLE_ROOTFS_DIR') }}{{ item }}'
with_items:
- /proc
- /dev
- /dev/pts

+ 9
- 0
ansible/tasks/umount.yaml View File

@@ -0,0 +1,9 @@
---

- name: Umount pseudo filesystems
connection: local
shell: umount -l '{{ lookup('env', 'ANSIBLE_ROOTFS_DIR') }}{{ item }}'
with_items:
- /proc
- /dev/pts
- /dev

+ 0
- 108
build-docker.sh View File

@@ -1,108 +0,0 @@
#!/bin/bash -eu
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"

BUILD_OPTS="$*"

DOCKER="docker"

if ! ${DOCKER} ps >/dev/null 2>&1; then
DOCKER="sudo docker"
fi
if ! ${DOCKER} ps >/dev/null; then
echo "error connecting to docker:"
${DOCKER} ps
exit 1
fi

CONFIG_FILE=""
if [ -f "${DIR}/config" ]; then
CONFIG_FILE="${DIR}/config"
fi

while getopts "c:" flag
do
case "${flag}" in
c)
CONFIG_FILE="${OPTARG}"
;;
*)
;;
esac
done

# Ensure that the configuration file is an absolute path
if test -x /usr/bin/realpath; then
CONFIG_FILE=$(realpath -s "$CONFIG_FILE" || realpath "$CONFIG_FILE")
fi

# Ensure that the confguration file is present
if test -z "${CONFIG_FILE}"; then
echo "Configuration file need to be present in '${DIR}/config' or path passed as parameter"
exit 1
else
# shellcheck disable=SC1090
source ${CONFIG_FILE}
fi

CONTAINER_NAME=${CONTAINER_NAME:-pigen_work}
CONTINUE=${CONTINUE:-0}
PRESERVE_CONTAINER=${PRESERVE_CONTAINER:-0}

if [ -z "${IMG_NAME}" ]; then
echo "IMG_NAME not set in 'config'" 1>&2
echo 1>&2
exit 1
fi

# Ensure the Git Hash is recorded before entering the docker container
GIT_HASH=${GIT_HASH:-"$(git rev-parse HEAD)"}

CONTAINER_EXISTS=$(${DOCKER} ps -a --filter name="${CONTAINER_NAME}" -q)
CONTAINER_RUNNING=$(${DOCKER} ps --filter name="${CONTAINER_NAME}" -q)
if [ "${CONTAINER_RUNNING}" != "" ]; then
echo "The build is already running in container ${CONTAINER_NAME}. Aborting."
exit 1
fi
if [ "${CONTAINER_EXISTS}" != "" ] && [ "${CONTINUE}" != "1" ]; then
echo "Container ${CONTAINER_NAME} already exists and you did not specify CONTINUE=1. Aborting."
echo "You can delete the existing container like this:"
echo " ${DOCKER} rm -v ${CONTAINER_NAME}"
exit 1
fi

# Modify original build-options to allow config file to be mounted in the docker container
BUILD_OPTS="$(echo "${BUILD_OPTS:-}" | sed -E 's@\-c\s?([^ ]+)@-c /config@')"

${DOCKER} build -t pi-gen "${DIR}"
if [ "${CONTAINER_EXISTS}" != "" ]; then
trap 'echo "got CTRL+C... please wait 5s" && ${DOCKER} stop -t 5 ${CONTAINER_NAME}_cont' SIGINT SIGTERM
time ${DOCKER} run --rm --privileged \
--volume "${CONFIG_FILE}":/config:ro \
-e "GIT_HASH=${GIT_HASH}" \
--volumes-from="${CONTAINER_NAME}" --name "${CONTAINER_NAME}_cont" \
pi-gen \
bash -e -o pipefail -c "dpkg-reconfigure qemu-user-static &&
cd /pi-gen; ./build.sh ${BUILD_OPTS} &&
rsync -av work/*/build.log deploy/" &
wait "$!"
else
trap 'echo "got CTRL+C... please wait 5s" && ${DOCKER} stop -t 5 ${CONTAINER_NAME}' SIGINT SIGTERM
time ${DOCKER} run --name "${CONTAINER_NAME}" --privileged \
--volume "${CONFIG_FILE}":/config:ro \
-e "GIT_HASH=${GIT_HASH}" \
pi-gen \
bash -e -o pipefail -c "dpkg-reconfigure qemu-user-static &&
cd /pi-gen; ./build.sh ${BUILD_OPTS} &&
rsync -av work/*/build.log deploy/" &
wait "$!"
fi
echo "copying results from deploy/"
${DOCKER} cp "${CONTAINER_NAME}":/pi-gen/deploy .
ls -lah deploy

# cleanup
if [ "${PRESERVE_CONTAINER}" != "1" ]; then
${DOCKER} rm -v "${CONTAINER_NAME}"
fi

echo "Done! Your image(s) should be in deploy/"

+ 64
- 263
build.sh View File

@@ -1,275 +1,76 @@
#!/bin/bash -e
# shellcheck disable=SC2119
run_sub_stage()
{
log "Begin ${SUB_STAGE_DIR}"
pushd "${SUB_STAGE_DIR}" > /dev/null
for i in {00..99}; do
if [ -f "${i}-debconf" ]; then
log "Begin ${SUB_STAGE_DIR}/${i}-debconf"
on_chroot << EOF
debconf-set-selections <<SELEOF
$(cat "${i}-debconf")
SELEOF
EOF

log "End ${SUB_STAGE_DIR}/${i}-debconf"
fi
if [ -f "${i}-packages-nr" ]; then
log "Begin ${SUB_STAGE_DIR}/${i}-packages-nr"
PACKAGES="$(sed -f "${SCRIPT_DIR}/remove-comments.sed" < "${i}-packages-nr")"
if [ -n "$PACKAGES" ]; then
on_chroot << EOF
n=0
until [ "$n" -ge 5 ]
do
apt-get --ignore-missing --fix-missing install --no-install-recommends -y $PACKAGES && break
n=$((n+1))
sleep 15
done
EOF
fi
log "End ${SUB_STAGE_DIR}/${i}-packages-nr"
fi
if [ -f "${i}-packages" ]; then
log "Begin ${SUB_STAGE_DIR}/${i}-packages"
PACKAGES="$(sed -f "${SCRIPT_DIR}/remove-comments.sed" < "${i}-packages")"
if [ -n "$PACKAGES" ]; then
on_chroot << EOF
n=0
until [ "$n" -ge 5 ]
do
apt-get --ignore-missing --fix-missing install -y $PACKAGES && break
n=$((n+1))
sleep 15
done
EOF
fi
log "End ${SUB_STAGE_DIR}/${i}-packages"
fi
if [ -d "${i}-patches" ]; then
log "Begin ${SUB_STAGE_DIR}/${i}-patches"
pushd "${STAGE_WORK_DIR}" > /dev/null
if [ "${CLEAN}" = "1" ]; then
rm -rf .pc
rm -rf ./*-pc
fi
QUILT_PATCHES="${SUB_STAGE_DIR}/${i}-patches"
SUB_STAGE_QUILT_PATCH_DIR="$(basename "$SUB_STAGE_DIR")-pc"
mkdir -p "$SUB_STAGE_QUILT_PATCH_DIR"
ln -snf "$SUB_STAGE_QUILT_PATCH_DIR" .pc
quilt upgrade
if [ -e "${SUB_STAGE_DIR}/${i}-patches/EDIT" ]; then
echo "Dropping into bash to edit patches..."
bash
fi
RC=0
quilt push -a || RC=$?
case "$RC" in
0|2)
;;
*)
false
;;
esac
popd > /dev/null
log "End ${SUB_STAGE_DIR}/${i}-patches"
fi
if [ -x ${i}-run.sh ]; then
log "Begin ${SUB_STAGE_DIR}/${i}-run.sh"
./${i}-run.sh
log "End ${SUB_STAGE_DIR}/${i}-run.sh"
fi
if [ -f ${i}-run-chroot.sh ]; then
log "Begin ${SUB_STAGE_DIR}/${i}-run-chroot.sh"
on_chroot < ${i}-run-chroot.sh
log "End ${SUB_STAGE_DIR}/${i}-run-chroot.sh"
fi
done
popd > /dev/null
log "End ${SUB_STAGE_DIR}"
}


run_stage(){
log "Begin ${STAGE_DIR}"
STAGE="$(basename "${STAGE_DIR}")"
pushd "${STAGE_DIR}" > /dev/null
unmount "${WORK_DIR}/${STAGE}"
STAGE_WORK_DIR="${WORK_DIR}/${STAGE}"
ROOTFS_DIR="${STAGE_WORK_DIR}"/rootfs
if [ ! -f SKIP_IMAGES ]; then
if [ -f "${STAGE_DIR}/EXPORT_IMAGE" ]; then
EXPORT_DIRS="${EXPORT_DIRS} ${STAGE_DIR}"
fi
fi
if [ ! -f SKIP ]; then
if [ "${CLEAN}" = "1" ]; then
if [ -d "${ROOTFS_DIR}" ]; then
rm -rf "${ROOTFS_DIR}"
fi
fi
if [ -x prerun.sh ]; then
log "Begin ${STAGE_DIR}/prerun.sh"
./prerun.sh
log "End ${STAGE_DIR}/prerun.sh"
fi
for SUB_STAGE_DIR in "${STAGE_DIR}"/*; do
if [ -d "${SUB_STAGE_DIR}" ] &&
[ ! -f "${SUB_STAGE_DIR}/SKIP" ]; then
run_sub_stage
fi
done
fi
unmount "${WORK_DIR}/${STAGE}"
PREV_STAGE="${STAGE}"
PREV_STAGE_DIR="${STAGE_DIR}"
PREV_ROOTFS_DIR="${ROOTFS_DIR}"
popd > /dev/null
log "End ${STAGE_DIR}"
}

if [ "$(id -u)" != "0" ]; then
echo "Please run as root" 1>&2
exit 1
fi

BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
export BASE_DIR

if [ -f config ]; then
# shellcheck disable=SC1091
source config
#!/bin/bash

set -e

##############################################################

#### Image Settings
export PISDR_RELEASE="focal"
export PISDR_USER="pi"
export PISDR_PASS="raspberry"
export PISDR_IMG_NAME="$(date '+%Y-%m-%d')-PiSDR-$PISDR_ARCH"

#### Build Settings
BUILD_BOARD_TEGRA_NANO=true
BUILD_BOARD_TEGRA_AGX=true
BUILD_BOARD_RPI=false
BUILD_BOARD_GRUB=true

#### Compiler Settings
export TARGET="/target"
export BUILD="/build/$PISDR_ARCH"
export BASE_DIR="$TARGET$BUILD/base"
export DESKTOP_DIR="$TARGET$BUILD/desktop"
export HEADLESS_DIR="$TARGET$BUILD/headless"
export EXPORT_DIR="$TARGET/export"

##############################################################

printf "Validating pipeline configuration... "
if [ "$PISDR_ARCH" != "amd64" ] && [ "$PISDR_ARCH" != "arm64" ]; then
printf "(NOK)\n"
echo "Invalid PISDR_ARCH environment variable. Choose between amd64 and arm64."
exit
fi
printf "(OK)\n"

while getopts "c:" flag
do
case "$flag" in
c)
EXTRA_CONFIG="$OPTARG"
# shellcheck disable=SC1090
source "$EXTRA_CONFIG"
;;
*)
;;
esac
done

export PI_GEN=${PI_GEN:-pi-gen}
export PI_GEN_REPO=${PI_GEN_REPO:-https://github.com/RPi-Distro/pi-gen}

if [ -z "${IMG_NAME}" ]; then
echo "IMG_NAME not set" 1>&2
exit 1
fi

export USE_QEMU="${USE_QEMU:-0}"
export IMG_DATE="${IMG_DATE:-"$(date +%Y-%m-%d)"}"
export IMG_FILENAME="${IMG_FILENAME:-"${IMG_DATE}-${IMG_NAME}"}"
export ZIP_FILENAME="${ZIP_FILENAME:-"${IMG_DATE}-${IMG_NAME}"}"

export SCRIPT_DIR="${BASE_DIR}/scripts"
export WORK_DIR="${WORK_DIR:-"${BASE_DIR}/work/${IMG_DATE}-${IMG_NAME}"}"
export DEPLOY_DIR=${DEPLOY_DIR:-"${BASE_DIR}/deploy"}
export DEPLOY_ZIP="${DEPLOY_ZIP:-1}"
export LOG_FILE="${WORK_DIR}/build.log"

export TARGET_HOSTNAME=${TARGET_HOSTNAME:-raspberrypi}
printf "Re-seeding export directory... "
rm -fr $EXPORT_DIR
mkdir -p $EXPORT_DIR
printf "(OK)\n"

export FIRST_USER_NAME=${FIRST_USER_NAME:-pi}
export FIRST_USER_PASS=${FIRST_USER_PASS:-raspberry}
export RELEASE=${RELEASE:-buster}
export WPA_ESSID
export WPA_PASSWORD
export WPA_COUNTRY
export ENABLE_SSH="${ENABLE_SSH:-0}"
##############################################################

export LOCALE_DEFAULT="${LOCALE_DEFAULT:-en_GB.UTF-8}"
#### Phase 00
#( $TARGET/build_base.sh )

export KEYBOARD_KEYMAP="${KEYBOARD_KEYMAP:-gb}"
export KEYBOARD_LAYOUT="${KEYBOARD_LAYOUT:-English (UK)}"
#### Phase 01
#( $TARGET/build_headless.sh )

export TIMEZONE_DEFAULT="${TIMEZONE_DEFAULT:-Europe/London}"
#### Phase 02
#( $TARGET/build_desktop.sh )

export GIT_HASH=${GIT_HASH:-"$(git rev-parse HEAD)"}
#### Phase 03
if [[ "$PISDR_ARCH" == "arm64" ]]; then
if [[ "$BUILD_BOARD_TEGRA_AGX" == true ]]; then
( $TARGET/build_tegra.sh $HEADLESS_DIR "AGX" )
( $TARGET/build_tegra.sh $DESKTOP_DIR "AGX" )
fi

export CLEAN
export IMG_NAME
export APT_PROXY
if [[ "$BUILD_BOARD_TEGRA_NANO" == true ]]; then
( $TARGET/build_tegra.sh $HEADLESS_DIR "NANO" )
( $TARGET/build_tegra.sh $DESKTOP_DIR "NANO" )
fi

export STAGE
export STAGE_DIR
export STAGE_WORK_DIR
export PREV_STAGE
export PREV_STAGE_DIR
export ROOTFS_DIR
export PREV_ROOTFS_DIR
export IMG_SUFFIX
export NOOBS_NAME
export NOOBS_DESCRIPTION
export EXPORT_DIR
export EXPORT_ROOTFS_DIR

export QUILT_PATCHES
export QUILT_NO_DIFF_INDEX=1
export QUILT_NO_DIFF_TIMESTAMPS=1
export QUILT_REFRESH_ARGS="-p ab"

# shellcheck source=scripts/common
source "${SCRIPT_DIR}/common"
# shellcheck source=scripts/dependencies_check
source "${SCRIPT_DIR}/dependencies_check"

dependencies_check "${BASE_DIR}/depends"

#check username is valid
if [[ ! "$FIRST_USER_NAME" =~ ^[a-z][-a-z0-9_]*$ ]]; then
echo "Invalid FIRST_USER_NAME: $FIRST_USER_NAME"
exit 1
if [[ "$BUILD_BOARD_RPI" == true ]]; then
( $TARGET/build_rpi.sh $HEADLESS_DIR )
( $TARGET/build_rpi.sh $DESKTOP_DIR )
fi
fi

if [[ -n "${APT_PROXY}" ]] && ! curl --silent "${APT_PROXY}" >/dev/null ; then
echo "Could not reach APT_PROXY server: ${APT_PROXY}"
exit 1
if [[ "$PISDR_ARCH" == "amd64" ]]; then
if [[ "$BUILD_BOARD_GRUB" == true ]]; then
( $TARGET/build_grub.sh $HEADLESS_DIR )
( $TARGET/build_grub.sh $DESKTOP_DIR )
fi
fi

if [[ -n "${WPA_PASSWORD}" && ${#WPA_PASSWORD} -lt 8 || ${#WPA_PASSWORD} -gt 63 ]] ; then
echo "WPA_PASSWORD" must be between 8 and 63 characters
exit 1
fi

mkdir -p "${WORK_DIR}"
log "Begin ${BASE_DIR}"

STAGE_LIST=${STAGE_LIST:-${BASE_DIR}/stage*}

for STAGE_DIR in $STAGE_LIST; do
STAGE_DIR=$(realpath "${STAGE_DIR}")
run_stage
done

CLEAN=1
for EXPORT_DIR in ${EXPORT_DIRS}; do
STAGE_DIR=${BASE_DIR}/export-image
# shellcheck source=/dev/null
source "${EXPORT_DIR}/EXPORT_IMAGE"
EXPORT_ROOTFS_DIR=${WORK_DIR}/$(basename "${EXPORT_DIR}")/rootfs
run_stage
if [ "${USE_QEMU}" != "1" ]; then
if [ -e "${EXPORT_DIR}/EXPORT_NOOBS" ]; then
# shellcheck source=/dev/null
source "${EXPORT_DIR}/EXPORT_NOOBS"
STAGE_DIR="${BASE_DIR}/export-noobs"
run_stage
fi
fi
done

if [ -x ${BASE_DIR}/postrun.sh ]; then
log "Begin postrun.sh"
cd "${BASE_DIR}"
./postrun.sh
log "End postrun.sh"
fi

log "End ${BASE_DIR}"

+ 36
- 0
build_base.sh View File

@@ -0,0 +1,36 @@
#!/bin/bash

set -e

printf "Create base rootfs directory... "
mkdir -p $BASE_DIR
printf "(OK)\n"

printf "Enabling qemu kernel components... "
update-binfmts --enable qemu-arm > /dev/null 2>&1
if [ ! "$(ls -A /proc/sys/fs/binfmt_misc/)" ]; then
printf "(NOK)\n"
exit
fi
printf "(OK)\n"

echo "Run debootstrap first stage..."
if [ ! -f "${BASE_DIR}/.bootstrap_completed" ]; then
qemu-debootstrap \
--arch=$PISDR_ARCH \
--variant=minbase \
--no-merged-usr \
--force-check-gpg \
--keyring /usr/share/keyrings/ubuntu-archive-keyring.gpg \
--include=python3,libegl1,python3-apt \
$PISDR_RELEASE \
$BASE_DIR
touch $BASE_DIR/.bootstrap_completed
fi
echo "Run debootstrap first stage... (OK)"

echo "Run base installation..."
cd $TARGET/ansible
export ANSIBLE_ROOTFS_DIR=$BASE_DIR
ansible-playbook -v 00_base.yaml
echo "Run base installation... (OK)"

+ 13
- 0
build_desktop.sh View File

@@ -0,0 +1,13 @@
#!/bin/bash

set -e

printf "Copying base rootfs... "
cp -rp $HEADLESS_DIR/. $DESKTOP_DIR/
printf "(OK)\n"

echo "Run desktop installation tasks..."
pushd $TARGET/ansible > /dev/null
export ANSIBLE_ROOTFS_DIR=$DESKTOP_DIR
ansible-playbook -v 02_desktop.yaml
echo "Run desktop installation tasks... (OK)"

+ 18
- 0
build_grub.sh View File

@@ -0,0 +1,18 @@
#!/bin/bash

set -e

INPUT_DIR="$1"
IMAGE_NAME="$(basename $INPUT_DIR)"
GRUB_DIR="$TARGET$BUILD/grub"

printf "Copying base rootfs... "
rm -fr $GRUB_DIR
cp -rp $INPUT_DIR/. $GRUB_DIR/
printf "(OK)\n"

echo "Run GRUB installation tasks..."
pushd $TARGET/ansible > /dev/null
export ANSIBLE_ROOTFS_DIR=$GRUB_DIR
ansible-playbook -v 03_grub.yaml
echo "Run GRUB installation tasks... (OK)"

+ 13
- 0
build_headless.sh View File

@@ -0,0 +1,13 @@
#!/bin/bash

set -e

printf "Copying base rootfs... "
cp -rp $BASE_DIR/. $HEADLESS_DIR/
printf "(OK)\n"

echo "Run headless installation tasks..."
pushd $TARGET/ansible > /dev/null
export ANSIBLE_ROOTFS_DIR=$HEADLESS_DIR
ansible-playbook -v 01_headless.yaml
echo "Run headless installation tasks... (OK)"

+ 75
- 0
build_tegra.sh View File

@@ -0,0 +1,75 @@
#!/bin/bash

set -e

INPUT_DIR="$1"
TARGET_BOARD="$2"
IMAGE_NAME="$(basename $INPUT_DIR)"
TEGRA_DIR="$TARGET$BUILD/BSP_$TARGET_BOARD"

if [ $TARGET_BOARD == "AGX" ]; then
L4T_ASSET="https://developer.download.nvidia.com/embedded/L4T/r32_Release_v4.4/r32_Release_v4.4-GMC3/T186/Tegra186_Linux_R32.4.4_aarch64.tbz2"
IMG_NAMES=("jetson-xavier-nx-devkit")
IMG_REVS=("default")
elif [ $TARGET_BOARD == "NANO" ]; then
L4T_ASSET="https://developer.download.nvidia.com/embedded/L4T/r32_Release_v4.4/r32_Release_v4.4-GMC3/T210/Tegra210_Linux_R32.4.4_aarch64.tbz2"
IMG_NAMES=("jetson-nano")
IMG_REVS=("200")
fi

printf "Create Tegra directory... "
mkdir -p $TEGRA_DIR
printf "(OK)\n"

echo "Downloading Tegra assets..."
if [ ! "$(ls -A $TEGRA_DIR)" ]; then
wget $L4T_ASSET
tar xpf $(basename $L4T_ASSET) -C $TEGRA_DIR
fi
echo "Downloading Tegra assets... (OK)"

printf "Copying rootfs assets... "
rm -fr $TEGRA_DIR/Linux_for_Tegra/rootfs/*
cp -rp $INPUT_DIR/. $TEGRA_DIR/Linux_for_Tegra/rootfs/
printf "(OK)\n"

printf "Ameliorate Tegra installer... "
rm -fr $TEGRA_DIR/Linux_for_Tegra/tools/python-jetson-gpio_2.0.11_arm64.deb
rm -fr $TEGRA_DIR/Linux_for_Tegra/nv_tegra/l4t_deb_packages/nvidia-l4t-oem-config*.deb
sed -i -e 's/ln -sf nv-oem-config.target default.target//g' \
$TEGRA_DIR/Linux_for_Tegra/nv_tools/scripts/nv_customize_rootfs.sh
sed -i -e 's/dpkg -i/dpkg --force-overwrite -i/g' \
$TEGRA_DIR/Linux_for_Tegra/nv_tegra/nv-apply-debs.sh
tar -jxvf $TEGRA_DIR/Linux_for_Tegra/nv_tegra/config.tbz2 \
usr/lib/nvidia/resizefs/nvresizefs.sh \
--one-top-level=$TEGRA_DIR/Linux_for_Tegra/rootfs/
printf "(OK)\n"

echo "Run pre application tasks..."
pushd $TARGET/ansible > /dev/null
export ANSIBLE_ROOTFS_DIR=$TEGRA_DIR/Linux_for_Tegra/rootfs
ansible-playbook -v 03_tegra.yaml --tags "pre"
echo "Run pre application tasks... (OK)"

echo "Applying Tegra binaries..."
pushd $TEGRA_DIR/Linux_for_Tegra/ > /dev/null
./apply_binaries.sh
echo "Applying Tegra binaries... (OK)"

echo "Run post application tasks..."
pushd $TARGET/ansible > /dev/null
export ANSIBLE_ROOTFS_DIR=$TEGRA_DIR/Linux_for_Tegra/rootfs
ansible-playbook -v 03_tegra.yaml --tags "post"
echo "Run post application tasks... (OK)"

for i in ${!IMG_NAMES[@]};
do
BOARD=${IMG_NAMES[$i]}
REV=${IMG_REVS[$i]}

echo "Creating $BOARD image..."
pushd $TEGRA_DIR/Linux_for_Tegra/ > /dev/null
sudo ./tools/jetson-disk-image-creator.sh -o export.img -b $BOARD -r $REV
mv $TEGRA_DIR/Linux_for_Tegra/export.img "${EXPORT_DIR}/${PISDR_IMG_NAME}-${IMAGE_NAME}-${BOARD}-${REV}.img" > /dev/null
echo "Creating $BOARD image... (OK)"
done

+ 0
- 19
depends View File

@@ -1,19 +0,0 @@
quilt
parted
realpath:coreutils
qemu-arm-static:qemu-user-static
debootstrap
zerofree
zip
mkdosfs:dosfstools
capsh:libcap2-bin
bsdtar
grep
rsync
xz:xz-utils
curl
xxd
file
git
lsmod:kmod
bc

+ 0
- 10
docker-compose.yml View File

@@ -1,10 +0,0 @@
version: '2'

services:
apt-cacher-ng:
restart: unless-stopped
image: sameersbn/apt-cacher-ng:latest
ports:
- "3142:3142"
volumes:
- ./apt-cacher-ng:/var/cache/apt-cacher-ng

+ 0
- 9
export-image/00-allow-rerun/00-run.sh View File

@@ -1,9 +0,0 @@
#!/bin/bash -e

if [ ! -x "${ROOTFS_DIR}/usr/bin/qemu-arm-static" ]; then
cp /usr/bin/qemu-arm-static "${ROOTFS_DIR}/usr/bin/"
fi

if [ -e "${ROOTFS_DIR}/etc/ld.so.preload" ]; then
mv "${ROOTFS_DIR}/etc/ld.so.preload" "${ROOTFS_DIR}/etc/ld.so.preload.disabled"
fi

+ 0
- 7
export-image/01-set-sources/01-run.sh View File

@@ -1,7 +0,0 @@
#!/bin/bash -e

on_chroot << EOF
apt-get update
apt-get -y dist-upgrade
apt-get clean
EOF

+ 0
- 3
export-image/02-network/01-run.sh View File

@@ -1,3 +0,0 @@
#!/bin/bash -e

install -m 644 files/resolv.conf "${ROOTFS_DIR}/etc/"

+ 0
- 1
export-image/02-network/files/resolv.conf View File

@@ -1 +0,0 @@
nameserver 8.8.8.8

+ 0
- 13
export-image/03-set-partuuid/00-run.sh View File

@@ -1,13 +0,0 @@
#!/bin/bash -e

IMG_FILE="${STAGE_WORK_DIR}/${IMG_FILENAME}${IMG_SUFFIX}.img"

IMGID="$(dd if="${IMG_FILE}" skip=440 bs=1 count=4 2>/dev/null | xxd -e | cut -f 2 -d' ')"

BOOT_PARTUUID="${IMGID}-01"
ROOT_PARTUUID="${IMGID}-02"

sed -i "s/BOOTDEV/PARTUUID=${BOOT_PARTUUID}/" "${ROOTFS_DIR}/etc/fstab"
sed -i "s/ROOTDEV/PARTUUID=${ROOT_PARTUUID}/" "${ROOTFS_DIR}/etc/fstab"

sed -i "s/ROOTDEV/PARTUUID=${ROOT_PARTUUID}/" "${ROOTFS_DIR}/boot/cmdline.txt"

+ 0
- 101
export-image/04-finalise/01-run.sh View File

@@ -1,101 +0,0 @@
#!/bin/bash -e

IMG_FILE="${STAGE_WORK_DIR}/${IMG_FILENAME}${IMG_SUFFIX}.img"
INFO_FILE="${STAGE_WORK_DIR}/${IMG_FILENAME}${IMG_SUFFIX}.info"

on_chroot << EOF
if [ -x /etc/init.d/fake-hwclock ]; then
/etc/init.d/fake-hwclock stop
fi
if hash hardlink 2>/dev/null; then
hardlink -t /usr/share/doc
fi
EOF

if [ -d "${ROOTFS_DIR}/home/${FIRST_USER_NAME}/.config" ]; then
chmod 700 "${ROOTFS_DIR}/home/${FIRST_USER_NAME}/.config"
fi

rm -f "${ROOTFS_DIR}/etc/apt/apt.conf.d/51cache"
rm -f "${ROOTFS_DIR}/usr/bin/qemu-arm-static"

if [ "${USE_QEMU}" != "1" ]; then
if [ -e "${ROOTFS_DIR}/etc/ld.so.preload.disabled" ]; then
mv "${ROOTFS_DIR}/etc/ld.so.preload.disabled" "${ROOTFS_DIR}/etc/ld.so.preload"
fi
fi

rm -f "${ROOTFS_DIR}/etc/network/interfaces.dpkg-old"

rm -f "${ROOTFS_DIR}/etc/apt/sources.list~"
rm -f "${ROOTFS_DIR}/etc/apt/trusted.gpg~"

rm -f "${ROOTFS_DIR}/etc/passwd-"
rm -f "${ROOTFS_DIR}/etc/group-"
rm -f "${ROOTFS_DIR}/etc/shadow-"
rm -f "${ROOTFS_DIR}/etc/gshadow-"
rm -f "${ROOTFS_DIR}/etc/subuid-"
rm -f "${ROOTFS_DIR}/etc/subgid-"

rm -f "${ROOTFS_DIR}"/var/cache/debconf/*-old
rm -f "${ROOTFS_DIR}"/var/lib/dpkg/*-old

rm -f "${ROOTFS_DIR}"/usr/share/icons/*/icon-theme.cache

rm -f "${ROOTFS_DIR}/var/lib/dbus/machine-id"

true > "${ROOTFS_DIR}/etc/machine-id"

ln -nsf /proc/mounts "${ROOTFS_DIR}/etc/mtab"

find "${ROOTFS_DIR}/var/log/" -type f -exec cp /dev/null {} \;

rm -f "${ROOTFS_DIR}/root/.vnc/private.key"
rm -f "${ROOTFS_DIR}/etc/vnc/updateid"

update_issue "$(basename "${EXPORT_DIR}")"
install -m 644 "${ROOTFS_DIR}/etc/rpi-issue" "${ROOTFS_DIR}/boot/issue.txt"

cp "$ROOTFS_DIR/etc/rpi-issue" "$INFO_FILE"


{
if [ -f "$ROOTFS_DIR/usr/share/doc/raspberrypi-kernel/changelog.Debian.gz" ]; then
firmware=$(zgrep "firmware as of" \
"$ROOTFS_DIR/usr/share/doc/raspberrypi-kernel/changelog.Debian.gz" | \
head -n1 | sed -n 's|.* \([^ ]*\)$|\1|p')
printf "\nFirmware: https://github.com/raspberrypi/firmware/tree/%s\n" "$firmware"

kernel="$(curl -s -L "https://github.com/raspberrypi/firmware/raw/$firmware/extra/git_hash")"
printf "Kernel: https://github.com/raspberrypi/linux/tree/%s\n" "$kernel"

uname="$(curl -s -L "https://github.com/raspberrypi/firmware/raw/$firmware/extra/uname_string7")"
printf "Uname string: %s\n" "$uname"
fi

printf "\nPackages:\n"
dpkg -l --root "$ROOTFS_DIR"
} >> "$INFO_FILE"

ROOT_DEV="$(mount | grep "${ROOTFS_DIR} " | cut -f1 -d' ')"

unmount "${ROOTFS_DIR}"
zerofree "${ROOT_DEV}"

unmount_image "${IMG_FILE}"

mkdir -p "${DEPLOY_DIR}"

rm -f "${DEPLOY_DIR}/${ZIP_FILENAME}${IMG_SUFFIX}.img.xz"
rm -f "${DEPLOY_DIR}/${IMG_FILENAME}${IMG_SUFFIX}.img"

if [ "${DEPLOY_ZIP}" == "1" ]; then
pushd "${STAGE_WORK_DIR}" > /dev/null
xz -c "$(basename "${IMG_FILE}")" > "${DEPLOY_DIR}/${ZIP_FILENAME}${IMG_SUFFIX}.img.xz"
popd > /dev/null
rm -f "${DEPLOY_DIR}/${IMG_FILENAME}${IMG_SUFFIX}.img"
else
cp "$IMG_FILE" "$DEPLOY_DIR"
fi

cp "$INFO_FILE" "$DEPLOY_DIR"

+ 0
- 61
export-image/prerun.sh View File

@@ -1,61 +0,0 @@
#!/bin/bash -e

IMG_FILE="${STAGE_WORK_DIR}/${IMG_FILENAME}${IMG_SUFFIX}.img"

unmount_image "${IMG_FILE}"

rm -f "${IMG_FILE}"

rm -rf "${ROOTFS_DIR}"
mkdir -p "${ROOTFS_DIR}"

BOOT_SIZE="$((256 * 1024 * 1024))"
ROOT_SIZE=$(du --apparent-size -s "${EXPORT_ROOTFS_DIR}" --exclude var/cache/apt/archives --exclude boot --block-size=1 | cut -f 1)

# All partition sizes and starts will be aligned to this size
ALIGN="$((4 * 1024 * 1024))"
# Add this much space to the calculated file size. This allows for
# some overhead (since actual space usage is usually rounded up to the
# filesystem block size) and gives some free space on the resulting
# image.
ROOT_MARGIN="$(echo "($ROOT_SIZE * 0.2 + 200 * 1024 * 1024) / 1" | bc)"

BOOT_PART_START=$((ALIGN))
BOOT_PART_SIZE=$(((BOOT_SIZE + ALIGN - 1) / ALIGN * ALIGN))
ROOT_PART_START=$((BOOT_PART_START + BOOT_PART_SIZE))
ROOT_PART_SIZE=$(((ROOT_SIZE + ROOT_MARGIN + ALIGN - 1) / ALIGN * ALIGN))
IMG_SIZE=$((BOOT_PART_START + BOOT_PART_SIZE + ROOT_PART_SIZE))

truncate -s "${IMG_SIZE}" "${IMG_FILE}"

parted --script "${IMG_FILE}" mklabel msdos
parted --script "${IMG_FILE}" unit B mkpart primary fat32 "${BOOT_PART_START}" "$((BOOT_PART_START + BOOT_PART_SIZE - 1))"
parted --script "${IMG_FILE}" unit B mkpart primary ext4 "${ROOT_PART_START}" "$((ROOT_PART_START + ROOT_PART_SIZE - 1))"

PARTED_OUT=$(parted -sm "${IMG_FILE}" unit b print)
BOOT_OFFSET=$(echo "$PARTED_OUT" | grep -e '^1:' | cut -d':' -f 2 | tr -d B)
BOOT_LENGTH=$(echo "$PARTED_OUT" | grep -e '^1:' | cut -d':' -f 4 | tr -d B)

ROOT_OFFSET=$(echo "$PARTED_OUT" | grep -e '^2:' | cut -d':' -f 2 | tr -d B)
ROOT_LENGTH=$(echo "$PARTED_OUT" | grep -e '^2:' | cut -d':' -f 4 | tr -d B)

BOOT_DEV=$(losetup --show -f -o "${BOOT_OFFSET}" --sizelimit "${BOOT_LENGTH}" "${IMG_FILE}")
ROOT_DEV=$(losetup --show -f -o "${ROOT_OFFSET}" --sizelimit "${ROOT_LENGTH}" "${IMG_FILE}")
echo "/boot: offset $BOOT_OFFSET, length $BOOT_LENGTH"
echo "/: offset $ROOT_OFFSET, length $ROOT_LENGTH"

ROOT_FEATURES="^huge_file"
for FEATURE in metadata_csum 64bit; do
if grep -q "$FEATURE" /etc/mke2fs.conf; then
ROOT_FEATURES="^$FEATURE,$ROOT_FEATURES"
fi
done
mkdosfs -n boot -F 32 -v "$BOOT_DEV" > /dev/null
mkfs.ext4 -L rootfs -O "$ROOT_FEATURES" "$ROOT_DEV" > /dev/null

mount -v "$ROOT_DEV" "${ROOTFS_DIR}" -t ext4
mkdir -p "${ROOTFS_DIR}/boot"
mount -v "$BOOT_DEV" "${ROOTFS_DIR}/boot" -t vfat

rsync -aHAXx --exclude /var/cache/apt/archives --exclude /boot "${EXPORT_ROOTFS_DIR}/" "${ROOTFS_DIR}/"
rsync -rtx "${EXPORT_ROOTFS_DIR}/boot/" "${ROOTFS_DIR}/boot/"

+ 0
- 100
scripts/common View File

@@ -1,100 +0,0 @@
log (){
date +"[%T] $*" | tee -a "${LOG_FILE}"
}
export -f log

bootstrap(){
local BOOTSTRAP_CMD=debootstrap
local BOOTSTRAP_ARGS=()

export http_proxy=${APT_PROXY}

if [ "$(dpkg --print-architecture)" != "armhf" ] && [ "$(dpkg --print-architecture)" != "aarch64" ]; then
BOOTSTRAP_CMD=qemu-debootstrap
fi

BOOTSTRAP_ARGS+=(--arch armhf)
BOOTSTRAP_ARGS+=(--components "main,contrib,non-free")
BOOTSTRAP_ARGS+=(--keyring "${STAGE_DIR}/files/raspberrypi.gpg")
BOOTSTRAP_ARGS+=("$@")
printf -v BOOTSTRAP_STR '%q ' "${BOOTSTRAP_ARGS[@]}"

setarch linux32 capsh --drop=cap_setfcap -- -c "'${BOOTSTRAP_CMD}' $BOOTSTRAP_STR" || true

if [ -d "$2/debootstrap" ]; then
rmdir "$2/debootstrap"
fi
}
export -f bootstrap

copy_previous(){
if [ ! -d "${PREV_ROOTFS_DIR}" ]; then
echo "Previous stage rootfs not found"
false
fi
mkdir -p "${ROOTFS_DIR}"
rsync -aHAXx --exclude var/cache/apt/archives "${PREV_ROOTFS_DIR}/" "${ROOTFS_DIR}/"
}
export -f copy_previous

unmount(){
if [ -z "$1" ]; then
DIR=$PWD
else
DIR=$1
fi

while mount | grep -q "$DIR"; do
local LOCS
LOCS=$(mount | grep "$DIR" | cut -f 3 -d ' ' | sort -r)
for loc in $LOCS; do
umount "$loc"
done
done
}
export -f unmount

unmount_image(){
sync
sleep 1
local LOOP_DEVICES
LOOP_DEVICES=$(losetup --list | grep "$(basename "${1}")" | cut -f1 -d' ')
for LOOP_DEV in ${LOOP_DEVICES}; do
if [ -n "${LOOP_DEV}" ]; then
local MOUNTED_DIR
MOUNTED_DIR=$(mount | grep "$(basename "${LOOP_DEV}")" | head -n 1 | cut -f 3 -d ' ')
if [ -n "${MOUNTED_DIR}" ] && [ "${MOUNTED_DIR}" != "/" ]; then
unmount "$(dirname "${MOUNTED_DIR}")"
fi
sleep 1
losetup -d "${LOOP_DEV}"
fi
done
}
export -f unmount_image

on_chroot() {
if ! mount | grep -q "$(realpath "${ROOTFS_DIR}"/proc)"; then
mount -t proc proc "${ROOTFS_DIR}/proc"
fi

if ! mount | grep -q "$(realpath "${ROOTFS_DIR}"/dev)"; then
mount --bind /dev "${ROOTFS_DIR}/dev"
fi
if ! mount | grep -q "$(realpath "${ROOTFS_DIR}"/dev/pts)"; then
mount --bind /dev/pts "${ROOTFS_DIR}/dev/pts"
fi

if ! mount | grep -q "$(realpath "${ROOTFS_DIR}"/sys)"; then
mount --bind /sys "${ROOTFS_DIR}/sys"
fi

setarch linux32 capsh --drop=cap_setfcap "--chroot=${ROOTFS_DIR}/" -- -e "$@"
}
export -f on_chroot

update_issue() {
echo -e "Raspberry Pi reference ${IMG_DATE}\nGenerated using ${PI_GEN}, ${PI_GEN_REPO}, ${GIT_HASH}, ${1}" > "${ROOTFS_DIR}/etc/rpi-issue"
}
export -f update_issue

+ 0
- 38
scripts/dependencies_check View File

@@ -1,38 +0,0 @@
# dependencies_check
# $@ Dependency files to check
#
# Each dependency is in the form of a tool to test for, optionally followed by
# a : and the name of a package if the package on a Debian-ish system is not
# named for the tool (i.e., qemu-user-static).
dependencies_check()
{
local depfile deps missing

for depfile in "$@"; do
if [[ -e "$depfile" ]]; then
deps="$(sed -f "${SCRIPT_DIR}/remove-comments.sed" < "${BASE_DIR}/depends")"

fi
for dep in $deps; do
if ! hash "${dep%:*}" 2>/dev/null; then
missing="${missing:+$missing }${dep#*:}"
fi
done
done

if [[ "$missing" ]]; then
echo "Required dependencies not installed"
echo
echo "This can be resolved on Debian/Raspbian systems by installing:"
echo "$missing"
false
fi


if ! grep -q "/proc/sys/fs/binfmt_misc" /proc/mounts; then
echo "Module binfmt_misc not loaded in host"
echo "Please run:"
echo " sudo modprobe binfmt_misc"
exit 1
fi
}

+ 0
- 11
scripts/remove-comments.sed View File

@@ -1,11 +0,0 @@
# Deletes comments and collapses whitespace in ##-packages files

# Append (N)ext line to buffer
# if (!)not ($)buffer is EOF, (b)ranch to (:)label loop
:loop
N
$ !b loop

# Buffer is "line1\nline2\n...lineN", del comments and collapse whitespace
s/#[^\n]*//g
s/[[:space:]]\{1,\}/ /g

+ 0
- 19
stage0/00-configure-apt/00-run.sh View File

@@ -1,19 +0,0 @@
#!/bin/bash -e

install -m 644 files/sources.list "${ROOTFS_DIR}/etc/apt/"
install -m 644 files/raspi.list "${ROOTFS_DIR}/etc/apt/sources.list.d/"
sed -i "s/RELEASE/${RELEASE}/g" "${ROOTFS_DIR}/etc/apt/sources.list"
sed -i "s/RELEASE/${RELEASE}/g" "${ROOTFS_DIR}/etc/apt/sources.list.d/raspi.list"

if [ -n "$APT_PROXY" ]; then
install -m 644 files/51cache "${ROOTFS_DIR}/etc/apt/apt.conf.d/51cache"
sed "${ROOTFS_DIR}/etc/apt/apt.conf.d/51cache" -i -e "s|APT_PROXY|${APT_PROXY}|"
else
rm -f "${ROOTFS_DIR}/etc/apt/apt.conf.d/51cache"
fi

on_chroot apt-key add - < files/raspberrypi.gpg.key
on_chroot << EOF
apt-get update
apt-get dist-upgrade -y
EOF

+ 0
- 1
stage0/00-configure-apt/files/51cache View File

@@ -1 +0,0 @@
Acquire::http { Proxy "APT_PROXY"; };

+ 0
- 30
stage0/00-configure-apt/files/raspberrypi.gpg.key View File

@@ -1,30 +0,0 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.12 (GNU/Linux)

mQENBE/d7o8BCACrwqQacGJfn3tnMzGui6mv2lLxYbsOuy/+U4rqMmGEuo3h9m92
30E2EtypsoWczkBretzLUCFv+VUOxaA6sV9+puTqYGhhQZFuKUWcG7orf7QbZRuu
TxsEUepW5lg7MExmAu1JJzqM0kMQX8fVyWVDkjchZ/is4q3BPOUCJbUJOsE+kK/6
8kW6nWdhwSAjfDh06bA5wvoXNjYoDdnSZyVdcYCPEJXEg5jfF/+nmiFKMZBraHwn
eQsepr7rBXxNcEvDlSOPal11fg90KXpy7Umre1UcAZYJdQeWcHu7X5uoJx/MG5J8
ic6CwYmDaShIFa92f8qmFcna05+lppk76fsnABEBAAG0IFJhc3BiZXJyeSBQaSBB
cmNoaXZlIFNpZ25pbmcgS2V5iQE4BBMBAgAiBQJP3e6PAhsDBgsJCAcDAgYVCAIJ
CgsEFgIDAQIeAQIXgAAKCRCCsSmSf6MwPk6vB/9pePB3IukU9WC9Bammh3mpQTvL
OifbkzHkmAYxzjfK6D2I8pT0xMxy949+ThzJ7uL60p6T/32ED9DR3LHIMXZvKtuc
mQnSiNDX03E2p7lIP/htoxW2hDP2n8cdlNdt0M9IjaWBppsbO7IrDppG2B1aRLni
uD7v8bHRL2mKTtIDLX42Enl8aLAkJYgNWpZyPkDyOqamjijarIWjGEPCkaURF7g4
d44HvYhpbLMOrz1m6N5Bzoa5+nq3lmifeiWKxioFXU+Hy5bhtAM6ljVb59hbD2ra
X4+3LXC9oox2flmQnyqwoyfZqVgSQa0B41qEQo8t1bz6Q1Ti7fbMLThmbRHiuQEN
BE/d7o8BCADNlVtBZU63fm79SjHh5AEKFs0C3kwa0mOhp9oas/haDggmhiXdzeD3
49JWz9ZTx+vlTq0s+I+nIR1a+q+GL+hxYt4HhxoA6vlDMegVfvZKzqTX9Nr2VqQa
S4Kz3W5ULv81tw3WowK6i0L7pqDmvDqgm73mMbbxfHD0SyTt8+fk7qX6Ag2pZ4a9
ZdJGxvASkh0McGpbYJhk1WYD+eh4fqH3IaeJi6xtNoRdc5YXuzILnp+KaJyPE5CR
qUY5JibOD3qR7zDjP0ueP93jLqmoKltCdN5+yYEExtSwz5lXniiYOJp8LWFCgv5h
m8aYXkcJS1xVV9Ltno23YvX5edw9QY4hABEBAAGJAR8EGAECAAkFAk/d7o8CGwwA
CgkQgrEpkn+jMD5Figf/dIC1qtDMTbu5IsI5uZPX63xydaExQNYf98cq5H2fWF6O
yVR7ERzA2w33hI0yZQrqO6pU9SRnHRxCFvGv6y+mXXXMRcmjZG7GiD6tQWeN/3wb
EbAn5cg6CJ/Lk/BI4iRRfBX07LbYULCohlGkwBOkRo10T+Ld4vCCnBftCh5x2OtZ
TOWRULxP36y2PLGVNF+q9pho98qx+RIxvpofQM/842ZycjPJvzgVQsW4LT91KYAE
4TVf6JjwUM6HZDoiNcX6d7zOhNfQihXTsniZZ6rky287htsWVDNkqOi5T3oTxWUo
m++/7s3K3L0zWopdhMVcgg6Nt9gcjzqN1c0gy55L/g==
=mNSj
-----END PGP PUBLIC KEY BLOCK-----

+ 0
- 3
stage0/00-configure-apt/files/raspi.list View File

@@ -1,3 +0,0 @@
deb http://archive.raspberrypi.org/debian/ RELEASE main
# Uncomment line below then 'apt-get update' to enable 'apt-get source'
#deb-src http://archive.raspberrypi.org/debian/ RELEASE main

+ 0
- 3
stage0/00-configure-apt/files/sources.list View File

@@ -1,3 +0,0 @@
deb http://raspbian.raspberrypi.org/raspbian/ RELEASE main contrib non-free rpi
# Uncomment line below then 'apt-get update' to enable 'apt-get source'
#deb-src http://raspbian.raspberrypi.org/raspbian/ RELEASE main contrib non-free rpi

+ 0
- 6
stage0/01-locale/00-debconf
File diff suppressed because it is too large
View File


+ 0
- 1
stage0/01-locale/00-packages View File

@@ -1 +0,0 @@
locales

+ 0
- 2
stage0/02-firmware/01-packages View File

@@ -1,2 +0,0 @@
raspberrypi-bootloader
raspberrypi-kernel

BIN
stage0/files/raspberrypi.gpg View File


+ 0
- 5
stage0/prerun.sh View File

@@ -1,5 +0,0 @@
#!/bin/bash -e

if [ ! -d "${ROOTFS_DIR}" ]; then
bootstrap ${RELEASE} "${ROOTFS_DIR}" http://raspbian.raspberrypi.org/raspbian/
fi

+ 0
- 4
stage1/00-boot-files/00-run.sh View File

@@ -1,4 +0,0 @@
#!/bin/bash -e

install -m 644 files/cmdline.txt "${ROOTFS_DIR}/boot/"
install -m 644 files/config.txt "${ROOTFS_DIR}/boot/"

+ 0
- 1
stage1/00-boot-files/files/cmdline.txt View File

@@ -1 +0,0 @@
console=serial0,115200 console=tty1 root=ROOTDEV rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait

+ 0
- 65
stage1/00-boot-files/files/config.txt View File

@@ -1,65 +0,0 @@
# For more options and information see
# http://rpf.io/configtxt
# Some settings may impact device functionality. See link above for details

# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1

# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan
#disable_overscan=1

# uncomment the following to adjust overscan. Use positive numbers if console
# goes off screen, and negative if there is too much border
#overscan_left=16
#overscan_right=16
#overscan_top=16
#overscan_bottom=16

# uncomment to force a console size. By default it will be display's size minus
# overscan.
#framebuffer_width=1920
#framebuffer_height=1080

# uncomment if hdmi display is not detected and composite is being output
#hdmi_force_hotplug=1

# uncomment to force a specific HDMI mode (this will force VGA)
#hdmi_group=1
#hdmi_mode=1

# uncomment to force a HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes
#hdmi_drive=2

# uncomment to increase signal to HDMI, if you have interference, blanking, or
# no display
#config_hdmi_boost=4

# uncomment for composite PAL
#sdtv_mode=2

#uncomment to overclock the arm. 700 MHz is the default.
#arm_freq=800

# Uncomment some or all of these to enable the optional hardware interfaces
#dtparam=i2c_arm=on
#dtparam=i2s=on
#dtparam=spi=on

# Uncomment this to enable infrared communication.
#dtoverlay=gpio-ir,gpio_pin=17
#dtoverlay=gpio-ir-tx,gpio_pin=18

# Additional overlays and parameters are documented /boot/overlays/README

# Enable audio (loads snd_bcm2835)
dtparam=audio=on

[pi4]
# Enable DRM VC4 V3D driver on top of the dispmanx display stack
dtoverlay=vc4-fkms-v3d
max_framebuffers=2

[all]
#dtoverlay=vc4-fkms-v3d

+ 0
- 33
stage1/01-sys-tweaks/00-patches/01-bashrc.diff View File

@@ -1,33 +0,0 @@
--- a/rootfs/etc/skel/.bashrc
+++ b/rootfs/etc/skel/.bashrc
@@ -43,7 +43,7 @@
# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
-#force_color_prompt=yes
+force_color_prompt=yes
if [ -n "$force_color_prompt" ]; then
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
@@ -57,7 +57,7 @@
fi
if [ "$color_prompt" = yes ]; then
- PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
+ PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w \$\[\033[00m\] '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
@@ -79,9 +79,9 @@
#alias dir='dir --color=auto'
#alias vdir='vdir --color=auto'
- #alias grep='grep --color=auto'
- #alias fgrep='fgrep --color=auto'
- #alias egrep='egrep --color=auto'
+ alias grep='grep --color=auto'
+ alias fgrep='fgrep --color=auto'
+ alias egrep='egrep --color=auto'
fi
# colored GCC warnings and errors

+ 0
- 1
stage1/01-sys-tweaks/00-patches/series View File

@@ -1 +0,0 @@
01-bashrc.diff

+ 0
- 15
stage1/01-sys-tweaks/00-run.sh View File

@@ -1,15 +0,0 @@
#!/bin/bash -e

install -d "${ROOTFS_DIR}/etc/systemd/system/getty@tty1.service.d"
install -m 644 files/noclear.conf "${ROOTFS_DIR}/etc/systemd/system/getty@tty1.service.d/noclear.conf"
install -v -m 644 files/fstab "${ROOTFS_DIR}/etc/fstab"

on_chroot << EOF
if ! id -u ${FIRST_USER_NAME} >/dev/null 2>&1; then
adduser --disabled-password --gecos "" ${FIRST_USER_NAME}
fi
echo "${FIRST_USER_NAME}:${FIRST_USER_PASS}" | chpasswd
echo "root:root" | chpasswd
EOF



+ 0
- 3
stage1/01-sys-tweaks/files/fstab View File

@@ -1,3 +0,0 @@
proc /proc proc defaults 0 0
BOOTDEV /boot vfat defaults 0 2
ROOTDEV / ext4 defaults,noatime 0 1

+ 0
- 2
stage1/01-sys-tweaks/files/noclear.conf View File

@@ -1,2 +0,0 @@
[Service]
TTYVTDisallocate=no

+ 0
- 1
stage1/02-net-tweaks/00-packages View File

@@ -1 +0,0 @@
netbase

+ 0
- 6
stage1/02-net-tweaks/00-run.sh View File

@@ -1,6 +0,0 @@
#!/bin/bash -e

echo "${TARGET_HOSTNAME}" > "${ROOTFS_DIR}/etc/hostname"
echo "127.0.1.1 ${TARGET_HOSTNAME}" >> "${ROOTFS_DIR}/etc/hosts"

ln -sf /dev/null "${ROOTFS_DIR}/etc/systemd/network/99-default.link"

+ 0
- 1
stage1/03-install-packages/00-packages View File

@@ -1 +0,0 @@
libraspberrypi-bin libraspberrypi0 raspi-config

+ 0
- 5
stage1/prerun.sh View File

@@ -1,5 +0,0 @@
#!/bin/bash -e

if [ ! -d "${ROOTFS_DIR}" ]; then
copy_previous
fi

+ 0
- 1
stage2/00-copies-and-fills/01-packages View File

@@ -1 +0,0 @@
raspi-copies-and-fills

+ 0
- 6
stage2/00-copies-and-fills/02-run.sh View File

@@ -1,6 +0,0 @@
#!/bin/bash -e

if [ -f "${ROOTFS_DIR}/etc/ld.so.preload" ]; then
mv "${ROOTFS_DIR}/etc/ld.so.preload" "${ROOTFS_DIR}/etc/ld.so.preload.disabled"
fi


+ 0
- 26
stage2/01-sys-tweaks/00-debconf
File diff suppressed because it is too large
View File


+ 0
- 31
stage2/01-sys-tweaks/00-packages View File

@@ -1,31 +0,0 @@
ssh less fbset sudo psmisc strace ed ncdu crda
console-setup keyboard-configuration debconf-utils parted unzip
build-essential manpages-dev python bash-completion gdb pkg-config
python-rpi.gpio v4l-utils
avahi-daemon
lua5.1
luajit
hardlink ca-certificates curl
fake-hwclock nfs-common usbutils
libraspberrypi-dev libraspberrypi-doc libfreetype6-dev
dosfstools
dphys-swapfile
raspberrypi-sys-mods
pi-bluetooth
apt-listchanges
usb-modeswitch
libpam-chksshpwd
rpi-update
libmtp-runtime
rsync
htop
man-db
policykit-1
ssh-import-id
rng-tools
ethtool
vl805fw
ntfs-3g
pciutils
rpi-eeprom
raspinfo

+ 0
- 1
stage2/01-sys-tweaks/00-packages-nr View File

@@ -1 +0,0 @@
cifs-utils

+ 0
- 22
stage2/01-sys-tweaks/00-patches/01-useradd.diff View File

@@ -1,22 +0,0 @@
Index: jessie-stage2/rootfs/etc/default/useradd
===================================================================
--- jessie-stage2.orig/rootfs/etc/default/useradd
+++ jessie-stage2/rootfs/etc/default/useradd
@@ -5,7 +5,7 @@
# Similar to DHSELL in adduser. However, we use "sh" here because
# useradd is a low level utility and should be as general
# as possible
-SHELL=/bin/sh
+SHELL=/bin/bash
#
# The default group for users
# 100=users on Debian systems
@@ -29,7 +29,7 @@ SHELL=/bin/sh
# The SKEL variable specifies the directory containing "skeletal" user
# files; in other words, files such as a sample .profile that will be
# copied to the new user's home directory when it is created.
-# SKEL=/etc/skel
+SKEL=/etc/skel
#
# Defines whether the mail spool should be created while
# creating the account

+ 0
- 13
stage2/01-sys-tweaks/00-patches/02-swap.diff View File

@@ -1,13 +0,0 @@
Index: jessie-stage2/rootfs/etc/dphys-swapfile
===================================================================
--- jessie-stage2.orig/rootfs/etc/dphys-swapfile
+++ jessie-stage2/rootfs/etc/dphys-swapfile
@@ -13,7 +13,7 @@
# set size to absolute value, leaving empty (default) then uses computed value
# you most likely don't want this, unless you have an special disk situation
-#CONF_SWAPSIZE=
+CONF_SWAPSIZE=100
# set size to computed value, this times RAM size, dynamically adapts,
# guarantees that there is enough swap without wasting disk space on excess

+ 0
- 12
stage2/01-sys-tweaks/00-patches/04-inputrc.diff View File

@@ -1,12 +0,0 @@
Index: jessie-stage2/rootfs/etc/inputrc
===================================================================
--- jessie-stage2.orig/rootfs/etc/inputrc
+++ jessie-stage2/rootfs/etc/inputrc
@@ -65,3 +65,7 @@ $endif
# "\e[F": end-of-line
$endif
+
+# mappings for up and down arrows search history
+# "\e[B": history-search-forward
+# "\e[A": history-search-backward

+ 0
- 26
stage2/01-sys-tweaks/00-patches/05-path.diff View File

@@ -1,26 +0,0 @@
Index: jessie-stage2/rootfs/etc/login.defs
===================================================================
--- jessie-stage2.orig/rootfs/etc/login.defs
+++ jessie-stage2/rootfs/etc/login.defs
@@ -100,7 +100,7 @@ HUSHLOGIN_FILE .hushlogin
#
# (they are minimal, add the rest in the shell startup files)
ENV_SUPATH PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
-ENV_PATH PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
+ENV_PATH PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games
#
# Terminal permissions
Index: jessie-stage2/rootfs/etc/profile
===================================================================
--- jessie-stage2.orig/rootfs/etc/profile
+++ jessie-stage2/rootfs/etc/profile
@@ -4,7 +4,7 @@
if [ "`id -u`" -eq 0 ]; then
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
else
- PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"
+ PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games"
fi
export PATH

+ 0
- 5
stage2/01-sys-tweaks/00-patches/07-resize-init.diff View File

@@ -1,5 +0,0 @@
--- stage2.orig/rootfs/boot/cmdline.txt
+++ stage2/rootfs/boot/cmdline.txt
@@ -1 +1 @@
-console=serial0,115200 console=tty1 root=ROOTDEV rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
+console=serial0,115200 console=tty1 root=ROOTDEV rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet init=/usr/lib/raspi-config/init_resize.sh

+ 0
- 5
stage2/01-sys-tweaks/00-patches/series View File

@@ -1,5 +0,0 @@
01-useradd.diff
02-swap.diff
04-inputrc.diff
05-path.diff
07-resize-init.diff

+ 0
- 56
stage2/01-sys-tweaks/01-run.sh View File

@@ -1,56 +0,0 @@
#!/bin/bash -e

install -m 755 files/resize2fs_once "${ROOTFS_DIR}/etc/init.d/"

install -d "${ROOTFS_DIR}/etc/systemd/system/rc-local.service.d"
install -m 644 files/ttyoutput.conf "${ROOTFS_DIR}/etc/systemd/system/rc-local.service.d/"

install -m 644 files/50raspi "${ROOTFS_DIR}/etc/apt/apt.conf.d/"

install -m 644 files/console-setup "${ROOTFS_DIR}/etc/default/"

install -m 755 files/rc.local "${ROOTFS_DIR}/etc/"

on_chroot << EOF
systemctl disable hwclock.sh
systemctl disable nfs-common
systemctl disable rpcbind
if [ "${ENABLE_SSH}" == "1" ]; then
systemctl enable ssh
else
systemctl disable ssh
fi
systemctl enable regenerate_ssh_host_keys
EOF

if [ "${USE_QEMU}" = "1" ]; then
echo "enter QEMU mode"
install -m 644 files/90-qemu.rules "${ROOTFS_DIR}/etc/udev/rules.d/"
on_chroot << EOF
systemctl disable resize2fs_once
EOF
echo "leaving QEMU mode"
else
on_chroot << EOF
systemctl enable resize2fs_once
EOF
fi

on_chroot <<EOF
for GRP in input spi i2c gpio; do
groupadd -f -r "\$GRP"
done
for GRP in adm dialout cdrom audio users sudo video games plugdev input gpio spi i2c netdev; do
adduser $FIRST_USER_NAME \$GRP
done
EOF

on_chroot << EOF
setupcon --force --save-only -v
EOF

on_chroot << EOF
usermod --pass='*' root
EOF

rm -f "${ROOTFS_DIR}/etc/ssh/"ssh_host_*_key*

+ 0
- 5
stage2/01-sys-tweaks/files/50raspi View File

@@ -1,5 +0,0 @@
# never use pdiffs. Current implementation is very slow on low-powered devices
Acquire::PDiffs "0";

# download up to 5 pdiffs:
#Acquire::PDiffs::FileLimit "5";

+ 0
- 3
stage2/01-sys-tweaks/files/90-qemu.rules View File

@@ -1,3 +0,0 @@
KERNEL=="sda", SYMLINK+="mmcblk0"
KERNEL=="sda?", SYMLINK+="mmcblk0p%n"
KERNEL=="sda2", SYMLINK+="root"

+ 0
- 16
stage2/01-sys-tweaks/files/console-setup View File

@@ -1,16 +0,0 @@
# CONFIGURATION FILE FOR SETUPCON

# Consult the console-setup(5) manual page.

ACTIVE_CONSOLES="/dev/tty[1-6]"

CHARMAP="UTF-8"

CODESET="guess"
FONTFACE=""
FONTSIZE=""

VIDEOMODE=

# The following is an example how to use a braille font
# FONT='lat9w-08.psf.gz brl-8x8.psf'

+ 0
- 20
stage2/01-sys-tweaks/files/rc.local View File

@@ -1,20 +0,0 @@
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
printf "My IP address is %s\n" "$_IP"
fi

exit 0

+ 0
- 25
stage2/01-sys-tweaks/files/resize2fs_once View File

@@ -1,25 +0,0 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: resize2fs_once
# Required-Start:
# Required-Stop:
# Default-Start: 3
# Default-Stop:
# Short-Description: Resize the root filesystem to fill partition
# Description:
### END INIT INFO
. /lib/lsb/init-functions
case "$1" in
start)
log_daemon_msg "Starting resize2fs_once"
ROOT_DEV=$(findmnt / -o source -n) &&
resize2fs $ROOT_DEV &&
update-rc.d resize2fs_once remove &&
rm /etc/init.d/resize2fs_once &&
log_end_msg $?
;;
*)
echo "Usage: $0 start" >&2
exit 3
;;
esac

+ 0
- 2
stage2/01-sys-tweaks/files/ttyoutput.conf View File

@@ -1,2 +0,0 @@
[Service]
StandardOutput=tty

+ 0
- 4
stage2/02-net-tweaks/00-packages View File

@@ -1,4 +0,0 @@
wpasupplicant wireless-tools firmware-atheros firmware-brcm80211 firmware-libertas firmware-misc-nonfree firmware-realtek
raspberrypi-net-mods
dhcpcd5
net-tools

+ 0
- 31
stage2/02-net-tweaks/01-run.sh View File

@@ -1,31 +0,0 @@
#!/bin/bash -e

install -v -d "${ROOTFS_DIR}/etc/systemd/system/dhcpcd.service.d"
install -v -m 644 files/wait.conf "${ROOTFS_DIR}/etc/systemd/system/dhcpcd.service.d/"

install -v -d "${ROOTFS_DIR}/etc/wpa_supplicant"
install -v -m 600 files/wpa_supplicant.conf "${ROOTFS_DIR}/etc/wpa_supplicant/"

if [ -v WPA_COUNTRY ]; then
echo "country=${WPA_COUNTRY}" >> "${ROOTFS_DIR}/etc/wpa_supplicant/wpa_supplicant.conf"
fi

if [ -v WPA_ESSID ] && [ -v WPA_PASSWORD ]; then
on_chroot <<EOF
set -o pipefail
wpa_passphrase "${WPA_ESSID}" "${WPA_PASSWORD}" | tee -a "/etc/wpa_supplicant/wpa_supplicant.conf"
EOF
elif [ -v WPA_ESSID ]; then
cat >> "${ROOTFS_DIR}/etc/wpa_supplicant/wpa_supplicant.conf" << EOL

network={
ssid="${WPA_ESSID}"
key_mgmt=NONE
}
EOL
fi

# Disable wifi on 5GHz models
mkdir -p "${ROOTFS_DIR}/var/lib/systemd/rfkill/"
echo 1 > "${ROOTFS_DIR}/var/lib/systemd/rfkill/platform-3f300000.mmcnr:wlan"
echo 1 > "${ROOTFS_DIR}/var/lib/systemd/rfkill/platform-fe300000.mmcnr:wlan"

+ 0
- 3
stage2/02-net-tweaks/files/wait.conf View File

@@ -1,3 +0,0 @@
[Service]
ExecStart=
ExecStart=/usr/lib/dhcpcd5/dhcpcd -q -w

+ 0
- 2
stage2/02-net-tweaks/files/wpa_supplicant.conf View File

@@ -1,2 +0,0 @@
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

+ 0
- 2
stage2/03-accept-mathematica-eula/00-debconf View File

@@ -1,2 +0,0 @@
# Do you accept the Wolfram - Raspberry Pi® Bundle License Agreement?
wolfram-engine shared/accepted-wolfram-eula boolean true

+ 0
- 8
stage2/03-set-timezone/02-run.sh View File

@@ -1,8 +0,0 @@
#!/bin/bash -e

echo "${TIMEZONE_DEFAULT}" > "${ROOTFS_DIR}/etc/timezone"
rm "${ROOTFS_DIR}/etc/localtime"

on_chroot << EOF
dpkg-reconfigure -f noninteractive tzdata
EOF

+ 0
- 5
stage2/prerun.sh View File

@@ -1,5 +0,0 @@
#!/bin/bash -e

if [ ! -d "${ROOTFS_DIR}" ]; then
copy_previous
fi

+ 0
- 2
stage3/00-install-packages/00-debconf View File

@@ -1,2 +0,0 @@
# Adobe Flash Player. Copyright 1996-2015. Adobe Systems Incorporated. All Rights Reserved.
rpi-chromium-mods rpi-chromium-mods/adobe note

+ 0
- 15
stage3/00-install-packages/00-packages View File

@@ -1,15 +0,0 @@
gstreamer1.0-x gstreamer1.0-omx gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-alsa gstreamer1.0-libav
qpdfview gtk2-engines alsa-utils
desktop-base
git
omxplayer
raspberrypi-artwork
policykit-1
gvfs
rfkill
chromium-browser rpi-chromium-mods
gldriver-test
fonts-droid-fallback
fonts-liberation2
obconf
arandr

+ 0
- 6
stage3/00-install-packages/00-packages-nr View File

@@ -1,6 +0,0 @@
xserver-xorg-video-fbdev xserver-xorg xinit xserver-xorg-video-fbturbo
mousepad
lxde lxtask menu-xdg
zenity xdg-utils
gvfs-backends gvfs-fuse
lightdm gnome-themes-standard-data gnome-icon-theme

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save