Skip to content

Commit f6231f9

Browse files
committed
Initial DashboardOS commit
1 parent df156f0 commit f6231f9

File tree

54 files changed

+96
-950
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+96
-950
lines changed

README.md

Lines changed: 12 additions & 243 deletions
Original file line numberDiff line numberDiff line change
@@ -1,251 +1,20 @@
1-
# pi-gen
1+
# DashboardOS for Raspberry PI
22

3-
_Tool used to create the raspberrypi.org Raspbian images_
3+
DashboardOS is a linux distribution for Raspberry PI optimised for digital signage. It uses Chromium in full screen to display your dashboards, videos, webpages.
44

5+
It is designed to be:
56

6-
## Dependencies
7+
* **Reliable** DashboardOS uses a read-only root partition. No writes occur on the microSD card, making it suitable to regular, ad-hoc power-cyclings.
8+
* **Secure** It is built from scratch and ships with only the bare minimum - no SSH, VNC, or even user account to log in with.
9+
* **Easy-to-use** Just configure the address of your dashboard in the "dashboard.txt" file in the boot partition, and you're good to go.
710

8-
pi-gen runs on Debian based operating systems. Currently it is only supported on
9-
either Debian Stretch or Ubuntu Xenial and is known to have issues building on
10-
earlier releases of these systems.
11+
## How to build
1112

12-
To install the required dependencies for pi-gen you should run:
13+
Being a fork of Raspberry Pi's [Pi-Gen](https://github.com/RPi-Distro/pi-gen), it uses the same build system. Stages 0-2 have been slightly adapted, and:
1314

14-
```bash
15-
apt-get install quilt parted realpath qemu-user-static debootstrap zerofree pxz zip \
16-
dosfstools bsdtar libcap2-bin grep rsync xz-utils
17-
```
15+
* stage3: everything that is required to get DashboardOS to work. Will install Chromium, and all required configuration and scripts to have a fully working system. This stage produces a build that is used during development.
16+
* stage4: additional security hardening. Firewall rules, reduced privileges for the main user. This stage produces the release build.
1817

19-
The file `depends` contains a list of tools needed. The format of this
20-
package is `<tool>[:<debian-package>]`.
21-
22-
23-
## Config
24-
25-
Upon execution, `build.sh` will source the file `config` in the current
26-
working directory. This bash shell fragment is intended to set needed
27-
environment variables.
28-
29-
The following environment variables are supported:
30-
31-
* `IMG_NAME` **required** (Default: unset)
32-
33-
The name of the image to build with the current stage directories. Setting
34-
`IMG_NAME=Raspbian` is logical for an unmodified RPi-Distro/pi-gen build,
35-
but you should use something else for a customized version. Export files
36-
in stages may add suffixes to `IMG_NAME`.
37-
38-
* `APT_PROXY` (Default: unset)
39-
40-
If you require the use of an apt proxy, set it here. This proxy setting
41-
will not be included in the image, making it safe to use an `apt-cacher` or
42-
similar package for development.
43-
44-
If you have Docker installed, you can set up a local apt caching proxy to
45-
like speed up subsequent builds like this:
46-
47-
docker-compose up -d
48-
echo 'APT_PROXY=http://172.17.0.1:3142' >> config
49-
50-
* `BASE_DIR` (Default: location of `build.sh`)
51-
52-
**CAUTION**: Currently, changing this value will probably break build.sh
53-
54-
Top-level directory for `pi-gen`. Contains stage directories, build
55-
scripts, and by default both work and deployment directories.
56-
57-
* `WORK_DIR` (Default: `"$BASE_DIR/work"`)
58-
59-
Directory in which `pi-gen` builds the target system. This value can be
60-
changed if you have a suitably large, fast storage location for stages to
61-
be built and cached. Note, `WORK_DIR` stores a complete copy of the target
62-
system for each build stage, amounting to tens of gigabytes in the case of
63-
Raspbian.
64-
65-
**CAUTION**: If your working directory is on an NTFS partition you probably won't be able to build. Make sure this is a proper Linux filesystem.
66-
67-
* `DEPLOY_DIR` (Default: `"$BASE_DIR/deploy"`)
68-
69-
Output directory for target system images and NOOBS bundles.
70-
71-
* `USE_QEMU` (Default: `"0"`)
72-
73-
Setting to '1' enables the QEMU mode - creating an image that can be mounted via QEMU for an emulated
74-
environment. These images include "-qemu" in the image file name.
75-
76-
77-
A simple example for building Raspbian:
78-
79-
```bash
80-
IMG_NAME='Raspbian'
81-
```
82-
83-
84-
## How the build process works
85-
86-
The following process is followed to build images:
87-
88-
* Loop through all of the stage directories in alphanumeric order
89-
90-
* Move on to the next directory if this stage directory contains a file called
91-
"SKIP"
92-
93-
* Run the script ```prerun.sh``` which is generally just used to copy the build
94-
directory between stages.
95-
96-
* In each stage directory loop through each subdirectory and then run each of the
97-
install scripts it contains, again in alphanumeric order. These need to be named
98-
with a two digit padded number at the beginning.
99-
There are a number of different files and directories which can be used to
100-
control different parts of the build process:
101-
102-
- **00-run.sh** - A unix shell script. Needs to be made executable for it to run.
103-
104-
- **00-run-chroot.sh** - A unix shell script which will be run in the chroot
105-
of the image build directory. Needs to be made executable for it to run.
106-
107-
- **00-debconf** - Contents of this file are passed to debconf-set-selections
108-
to configure things like locale, etc.
109-
110-
- **00-packages** - A list of packages to install. Can have more than one, space
111-
separated, per line.
112-
113-
- **00-packages-nr** - As 00-packages, except these will be installed using
114-
the ```--no-install-recommends -y``` parameters to apt-get.
115-
116-
- **00-patches** - A directory containing patch files to be applied, using quilt.
117-
If a file named 'EDIT' is present in the directory, the build process will
118-
be interrupted with a bash session, allowing an opportunity to create/revise
119-
the patches.
120-
121-
* If the stage directory contains files called "EXPORT_NOOBS" or "EXPORT_IMAGE" then
122-
add this stage to a list of images to generate
123-
124-
* Generate the images for any stages that have specified them
125-
126-
It is recommended to examine build.sh for finer details.
127-
128-
129-
## Docker Build
130-
131-
```bash
132-
vi config # Edit your config file. See above.
133-
./build-docker.sh
134-
```
135-
136-
If everything goes well, your finished image will be in the `deploy/` folder.
137-
You can then remove the build container with `docker rm -v pigen_work`
138-
139-
If something breaks along the line, you can edit the corresponding scripts, and
140-
continue:
141-
142-
```bash
143-
CONTINUE=1 ./build-docker.sh
144-
```
145-
146-
After successful build, the build container is by default removed. This may be undesired when making incremental changes to a customized build. To prevent the build script from remove the container add
147-
148-
```bash
149-
PRESERVE_CONTAINER=1 ./build-docker.sh
150-
```
151-
152-
There is a possibility that even when running from a docker container, the
153-
installation of `qemu-user-static` will silently fail when building the image
154-
because `binfmt-support` _must be enabled on the underlying kernel_. An easy
155-
fix is to ensure `binfmt-support` is installed on the host machine before
156-
starting the `./build-docker.sh` script (or using your own docker build
157-
solution).
158-
159-
160-
## Stage Anatomy
161-
162-
### Raspbian Stage Overview
163-
164-
The build of Raspbian is divided up into several stages for logical clarity
165-
and modularity. This causes some initial complexity, but it simplifies
166-
maintenance and allows for more easy customization.
167-
168-
- **Stage 0** - bootstrap. The primary purpose of this stage is to create a
169-
usable filesystem. This is accomplished largely through the use of
170-
`debootstrap`, which creates a minimal filesystem suitable for use as a
171-
base.tgz on Debian systems. This stage also configures apt settings and
172-
installs `raspberrypi-bootloader` which is missed by debootstrap. The
173-
minimal core is installed but not configured, and the system will not quite
174-
boot yet.
175-
176-
- **Stage 1** - truly minimal system. This stage makes the system bootable by
177-
installing system files like `/etc/fstab`, configures the bootloader, makes
178-
the network operable, and installs packages like raspi-config. At this
179-
stage the system should boot to a local console from which you have the
180-
means to perform basic tasks needed to configure and install the system.
181-
This is as minimal as a system can possibly get, and its arguably not
182-
really usable yet in a traditional sense yet. Still, if you want minimal,
183-
this is minimal and the rest you could reasonably do yourself as sysadmin.
184-
185-
- **Stage 2** - lite system. This stage produces the Raspbian-Lite image. It
186-
installs some optimized memory functions, sets timezone and charmap
187-
defaults, installs fake-hwclock and ntp, wifi and bluetooth support,
188-
dphys-swapfile, and other basics for managing the hardware. It also
189-
creates necessary groups and gives the pi user access to sudo and the
190-
standard console hardware permission groups.
191-
192-
There are a few tools that may not make a whole lot of sense here for
193-
development purposes on a minimal system such as basic Python and Lua
194-
packages as well as the `build-essential` package. They are lumped right
195-
in with more essential packages presently, though they need not be with
196-
pi-gen. These are understandable for Raspbian's target audience, but if
197-
you were looking for something between truly minimal and Raspbian-Lite,
198-
here's where you start trimming.
199-
200-
- **Stage 3** - desktop system. Here's where you get the full desktop system
201-
with X11 and LXDE, web browsers, git for development, Raspbian custom UI
202-
enhancements, etc. This is a base desktop system, with some development
203-
tools installed.
204-
205-
- **Stage 4** - Raspbian system meant to fit on a 4GB card. More development
206-
tools, an email client, learning tools like Scratch, specialized packages
207-
like sonic-pi, system documentation, office productivity, etc. This is the
208-
stage that installs all of the things that make Raspbian friendly to new
209-
users.
210-
211-
- **Stage 5** - The official Raspbian Desktop image. Right now only adds
212-
Mathematica.
213-
214-
### Stage specification
215-
216-
If you wish to build up to a specified stage (such as building up to stage 2
217-
for a lite system), place an empty file named `SKIP` in each of the `./stage`
218-
directories you wish not to include.
219-
220-
Then add an empty file named `SKIP_IMAGES` to `./stage4` (if building up to stage 2) or
221-
to `./stage2` (if building a minimal system).
222-
223-
```bash
224-
# Example for building a lite system
225-
echo "IMG_NAME='Raspbian'" > config
226-
touch ./stage3/SKIP ./stage4/SKIP ./stage5/SKIP
227-
touch ./stage4/SKIP_IMAGES ./stage5/SKIP_IMAGES
228-
sudo ./build.sh # or ./build-docker.sh
229-
```
230-
231-
If you wish to build further configurations upon (for example) the lite
232-
system, you can also delete the contents of `./stage3` and `./stage4` and
233-
replace with your own contents in the same format.
234-
235-
236-
## Skipping stages to speed up development
237-
238-
If you're working on a specific stage the recommended development process is as
239-
follows:
240-
241-
* Add a file called SKIP_IMAGES into the directories containing EXPORT_* files
242-
(currently stage2, stage4 and stage5)
243-
* Add SKIP files to the stages you don't want to build. For example, if you're
244-
basing your image on the lite image you would add these to stages 3, 4 and 5.
245-
* Run build.sh to build all stages
246-
* Add SKIP files to the earlier successfully built stages
247-
* Modify the last stage
248-
* Rebuild just the last stage using ```sudo CLEAN=1 ./build.sh```
249-
* Once you're happy with the image you can remove the SKIP_IMAGES files and
250-
export your image to test
18+
## Credits
25119

20+
The project is inspired from [FullPageOS]([ttps://github.com/guysoft/FullPageOS) by @GuySoft.

export-image/04-finalise/01-run.sh

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,8 @@ unmount_image "${IMG_FILE}"
7272

7373
mkdir -p "${DEPLOY_DIR}"
7474

75-
rm -f "${DEPLOY_DIR}/image_${IMG_DATE}-${IMG_NAME}${IMG_SUFFIX}.zip"
76-
7775
pushd "${STAGE_WORK_DIR}" > /dev/null
78-
zip "${DEPLOY_DIR}/image_${IMG_DATE}-${IMG_NAME}${IMG_SUFFIX}.zip" \
79-
"$(basename "${IMG_FILE}")"
76+
cp "$(basename "${IMG_FILE}")" "${DEPLOY_DIR}/${IMG_NAME}-${IMG_DATE}${IMG_SUFFIX}.img"
8077
popd > /dev/null
8178

8279
cp "$INFO_FILE" "$DEPLOY_DIR"

export-noobs/00-release/00-run.sh

Lines changed: 0 additions & 36 deletions
This file was deleted.
-1.62 KB
Binary file not shown.
-50.4 KB
Binary file not shown.
-48.3 KB
Binary file not shown.
-104 KB
Binary file not shown.
-93.3 KB
Binary file not shown.
-79.2 KB
Binary file not shown.
-65.4 KB
Binary file not shown.

0 commit comments

Comments
 (0)