doc/build_arm_image.md

125 lines
4.1 KiB
Markdown
Raw Normal View History

2015-12-13 12:30:19 +01:00
# Build ARM image
This tutorial's goal is to build a plug-and-play image for YunoHost for ARM boards.
It could be used on many ARM board (Rasberry Pi, Olimex, Cubieboard…).
This tutorial is based on [Yunocubian](https://github.com/M5oul/Yunocubian).
You could find [ARM image builder from Debian Jessie](https://github.com/YunoHost/install_script/pull/36).
2016-11-04 11:25:42 +01:00
**All these steps can be executed with variations of [this script](https://github.com/likeitneverwentaway/rpi_buildbot/blob/master/build_image.sh).**
2015-12-13 12:30:19 +01:00
### Download minimal Debian Jessie
2015-12-13 12:41:00 +01:00
Download a Debian Jessie image compatible with the hardware **without desktop environnement** installed:
2015-12-13 12:30:19 +01:00
* [ARMbian](http://www.armbian.com/download/) (Olimex, Cubieboard, Banana Pi…)
* [Raspbian Jessie Lite](https://www.raspberrypi.org/downloads/raspbian/)
### Copy image and install YunoHost
<a class="btn btn-lg btn-default" href="/copy_image">Copy image to the SD card</a>
<a class="btn btn-lg btn-default" href="/plug_and_boot">Plug & boot</a>
2016-11-04 11:25:42 +01:00
* Connect via [SSH](ssh): **pi@exemple.tld/ip_address** with the password **raspberry** (or any variations for other distros than Raspbian).
* Set a root password :
```bash
sudo passwd
```
and login as root:
```bash
su
```
2015-12-13 12:30:19 +01:00
* You should be **root** for next operations.
2016-11-04 11:25:42 +01:00
<a class="btn btn-lg btn-default" href="/install_on_raspberry">Manually install YunoHost on a Raspberry Pi</a>
If you encounter problems during installation check out [this installation guide](http://avignu.wiki.tuxfamily.org/doku.php?id=documentation:yunohost-jessie) for the Raspberry Pi, based on suggestion [from this thread](https://forum.yunohost.org/t/installation-de-yunohost-2-4-sur-raspbian-jessie-minimal-sur-un-raspberry-pi-3/1597).
2015-12-13 12:30:19 +01:00
<div class="alert alert-danger">Do not proceed to **post-installation**.</div>
### Clean image
* Update image:
```bash
apt-get update && apt-get dist-upgrade && apt-get autoremove
```
* Change hostname:
```bash
2016-11-04 11:25:42 +01:00
sed -i "s/$(hostname)/YunoHost/g" /etc/hosts
sed -i "s/$(hostname)/YunoHost/g" /etc/hostname
2015-12-13 12:30:19 +01:00
```
2016-11-04 11:25:42 +01:00
* Allow SSH connection as root:
```bash
sed -i '0,/without-password/s/without-password/yes/g' /etc/ssh/sshd_config
```
* Delete the **pi** user (this step must be perform directly as root, not logged in as pi and then login as root):
```bash
deluser remove-all-files pi
```
* Set the first boot script:
2015-12-13 12:30:19 +01:00
```bash
2016-11-04 11:25:42 +01:00
wget https://raw.githubusercontent.com/likeitneverwentaway/rpi_buildbot/master/yunohost-firstboot -P /etc/init.d/
2015-12-13 12:30:19 +01:00
# Give executable right
2016-11-04 11:25:42 +01:00
chmod a+x /etc/init.d/yunohost-firstboot
2015-12-13 12:30:19 +01:00
# Make it execute at next boot
2016-11-04 11:25:42 +01:00
insserv /etc/init.d/yunohost-firstboot
2015-12-13 12:30:19 +01:00
```
2016-11-04 11:25:42 +01:00
* Set the boot promtp script:
2015-12-13 12:30:19 +01:00
```bash
2016-11-04 11:25:42 +01:00
wget https://raw.githubusercontent.com/likeitneverwentaway/rpi_buildbot/master/boot_prompt.service -P /etc/systemd/system/
wget https://raw.githubusercontent.com/likeitneverwentaway/rpi_buildbot/master/boot_prompt.sh -P /usr/bin/
chmod a+x /usr/bin/boot_prompt.sh
systemctl enable boot_prompt.service
2015-12-13 12:30:19 +01:00
```
2016-11-04 11:25:42 +01:00
* Tell the boot_prompt script that the next boot is the first boot:
```bash
touch /etc/yunohost/firstboot
```
2015-12-13 12:30:19 +01:00
* Turn off your board:
```bash
shutdown
```
2016-11-04 11:25:42 +01:00
Don't forget to reset **wpa-supplicant.conf** if you changed it. You could also delete the command history with
```bash
history -c
```
or by editing **/root/.bash_history**.
2015-12-13 12:30:19 +01:00
### Copy image
Plug your SD card on your desktop computer and copy it:
<div class="alert alert-danger">Be carefull to not erase your data.</div>
2015-12-13 12:41:00 +01:00
2015-12-13 12:30:19 +01:00
```bash
sudo dd bs=1M if=/dev/sdd of=~/yunohost-jessie-board-year-month-day.img
```
2016-11-04 11:25:42 +01:00
You can also use the **Read** function of [Win32 Disk Imager](https://sourceforge.net/projects/win32diskimager/).
2015-12-13 12:30:19 +01:00
2015-12-13 12:41:00 +01:00
### Verify image
2015-12-13 12:30:19 +01:00
<a class="btn btn-lg btn-default" href="/copy_image">Copy image to the SD card</a>
<a class="btn btn-lg btn-default" href="/plug_and_boot">Plug & boot</a>
<a class="btn btn-lg btn-default" href="/postinstall">Post-install</a>
2015-12-13 12:41:00 +01:00
<div class="alert alert-info">If everything is alright, you could publish your image.</div>
2015-12-13 12:30:19 +01:00
### Publish image
* Reduce size by zipping the image:
```bash
zip yunohost-jessie-board-year-month-day.img.zip yunohost-jessie-board-year-month-day.img
```
* Publish: you could post your image on the [forum](https://forum.yunohost.org/).