Merge 70fb0a72b8
into 066eb03d52
This commit is contained in:
commit
d6bfa32f52
219
README.md
219
README.md
|
@ -1,161 +1,18 @@
|
|||
# pi-gen
|
||||
|
||||
_Tool used to create the raspberrypi.org Raspbian images_
|
||||
|
||||
|
||||
## Dependencies
|
||||
|
||||
pi-gen runs on Debian based operating systems. Currently it is only supported on
|
||||
either Debian Stretch or Ubuntu Xenial and is known to have issues building on
|
||||
earlier releases of these systems.
|
||||
|
||||
To install the required dependencies for pi-gen you should run:
|
||||
|
||||
```bash
|
||||
apt-get install quilt parted realpath qemu-user-static debootstrap zerofree pxz zip \
|
||||
dosfstools bsdtar libcap2-bin grep rsync xz-utils
|
||||
```
|
||||
|
||||
The file `depends` contains a list of tools needed. The format of this
|
||||
package is `<tool>[:<debian-package>]`.
|
||||
|
||||
|
||||
## Config
|
||||
|
||||
Upon execution, `build.sh` will source the file `config` in the current
|
||||
working directory. This bash shell fragment is intended to set needed
|
||||
environment variables.
|
||||
|
||||
The following environment variables are supported:
|
||||
|
||||
* `IMG_NAME` **required** (Default: unset)
|
||||
|
||||
The name of the image to build with the current stage directories. Setting
|
||||
`IMG_NAME=Raspbian` is logical for an unmodified RPi-Distro/pi-gen build,
|
||||
but you should use something else for a customized version. Export files
|
||||
in stages may add suffixes to `IMG_NAME`.
|
||||
|
||||
* `APT_PROXY` (Default: unset)
|
||||
|
||||
If you require the use of an apt proxy, set it here. This proxy setting
|
||||
will not be included in the image, making it safe to use an `apt-cacher` or
|
||||
similar package for development.
|
||||
|
||||
If you have Docker installed, you can set up a local apt caching proxy to
|
||||
like speed up subsequent builds like this:
|
||||
|
||||
docker-compose up -d
|
||||
echo 'APT_PROXY=http://172.17.0.1:3142' >> config
|
||||
|
||||
* `BASE_DIR` (Default: location of `build.sh`)
|
||||
|
||||
**CAUTION**: Currently, changing this value will probably break build.sh
|
||||
|
||||
Top-level directory for `pi-gen`. Contains stage directories, build
|
||||
scripts, and by default both work and deployment directories.
|
||||
|
||||
* `WORK_DIR` (Default: `"$BASE_DIR/work"`)
|
||||
|
||||
Directory in which `pi-gen` builds the target system. This value can be
|
||||
changed if you have a suitably large, fast storage location for stages to
|
||||
be built and cached. Note, `WORK_DIR` stores a complete copy of the target
|
||||
system for each build stage, amounting to tens of gigabytes in the case of
|
||||
Raspbian.
|
||||
|
||||
**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.
|
||||
|
||||
* `DEPLOY_DIR` (Default: `"$BASE_DIR/deploy"`)
|
||||
|
||||
Output directory for target system images and NOOBS bundles.
|
||||
|
||||
* `USE_QEMU` (Default: `"0"`)
|
||||
|
||||
This enable the Qemu mode and set filesystem and image suffix if set to 1.
|
||||
|
||||
|
||||
A simple example for building Raspbian:
|
||||
|
||||
```bash
|
||||
IMG_NAME='Raspbian'
|
||||
```
|
||||
|
||||
|
||||
## How the build process works
|
||||
|
||||
The following process is followed to build images:
|
||||
|
||||
* Loop through all of the stage directories in alphanumeric order
|
||||
|
||||
* Move on to the next directory if this stage directory contains a file called
|
||||
"SKIP"
|
||||
|
||||
* Run the script ```prerun.sh``` which is generally just used to copy the build
|
||||
directory between stages.
|
||||
|
||||
* In each stage directory loop through each subdirectory and then run each of the
|
||||
install scripts it contains, again in alphanumeric order. These need to be named
|
||||
with a two digit padded number at the beginning.
|
||||
There are a number of different files and directories which can be used to
|
||||
control different parts of the build process:
|
||||
|
||||
- **00-run.sh** - A unix shell script. Needs to be made executable for it to run
|
||||
|
||||
- **00-run-chroot.sh** - A unix shell script which will be run in the chroot
|
||||
of the image build directory. Needs to be made executable for it to run.
|
||||
|
||||
- **00-debconf** - Contents of this file are passed to debconf-set-selections
|
||||
to configure things like locale, etc.
|
||||
|
||||
- **00-packages** - A list of packages to install. Can have more than one, space
|
||||
separated, per line.
|
||||
|
||||
- **00-packages-nr** - As 00-packages, except these will be installed using
|
||||
the ```--no-install-recommends -y``` parameters to apt-get
|
||||
|
||||
- **00-patches** - A directory containing patch files to be applied
|
||||
|
||||
* If the stage directory contains files called "EXPORT_NOOBS" or "EXPORT_IMAGE" then
|
||||
add this stage to a list of images to generate
|
||||
|
||||
* Generate the images for any stages that have specified them
|
||||
|
||||
It is recommended to examine build.sh for finer details.
|
||||
|
||||
|
||||
## Docker Build
|
||||
|
||||
```bash
|
||||
vi config # Edit your config file. See above.
|
||||
./build-docker.sh
|
||||
```
|
||||
|
||||
If everything goes well, your finished image will be in the `deploy/` folder.
|
||||
You can then remove the build container with `docker rm -v pigen_work`
|
||||
|
||||
If something breaks along the line, you can edit the corresponding scripts, and
|
||||
continue:
|
||||
|
||||
```bash
|
||||
CONTINUE=1 ./build-docker.sh
|
||||
```
|
||||
|
||||
There is a possibility that even when running from a docker container, the
|
||||
installation of `qemu-user-static` will silently fail when building the image
|
||||
because `binfmt-support` _must be enabled on the underlying kernel_. An easy
|
||||
fix is to ensure `binfmt-support` is installed on the host machine before
|
||||
starting the `./build-docker.sh` script (or using your own docker build
|
||||
solution).
|
||||
# Dependencies
|
||||
|
||||
sudo apt-get update && sudo apt-get install git curl quilt parted realpath qemu-user-static debootstrap zerofree pxz zip dosfstools bsdtar libcap2-bin grep rsync xz-utils -y && cd ../ &&
|
||||
sudo git clone https://github.com/dride/drideOS-image-generator && cd drideOS-image-generator && sudo ./build.sh
|
||||
|
||||
## Stage Anatomy
|
||||
|
||||
### Raspbian Stage Overview
|
||||
### (drideOS) Raspbian Stage Overview
|
||||
|
||||
|
||||
The build of Raspbian is divided up into several stages for logical clarity
|
||||
and modularity. This causes some initial complexity, but it simplifies
|
||||
maintenance and allows for more easy customization.
|
||||
|
||||
- **Stage 0** - bootstrap. The primary purpose of this stage is to create a
|
||||
- Stage 0, bootstrap. The primary purpose of this stage is to create a
|
||||
usable filesystem. This is accomplished largely through the use of
|
||||
`debootstrap`, which creates a minimal filesystem suitable for use as a
|
||||
base.tgz on Debian systems. This stage also configures apt settings and
|
||||
|
@ -163,7 +20,7 @@ maintenance and allows for more easy customization.
|
|||
minimal core is installed but not configured, and the system will not quite
|
||||
boot yet.
|
||||
|
||||
- **Stage 1** - truly minimal system. This stage makes the system bootable by
|
||||
- Stage 1, truly minimal system. This stage makes the system bootable by
|
||||
installing system files like `/etc/fstab`, configures the bootloader, makes
|
||||
the network operable, and installs packages like raspi-config. At this
|
||||
stage the system should boot to a local console from which you have the
|
||||
|
@ -172,70 +29,10 @@ maintenance and allows for more easy customization.
|
|||
really usable yet in a traditional sense yet. Still, if you want minimal,
|
||||
this is minimal and the rest you could reasonably do yourself as sysadmin.
|
||||
|
||||
- **Stage 2** - lite system. This stage produces the Raspbian-Lite image. It
|
||||
- State 2, lite system. This stage produces the Raspbian-Lite image. It
|
||||
installs some optimized memory functions, sets timezone and charmap
|
||||
defaults, installs fake-hwclock and ntp, wifi and bluetooth support,
|
||||
dphys-swapfile, and other basics for managing the hardware. It also
|
||||
creates necessary groups and gives the pi user access to sudo and the
|
||||
standard console hardware permission groups.
|
||||
|
||||
There are a few tools that may not make a whole lot of sense here for
|
||||
development purposes on a minimal system such as basic Python and Lua
|
||||
packages as well as the `build-essential` package. They are lumped right
|
||||
in with more essential packages presently, though they need not be with
|
||||
pi-gen. These are understandable for Raspbian's target audience, but if
|
||||
you were looking for something between truly minimal and Raspbian-Lite,
|
||||
here's where you start trimming.
|
||||
|
||||
- **Stage 3** - desktop system. Here's where you get the full desktop system
|
||||
with X11 and LXDE, web browsers, git for development, Raspbian custom UI
|
||||
enhancements, etc. This is a base desktop system, with some development
|
||||
tools installed.
|
||||
|
||||
- **Stage 4** - Raspbian system meant to fit on a 4GB card. More development
|
||||
tools, an email client, learning tools like Scratch, specialized packages
|
||||
like sonic-pi, system documentation, office productivity, etc. This is the
|
||||
stage that installs all of the things that make Raspbian friendly to new
|
||||
users.
|
||||
|
||||
- **Stage 5** - The official Raspbian Desktop image. Right now only adds
|
||||
Mathematica.
|
||||
|
||||
### Stage specification
|
||||
|
||||
If you wish to build up to a specified stage (such as building up to stage 2
|
||||
for a lite system), place an empty file named `SKIP` in each of the `./stage`
|
||||
directories you wish not to include.
|
||||
|
||||
Then remove the `EXPORT*` files from `./stage4` (if building up to stage 2) or
|
||||
from `./stage2` (if building a minimal system).
|
||||
|
||||
```bash
|
||||
# Example for building a lite system
|
||||
echo "IMG_NAME='Raspbian'" > config
|
||||
touch ./stage3/SKIP ./stage4/SKIP ./stage5/SKIP
|
||||
rm stage4/EXPORT* stage5/EXPORT*
|
||||
sudo ./build.sh # or ./build-docker.sh
|
||||
```
|
||||
|
||||
If you wish to build further configurations upon (for example) the lite
|
||||
system, you can also delete the contents of `./stage3` and `./stage4` and
|
||||
replace with your own contents in the same format.
|
||||
|
||||
|
||||
## Skipping stages to speed up development
|
||||
|
||||
If you're working on a specific stage the recommended development process is as
|
||||
follows:
|
||||
|
||||
* Add a file called SKIP_IMAGES into the directories containing EXPORT_* files
|
||||
(currently stage2, stage4 and stage5)
|
||||
* Add SKIP files to the stages you don't want to build. For example, if you're
|
||||
basing your image on the lite image you would add these to stages 3, 4 and 5.
|
||||
* Run build.sh to build all stages
|
||||
* Add SKIP files to the earlier successfully built stages
|
||||
* Modify the last stage
|
||||
* Rebuild just the last stage using ```sudo CLEAN=1 ./build.sh```
|
||||
* Once you're happy with the image you can remove the SKIP_IMAGES files and
|
||||
export your image to test
|
||||
|
||||
|
|
2
build.sh
2
build.sh
|
@ -134,6 +134,8 @@ fi
|
|||
export USE_QEMU=${USE_QEMU:-0}
|
||||
export IMG_DATE=${IMG_DATE:-"$(date +%Y-%m-%d)"}
|
||||
|
||||
export OS_TYPE=$1
|
||||
|
||||
export BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
export SCRIPT_DIR="${BASE_DIR}/scripts"
|
||||
export WORK_DIR=${WORK_DIR:-"${BASE_DIR}/work/${IMG_DATE}-${IMG_NAME}"}
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
install -m 755 files/resize2fs_once ${ROOTFS_DIR}/etc/init.d/
|
||||
|
||||
|
||||
|
||||
|
||||
install -m 755 files/resize2fs_once ${ROOTFS_DIR}/etc/init.d/
|
||||
|
||||
install -d ${ROOTFS_DIR}/etc/systemd/system/rc-local.service.d
|
||||
|
@ -15,7 +20,7 @@ on_chroot << EOF
|
|||
systemctl disable hwclock.sh
|
||||
systemctl disable nfs-common
|
||||
systemctl disable rpcbind
|
||||
systemctl disable ssh
|
||||
systemctl enable ssh
|
||||
systemctl enable regenerate_ssh_host_keys
|
||||
EOF
|
||||
|
||||
|
@ -58,3 +63,382 @@ usermod --pass='*' root
|
|||
EOF
|
||||
|
||||
rm -f ${ROOTFS_DIR}/etc/ssh/ssh_host_*_key*
|
||||
|
||||
on_chroot << EOF
|
||||
|
||||
|
||||
#-------------------------------------------------------
|
||||
# Script to check if all is good before install script runs
|
||||
#-------------------------------------------------------
|
||||
echo "====== Dride install script ======"
|
||||
echo ""
|
||||
echo ""
|
||||
echo ""
|
||||
echo "██████╗ ██████╗ ██╗██████╗ ███████╗"
|
||||
echo "██╔══██╗██╔══██╗██║██╔══██╗██╔════╝"
|
||||
echo "██║ ██║██████╔╝██║██║ ██║█████╗ "
|
||||
echo "██║ ██║██╔══██╗██║██║ ██║██╔══╝ "
|
||||
echo "██████╔╝██║ ██║██║██████╔╝███████╗"
|
||||
echo "╚═════╝ ╚═╝ ╚═╝╚═╝╚═════╝ ╚══════╝"
|
||||
echo ""
|
||||
echo ""
|
||||
echo "This will install all the necessary dependences and software for dride."
|
||||
echo "======================================================="
|
||||
echo ""
|
||||
echo ""
|
||||
|
||||
|
||||
|
||||
echo ""
|
||||
echo ""
|
||||
echo "==============================="
|
||||
echo "*******************************"
|
||||
echo " *** STARTING INSTALLATION ***"
|
||||
echo " ** this may take a while **"
|
||||
echo " *************************"
|
||||
echo " ========================="
|
||||
echo ""
|
||||
echo ""
|
||||
|
||||
|
||||
|
||||
cd /home
|
||||
|
||||
# Install dependencies
|
||||
echo "========== Update Aptitude ==========="
|
||||
# sudo apt-get update -y
|
||||
# sudo apt-get upgrade
|
||||
|
||||
if [ ${OS_TYPE} == "drideOS" ]; then
|
||||
echo "========== Installing build-essential ============"
|
||||
sudo apt-get install build-essential -y
|
||||
|
||||
|
||||
echo "========== Installing libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev libjasper-dev python2.7-dev ============"
|
||||
sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev libjasper-dev python2.7-dev -y
|
||||
fi
|
||||
|
||||
echo "========== Installing gpac ============"
|
||||
sudo apt-get install gpac -y
|
||||
|
||||
echo "========== Installing htop ============"
|
||||
sudo apt-get install htop -y
|
||||
|
||||
|
||||
echo "========== Setup libav ============"
|
||||
sudo apt-get install libav-tools -y
|
||||
|
||||
|
||||
|
||||
# Install Node
|
||||
echo "========== Installing Node ============"
|
||||
wget -O - https://raw.githubusercontent.com/sdesalas/node-pi-zero/master/install-node-v8.9.0.sh | bash
|
||||
|
||||
|
||||
echo "========== Installing pip ============"
|
||||
sudo apt-get install python-pip -y
|
||||
|
||||
if [ ${OS_TYPE} == "drideOS" ]; then
|
||||
echo "========== Installing Numpy ============"
|
||||
sudo pip install numpy
|
||||
fi
|
||||
|
||||
echo "========== Install picamera ============"
|
||||
sudo apt-get install python3-picamera
|
||||
|
||||
|
||||
# enable camera on raspi-config and allocate more ram to the GPU
|
||||
echo "" >> /boot/config.txt
|
||||
echo "#enable piCaera" >> /boot/config.txt
|
||||
echo "start_x=1" >> /boot/config.txt
|
||||
echo "gpu_mem=128" >> /boot/config.txt
|
||||
echo "dtparam=spi=on" >> /boot/config.txt
|
||||
|
||||
|
||||
if [ ${OS_TYPE} == "drideOS" ]; then
|
||||
echo "========== Install mpg123 ============"
|
||||
sudo apt-get install mpg123 -y
|
||||
fi
|
||||
|
||||
# Install WIFi
|
||||
echo iptables-persistent iptables-persistent/autosave_v4 boolean true | sudo debconf-set-selections
|
||||
echo iptables-persistent iptables-persistent/autosave_v6 boolean true | sudo debconf-set-selections
|
||||
|
||||
sudo apt-get install hostapd isc-dhcp-server -y
|
||||
sudo apt-get install iptables-persistent -y
|
||||
|
||||
cd /home
|
||||
# get the dhcpd config file
|
||||
sudo wget https://dride.io/code/dhcpd.conf
|
||||
|
||||
sudo cp dhcpd.conf /etc/dhcp/dhcpd.conf
|
||||
sudo rm dhcpd.conf
|
||||
|
||||
|
||||
sudo bash -c 'echo "INTERFACES=\"wlan0\""> /etc/default/isc-dhcp-server'
|
||||
|
||||
sudo ifdown wlan0
|
||||
|
||||
|
||||
sudo wget https://dride.io/code/interfaces
|
||||
|
||||
sudo cp interfaces /etc/network/interfaces
|
||||
sudo rm interfaces
|
||||
|
||||
|
||||
sudo ifconfig wlan0 192.168.42.1
|
||||
|
||||
|
||||
sudo wget https://dride.io/code/hostapd.conf
|
||||
|
||||
sudo cp hostapd.conf /etc/hostapd/hostapd.conf
|
||||
sudo rm hostapd.conf
|
||||
|
||||
sudo bash -c 'echo "DAEMON_CONF=\"/etc/hostapd/hostapd.conf\""> /etc/default/hostapd'
|
||||
|
||||
sudo wget https://dride.io/code/hostapd
|
||||
|
||||
sudo cp hostapd /etc/init.d/hostapd
|
||||
sudo rm hostapd
|
||||
|
||||
|
||||
sudo bash -c 'echo "net.ipv4.ip_forward=1"> /etc/sysctl.conf'
|
||||
sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"
|
||||
|
||||
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
|
||||
sudo iptables -A FORWARD -i eth0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT
|
||||
sudo iptables -A FORWARD -i wlan0 -o eth0 -j ACCEPT
|
||||
|
||||
|
||||
sudo sh -c "iptables-save > /etc/iptables/rules.v4"
|
||||
|
||||
sudo mv /usr/share/dbus-1/system-services/fi.epitest.hostap.WPASupplicant.service ~/
|
||||
|
||||
|
||||
sudo service hostapd start
|
||||
sudo service isc-dhcp-server start
|
||||
sudo update-rc.d hostapd enable
|
||||
sudo update-rc.d isc-dhcp-server enable
|
||||
|
||||
|
||||
|
||||
|
||||
sudo pip install pyserial
|
||||
|
||||
|
||||
#startup script's
|
||||
sudo wget https://dride.io/code/startup/dride-ws
|
||||
|
||||
if [ ${OS_TYPE} == "drideOS" ]; then
|
||||
sudo wget https://dride.io/code/startup/dride-core
|
||||
sudo wget https://dride.io/code/startup/drideOS-resize
|
||||
else
|
||||
sudo wget https://dride.io/code/startup/dride-core
|
||||
fi;
|
||||
|
||||
|
||||
# express on startup
|
||||
sudo cp dride-ws /etc/init.d/dride-ws
|
||||
sudo chmod +x /etc/init.d/dride-ws
|
||||
sudo update-rc.d dride-ws defaults
|
||||
sudo rm dride-ws
|
||||
|
||||
# dride-core on startup
|
||||
if [ ${OS_TYPE} == "drideOS" ]; then
|
||||
sudo cp dride-core /etc/init.d/dride-core
|
||||
else
|
||||
sudo cp dride-core /etc/init.d/dride-core
|
||||
fi;
|
||||
|
||||
sudo chmod +x /etc/init.d/dride-core
|
||||
sudo update-rc.d dride-core defaults
|
||||
sudo rm dride-core
|
||||
|
||||
# drideOS-resize on startup
|
||||
if [ ${OS_TYPE} == "drideOS" ]; then
|
||||
sudo cp drideOS-resize /etc/init.d/drideOS-resize
|
||||
sudo chmod +x /etc/init.d/drideOS-resize
|
||||
sudo update-rc.d drideOS-resize defaults
|
||||
sudo rm drideOS-resize
|
||||
fi;
|
||||
|
||||
|
||||
|
||||
|
||||
if [ ${OS_TYPE} == "drideOS" ]; then
|
||||
## GPS https://www.raspberrypi.org/forums/viewtopic.php?p=947968#p947968
|
||||
echo "========== Install GPS ============"
|
||||
sudo apt-get install gpsd gpsd-clients cmake subversion build-essential espeak freeglut3-dev imagemagick libdbus-1-dev libdbus-glib-1-dev libdevil-dev libfontconfig1-dev libfreetype6-dev libfribidi-dev libgarmin-dev libglc-dev libgps-dev libgtk2.0-dev libimlib2-dev libpq-dev libqt4-dev libqtwebkit-dev librsvg2-bin libsdl-image1.2-dev libspeechd-dev libxml2-dev ttf-liberation -y
|
||||
|
||||
|
||||
echo "" >> /boot/config.txt
|
||||
echo "enable_uart=1" >> /boot/config.txt
|
||||
|
||||
# this will be done after initial boot
|
||||
# echo "dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes spidev.bufsiz=32768 rootwait" > /boot/cmdline.txt
|
||||
|
||||
|
||||
|
||||
# 3)Run
|
||||
sudo systemctl stop serial-getty@ttyS0.service
|
||||
sudo systemctl disable serial-getty@ttyS0.service
|
||||
sudo systemctl stop gpsd.socket
|
||||
sudo systemctl disable gpsd.socket
|
||||
|
||||
# reboot
|
||||
|
||||
# 5) Execute the daemon reset
|
||||
#sudo killall gpsd
|
||||
#sudo gpsd /dev/ttyS0 -F /var/run/gpsd.sock
|
||||
fi
|
||||
|
||||
|
||||
|
||||
if [ ${OS_TYPE} == "drideOS" ]; then
|
||||
echo "========== Downloading and installing OpenCV ============"
|
||||
cd /
|
||||
# git clone https://github.com/Itseez/opencv.git --depth 1
|
||||
wget -c -O "opencv-3.1.0.zip" "https://github.com/Itseez/opencv/archive/3.1.0.zip"
|
||||
sudo apt-get install unzip
|
||||
unzip -q -n "opencv-3.1.0.zip"
|
||||
|
||||
cd opencv-3.1.0
|
||||
echo "======== Building OpenCV ============"
|
||||
cd /home/opencv-3.1.0
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -D CMAKE_BUILD_TYPE=RELEASE -D BUILD_EXAMPLES=OFF -D BUILD_opencv_apps=OFF -D BUILD_DOCS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_TESTS=OFF -D CMAKE_INSTALL_PREFIX=/usr/local ..
|
||||
echo "==>>>====== This might take a long time.. ============"
|
||||
make -j1
|
||||
|
||||
sudo make install
|
||||
sudo ldconfig
|
||||
|
||||
# remove the installation file
|
||||
cd /
|
||||
sudo rm opencv-3.1.0.zip
|
||||
|
||||
# TODO: Add a test if openCV was installed correctly
|
||||
fi
|
||||
|
||||
echo "========== Setup sound to I2S ============"
|
||||
sudo curl -sS https://dride.io/code/i2samp.sh | bash
|
||||
|
||||
|
||||
echo "========== Setup mic ============"
|
||||
# https://learn.adafruit.com/adafruit-i2s-mems-microphone-breakout/raspberry-pi-wiring-and-test
|
||||
|
||||
|
||||
echo "========== Setup RTC ============"
|
||||
# https://learn.adafruit.com/adding-a-real-time-clock-to-raspberry-pi/set-rtc-time
|
||||
sudo apt-get install python-smbus i2c-tools
|
||||
# TODO: turn on ISC on raspi-config...
|
||||
|
||||
|
||||
|
||||
|
||||
# add to sudo nano /boot/config.txt
|
||||
echo "dtoverlay=i2c-rtc,ds3231" >> /boot/config.txt
|
||||
echo "dtparam=i2c_arm=on" >> /boot/config.txt
|
||||
|
||||
# Remove hw-clock
|
||||
sudo apt-get -y remove fake-hwclock
|
||||
sudo update-rc.d -f fake-hwclock remove
|
||||
|
||||
# copy new file to
|
||||
sudo wget https://dride.io/code/hwclock-set
|
||||
|
||||
sudo cp hwclock-set /lib/udev/hwclock-set
|
||||
sudo rm hwclock-set
|
||||
|
||||
# we will sync the current date form the app using BLE
|
||||
# looks at /daemon/bluetooth/updateDate.js
|
||||
|
||||
|
||||
echo "========== Setup Accelerometer ============"
|
||||
# http://www.stuffaboutcode.com/2014/06/raspberry-pi-adxl345-accelerometer.html
|
||||
# enable i2c 0
|
||||
echo "dtparam=i2c_vc=on" >> /boot/config.txt
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
echo "========== Install Dride-core [Cardigan] ============"
|
||||
cd /home
|
||||
# https://s3.amazonaws.com/dride/releases/cardigan/latest.zip
|
||||
sudo mkdir Cardigan && cd Cardigan
|
||||
sudo wget -c -O "cardigan.zip" "https://s3.amazonaws.com/dride/releases/cardigan/latest.zip"
|
||||
sudo unzip "cardigan.zip"
|
||||
|
||||
|
||||
sudo rm -R cardigan.zip
|
||||
|
||||
|
||||
# make the video dir writable
|
||||
sudo chmod 777 -R /home/Cardigan/modules/video/
|
||||
sudo chmod 777 -R /home/Cardigan/modules/settings/
|
||||
#make gps position writable
|
||||
sudo chmod +x /home/Cardigan/daemons/gps/position
|
||||
|
||||
# make the firmware dir writable
|
||||
sudo chmod 777 -R /home/Cardigan/firmware/
|
||||
|
||||
# run npm install on video module
|
||||
cd /home/Cardigan/modules/video
|
||||
sudo npm i --production
|
||||
|
||||
|
||||
# run npm install on dride-ws
|
||||
cd /home/Cardigan/dride-ws
|
||||
|
||||
sudo npm i --production
|
||||
|
||||
|
||||
# setup clear cron job
|
||||
crontab -l > cleanerJob
|
||||
echo "* * * * * node /home/Cardigan/modules/video/helpers/cleaner.js" >> cleanerJob
|
||||
#install new cron file
|
||||
crontab cleanerJob
|
||||
rm cleanerJob
|
||||
|
||||
|
||||
echo "========== Install Indicators ============"
|
||||
echo "# Needed for SPI LED" >> /boot/config.txt
|
||||
echo "core_freq=250" >> /boot/config.txt
|
||||
sudo apt-get install scons
|
||||
cd /home/Cardigan/modules/indicators
|
||||
sudo scons
|
||||
sudo apt-get install python-dev swig -y
|
||||
cd /home/Cardigan/modules/indicators/python
|
||||
sudo python setup.py install
|
||||
|
||||
|
||||
|
||||
|
||||
echo "========== Setup bluetooth ============"
|
||||
|
||||
sudo apt-get install bluetooth bluez libbluetooth-dev libudev-dev -y
|
||||
|
||||
|
||||
# run npm install on Bluetooth daemon
|
||||
cd /home/Cardigan/daemons/bluetooth
|
||||
sudo npm i --production
|
||||
|
||||
|
||||
|
||||
|
||||
echo ""
|
||||
echo '============================='
|
||||
echo '*****************************'
|
||||
echo '========= Finished =========='
|
||||
echo '*****************************'
|
||||
echo '============================='
|
||||
echo ""
|
||||
|
||||
|
||||
EOF
|
42
stage2/01-sys-tweaks/files/startup/dride-core
Executable file
42
stage2/01-sys-tweaks/files/startup/dride-core
Executable file
|
@ -0,0 +1,42 @@
|
|||
#! /bin/sh
|
||||
# /etc/init.d/dride-core
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: dride-core
|
||||
# Required-Start: $remote_fs $syslog
|
||||
# Required-Stop: $remote_fs $syslog
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: will run the main dride-core process
|
||||
# Description:
|
||||
### END INIT INFO
|
||||
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
echo "Starting dride-core"
|
||||
# run application you want to start
|
||||
sudo python /home/Cardigan/mainPi.py &
|
||||
|
||||
# run gps daemon
|
||||
sudo python /home/Cardigan/daemons/gps/helper.py &
|
||||
|
||||
# run button / bluetooth daemon
|
||||
sudo python /home/Cardigan/daemons/bluetooth/initPin.py &
|
||||
sleep 5 && sudo BLENO_DEVICE_NAME="dride" node /home/Cardigan/daemons/bluetooth/main.js &
|
||||
;;
|
||||
stop)
|
||||
echo "Stopping dride-core"
|
||||
# kill application you want to stop
|
||||
killall python
|
||||
;;
|
||||
*)
|
||||
echo "Usage: /etc/init.d/dride-core{start|stop}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
|
||||
|
||||
|
42
stage2/01-sys-tweaks/files/startup/dride-core-z
Executable file
42
stage2/01-sys-tweaks/files/startup/dride-core-z
Executable file
|
@ -0,0 +1,42 @@
|
|||
#! /bin/sh
|
||||
# /etc/init.d/dride-core
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: dride-core
|
||||
# Required-Start: $remote_fs $syslog
|
||||
# Required-Stop: $remote_fs $syslog
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: will run the main dride-core process
|
||||
# Description:
|
||||
### END INIT INFO
|
||||
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
echo "Starting dride-core"
|
||||
# run application you want to start
|
||||
sudo python /home/Cardigan/mainPiZero.py &
|
||||
|
||||
# run gps daemon
|
||||
sudo python /home/Cardigan/daemons/gps/helper.py &
|
||||
|
||||
# run button / bluetooth daemon
|
||||
sudo python /home/Cardigan/daemons/bluetooth/initPin.py &
|
||||
sleep 5 && sudo BLENO_DEVICE_NAME="dride" node /home/Cardigan/daemons/bluetooth/main.js &
|
||||
;;
|
||||
stop)
|
||||
echo "Stopping dride-core"
|
||||
# kill application you want to stop
|
||||
killall python
|
||||
;;
|
||||
*)
|
||||
echo "Usage: /etc/init.d/dride-core{start|stop}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
|
||||
|
||||
|
31
stage2/01-sys-tweaks/files/startup/dride-ws
Executable file
31
stage2/01-sys-tweaks/files/startup/dride-ws
Executable file
|
@ -0,0 +1,31 @@
|
|||
#! /bin/sh
|
||||
# /etc/init.d/dride-ws
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: dride-ws
|
||||
# Required-Start: $remote_fs $syslog
|
||||
# Required-Stop: $remote_fs $syslog
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: will run the dride web server on startup
|
||||
# Description: AKA dride-ws
|
||||
### END INIT INFO
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
echo "Starting dride-ws"
|
||||
# run node-express server
|
||||
sudo node /home/Cardigan/dride-ws/server/app.js &
|
||||
;;
|
||||
stop)
|
||||
echo "Stopping dride-ws"
|
||||
# kill application you want to stop
|
||||
killall node
|
||||
;;
|
||||
*)
|
||||
echo "Usage: /etc/init.d/dride-ws{start|stop}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
18
stage2/01-sys-tweaks/files/startup/drideOS-resize
Executable file
18
stage2/01-sys-tweaks/files/startup/drideOS-resize
Executable file
|
@ -0,0 +1,18 @@
|
|||
#! /bin/sh
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: drideOS-resize
|
||||
# Required-Start: $remote_fs $syslog
|
||||
# Required-Stop: $remote_fs $syslog
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: will resize the file system & reboot
|
||||
# Description:
|
||||
### END INIT INFO
|
||||
|
||||
echo "dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait" > /boot/cmdline.txt
|
||||
|
||||
# Delete the script
|
||||
rm $0
|
||||
# reboot
|
||||
sudo reboot
|
5
stage2/03-dride/00-run.sh
Executable file
5
stage2/03-dride/00-run.sh
Executable file
|
@ -0,0 +1,5 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
# on_chroot << EOF
|
||||
# bash -c "$(curl -s https://dride.io/code/install.sh)"
|
||||
# EOF
|
5
stage2/04-cleanup/00-run.sh
Executable file
5
stage2/04-cleanup/00-run.sh
Executable file
|
@ -0,0 +1,5 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
on_chroot << EOF
|
||||
apt-get clean
|
||||
EOF
|
|
@ -1,2 +0,0 @@
|
|||
# Adobe Flash Player. Copyright 1996-2015. Adobe Systems Incorporated. All Rights Reserved.
|
||||
rpi-chromium-mods rpi-chromium-mods/adobe note
|
|
@ -1,13 +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
|
||||
xpdf 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
|
|
@ -1,6 +0,0 @@
|
|||
xserver-xorg-video-fbdev xserver-xorg xinit xserver-xorg-video-fbturbo
|
||||
epiphany-browser
|
||||
lxde lxtask menu-xdg gksu
|
||||
netsurf-gtk zenity xdg-utils
|
||||
gvfs-backends gvfs-fuse
|
||||
lightdm gnome-themes-standard-data gnome-icon-theme
|
|
@ -1,8 +0,0 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
on_chroot << EOF
|
||||
update-alternatives --install /usr/bin/x-www-browser \
|
||||
x-www-browser /usr/bin/chromium-browser 86
|
||||
update-alternatives --install /usr/bin/gnome-www-browser \
|
||||
gnome-www-browser /usr/bin/chromium-browser 86
|
||||
EOF
|
|
@ -1,3 +0,0 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
rm -f ${ROOTFS_DIR}/etc/systemd/system/dhcpcd.service.d/wait.conf
|
|
@ -1,5 +0,0 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
if [ ! -d ${ROOTFS_DIR} ]; then
|
||||
copy_previous
|
||||
fi
|
|
@ -1,2 +0,0 @@
|
|||
# Enable realtime process priority?
|
||||
jackd2 jackd/tweak_rt_limits boolean true
|
|
@ -1,34 +0,0 @@
|
|||
java-common oracle-java8-jdk
|
||||
libreoffice-sdbc-hsqldb
|
||||
sonic-pi
|
||||
python idle python3-pygame python-pygame python-tk
|
||||
python3 idle3 python3-tk
|
||||
python3-pgzero
|
||||
python-serial python3-serial
|
||||
python-picamera python3-picamera
|
||||
debian-reference-en dillo x2x
|
||||
raspberrypi-net-mods raspberrypi-ui-mods
|
||||
smartsim
|
||||
python-pip python3-pip
|
||||
python3-numpy
|
||||
pypy
|
||||
minecraft-pi python-minecraftpi
|
||||
alacarte rc-gui sense-hat
|
||||
claws-mail
|
||||
tree
|
||||
scratch nuscratch
|
||||
greenfoot bluej
|
||||
nodered
|
||||
libgl1-mesa-dri libgles1-mesa libgles2-mesa xcompmgr
|
||||
geany
|
||||
piclone
|
||||
wiringpi pigpio python-pigpio python3-pigpio raspi-gpio python-gpiozero python3-gpiozero python3-rpi.gpio
|
||||
python-spidev python3-spidev
|
||||
python-twython python3-twython
|
||||
python-smbus python3-smbus
|
||||
python-flask python3-flask
|
||||
python-picraft python3-picraft
|
||||
python-sense-emu python3-sense-emu sense-emu-tools python-sense-emu-doc
|
||||
pprompt
|
||||
scratch2
|
||||
python3-thonny
|
|
@ -1,4 +0,0 @@
|
|||
libreoffice libreoffice-gtk
|
||||
timidity
|
||||
pi-package
|
||||
realvnc-vnc-server realvnc-vnc-viewer
|
|
@ -1,19 +0,0 @@
|
|||
python-automationhat python3-automationhat
|
||||
python-blinkt python3-blinkt
|
||||
python-cap1xxx python3-cap1xxx
|
||||
python-drumhat python3-drumhat
|
||||
python-envirophat python3-envirophat
|
||||
python-explorerhat python3-explorerhat
|
||||
python-fourletterphat python3-fourletterphat
|
||||
python-microdotphat python3-microdotphat
|
||||
python-mote python3-mote
|
||||
python-motephat python3-motephat
|
||||
python-phatbeat python3-phatbeat
|
||||
python-pianohat python3-pianohat
|
||||
python-piglow python3-piglow
|
||||
python-rainbowhat python3-rainbowhat
|
||||
python-scrollphat python3-scrollphat
|
||||
python-scrollphathd python3-scrollphathd
|
||||
python-sn3218 python3-sn3218
|
||||
python-skywriter python3-skywriter
|
||||
python-touchphat python3-touchphat
|
|
@ -1,3 +0,0 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
ln -sf /etc/systemd/system/autologin@.service ${ROOTFS_DIR}/etc/systemd/system/getty.target.wants/getty@tty1.service
|
|
@ -1,33 +0,0 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
HASH=`wget https://api.github.com/repos/KenT2/python-games/git/refs/heads/master -qO -| grep \"sha\" | cut -f 2 -d ':' | cut -f 2 -d \"`
|
||||
|
||||
if [ -f files/python_games.hash ]; then
|
||||
HASH_LOCAL=`cat files/python_games.hash`
|
||||
fi
|
||||
|
||||
if [ ! -e files/python_games.tar.gz ] || [ "$HASH" != "$HASH_LOCAL" ]; then
|
||||
wget "https://github.com/KenT2/python-games/tarball/master" -O files/python_games.tar.gz
|
||||
echo $HASH > files/python_games.hash
|
||||
fi
|
||||
|
||||
ln -sf pip3 ${ROOTFS_DIR}/usr/bin/pip-3.2
|
||||
|
||||
install -v -o 1000 -g 1000 -d ${ROOTFS_DIR}/home/pi/python_games
|
||||
tar xvf files/python_games.tar.gz -C ${ROOTFS_DIR}/home/pi/python_games --strip-components=1
|
||||
chown 1000:1000 ${ROOTFS_DIR}/home/pi/python_games -Rv
|
||||
chmod +x ${ROOTFS_DIR}/home/pi/python_games/launcher.sh
|
||||
|
||||
install -v -o 1000 -g 1000 -d "${ROOTFS_DIR}/home/pi/Documents"
|
||||
install -v -o 1000 -g 1000 -d "${ROOTFS_DIR}/home/pi/Documents/BlueJ Projects"
|
||||
install -v -o 1000 -g 1000 -d "${ROOTFS_DIR}/home/pi/Documents/Greenfoot Projects"
|
||||
install -v -o 1000 -g 1000 -d "${ROOTFS_DIR}/home/pi/Documents/Scratch Projects"
|
||||
rsync -a --chown=1000:1000 ${ROOTFS_DIR}/usr/share/doc/BlueJ/ "${ROOTFS_DIR}/home/pi/Documents/BlueJ Projects"
|
||||
rsync -a --chown=1000:1000 ${ROOTFS_DIR}/usr/share/doc/Greenfoot/ "${ROOTFS_DIR}/home/pi/Documents/Greenfoot Projects"
|
||||
rsync -a --chown=1000:1000 ${ROOTFS_DIR}/usr/share/scratch/Projects/Demos/ "${ROOTFS_DIR}/home/pi/Documents/Scratch Projects"
|
||||
|
||||
#Alacarte fixes
|
||||
install -v -o 1000 -g 1000 -d "${ROOTFS_DIR}/home/pi/.local"
|
||||
install -v -o 1000 -g 1000 -d "${ROOTFS_DIR}/home/pi/.local/share"
|
||||
install -v -o 1000 -g 1000 -d "${ROOTFS_DIR}/home/pi/.local/share/applications"
|
||||
install -v -o 1000 -g 1000 -d "${ROOTFS_DIR}/home/pi/.local/share/desktop-directories"
|
2
stage4/02-extras/files/.gitignore
vendored
2
stage4/02-extras/files/.gitignore
vendored
|
@ -1,2 +0,0 @@
|
|||
python_games.hash
|
||||
python_games.tar.gz
|
|
@ -1,4 +0,0 @@
|
|||
IMG_SUFFIX="-4GB"
|
||||
if [ "${USE_QEMU}" = "1" ]; then
|
||||
export IMG_SUFFIX="${IMG_SUFFIX}-qemu"
|
||||
fi
|
|
@ -1,5 +0,0 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
if [ ! -d ${ROOTFS_DIR} ]; then
|
||||
copy_previous
|
||||
fi
|
|
@ -1,2 +0,0 @@
|
|||
# Do you accept the Wolfram - Raspberry Pi® Bundle License Agreement?
|
||||
wolfram-engine shared/accepted-wolfram-eula boolean true
|
|
@ -1 +0,0 @@
|
|||
wolfram-engine
|
|
@ -1,4 +0,0 @@
|
|||
IMG_SUFFIX=""
|
||||
if [ "${USE_QEMU}" = "1" ]; then
|
||||
export IMG_SUFFIX="${IMG_SUFFIX}-qemu"
|
||||
fi
|
|
@ -1,2 +0,0 @@
|
|||
NOOBS_NAME="Raspbian"
|
||||
NOOBS_DESCRIPTION="A port of Debian Stretch for the Raspberry Pi (full desktop version)"
|
|
@ -1,5 +0,0 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
if [ ! -d ${ROOTFS_DIR} ]; then
|
||||
copy_previous
|
||||
fi
|
Loading…
Reference in New Issue
Block a user