rebuild with new raspbian doc more precise.

This commit is contained in:
Sylvain 2016-05-06 07:14:26 +02:00
parent 0ea3d0c8c1
commit 181462d1ee
3 changed files with 50 additions and 25 deletions

View file

@ -1,15 +1,23 @@
#!/bin/bash
#
# Create the sdcard on your PC with the latest debian.
# Create the sdcard on your PC with the latest debian raspbian.
#
# Usage:
# ./01_create_sdcard.sh downloaded_debian_image.zip /dev/sdcard_device
# ./01_create_sdcad.sh downloaded_debian_image.zip /dev/sdcard_device
# ./01_create_sdcard.sh generated_yunohost.img /dev/sdcard_device
#
# HowTo:
# find your sdcard device:
# mount it first graphicaly
# next issue a df -h look for something "/dev/mmcblk0p1"
# create a totally new image:
# delete _build_arm_steps/ which is the cache folder.
# follows steps in README.md
#
# Status: functional
# Licence: GPLv3
# Author: sylvain303@github
# SeeAlso:
# informations about Raspbian image:
# Raspbian Jessie Lite Version: November 2015 Release date: 2015-11-21
@ -17,8 +25,11 @@
# Kernel version: 4.1
# http://downloads.raspberrypi.org/raspbian/release_notes.txt
# DOWNLOAD_URL used only for echo a message
# SHA_DEBIAN_IMG_ZIP need to be updated to match your image
DOWNLOAD_URL=https://www.raspberrypi.org/downloads/raspbian/
SHA_DEBIAN_IMG_ZIP=97888fcd9bfbbae2a359b0f1d199850852bf0104
SHA_DEBIAN_IMG_ZIP="b78bb50bdac5ec8c108f34104f788e214ac23635"
die() {
echo "$*"

View file

@ -1,18 +1,34 @@
# Build your own yunohost image for Raspberry Pi
This folder contains helper scripts to build an arm image of yunohost for raspberry.
The files here are for builder. They are not needed to install your yunohost.
The files here are for builder. They are not needed to install your yunohost, the purpose is to reproduce the .img.
Of course you can try the step exlained here, and you will get a fresh yunohost at the end.
The folder etc/ structure maps debian OS folders, shell script here are helpers.
Files in etc/ subfolders will be copied on the sdcard when installation is finished.
Those scripts are following the steps provided here: https://yunohost.org/#/build_arm_image
### Notes:
`01_create_sdcard.sh` can be used to copy raspbian image to a sdcard and stop here, without yunohost.
An ssh key is added to remote access pi@raspbian account without passphrase.
Ex:
```
ssh -i _build_arm_steps/nopasskey pi@DHCP_IP
```
Don't forget to at first: `sudo raspbi-config` + enlarge file-system to have full size sdcard for your raspberry.
(also accomplished by: `sudo raspi-config --expand-rootfs`)
Enjoy.
## License
All the content here is distributed under [GPLv3](http://www.gnu.org/licenses/gpl-3.0.txt).
## See also
* https://forum.yunohost.org/t/building-a-new-image-for-raspberry-debian-jessie-fr-en/1101/13 - discussion about building a new image for Raspberry Pi.
* http://build.yunohost.org/ - some build here
## Files
@ -20,7 +36,7 @@ Description of the files available here.
All step stripts are using your PC to store some files in the folder `_build_arm_steps/`. This folder will be created by `01_create_sdcard.sh`. You can wipe it, or remove selected script data form it, to redo a step.
All step scripts are designed to run in this folder:
All step scripts are designed to run in this folder on your PC:
~~~bash
git clone this_repos
@ -39,8 +55,11 @@ Scripts are prefixed by a number which is the order they must be ran.
#### 01_create_sdcard.sh
Create a bootable image for raspbian. You have to download the .zip of the raspbian image.
This script embeds sudo call for using dd to copy the raw image to the sdcard.
It will add an ssh key to pi default rasbian user in oder to connect later to continue automated installation. The pi user will be removed at the end (See #4). The ssh key-pair is generated only for you.
([See:](https://www.raspberrypi.org/downloads/raspbian/)
This script embeds sudo call for using `dd` to copy the raw image to the sdcard.
It will add an ssh key to `pi` default rasbian user in order to connect later to continue automated installation (See `02_install_yunohost.sh`)
The pi user will be removed at the end (Not yet, See #4). The ssh key-pair is generated only for you, in `_build_arm_steps/`
Usage:
@ -50,15 +69,17 @@ Usage:
It takes some minutes to perform all the steps (~ 2m3.867s at last run). Be patient.
Use `df` or `lsblk` to find the name of your sdcard device. The script is taking care of umonting the partition if any. It also guesses the disk's name if you gave a partition's name instead of entire disk device's name.
Use commend like `df` or `lsblk` to find the name of your sdcard device. The script is taking care of umonting the partition if any.
It also guesses the disk's name if you gave a partition's name instead of entire disk device's name. i
(ex: /dev/mmcblk0p2 --> /dev/mmcblk0)
BE CAREFULL not to wipe the wrong device!
#### 02_install_yunohost.sh
Should I say you have to plug the new sdcard freshly created and boot the Raspberry PI pluged on the same network as your PC?
Should I say: you have to plug the new sdcard freshly created and boot the Raspberry PI pluged on the same network as your PC?
The Raspberry has hopefully booted and is displaying a console's prompt:
The Raspberry has hopefully booted and is displaying a console's prompt, which looks like:
~~~
Raspbian GNU/Linux 8 raspberrypi tty1
@ -74,15 +95,16 @@ My IP address is 192.168.1.123
Or what ever your DHCP is giving…
Run:
Run (on the PC, not the raspberry):
~~~bash
./02_install_yunohost.sh 192.168.1.123
~~~
This step is quite long. It took ~24min on my Raspberry. Be patient, A message will be displayed on the screen to explain how you can watch it if you want.
This step is quite long. It took ~24min on my Raspberry. Be patient.
A message will be displayed on the screen to explain how you can watch it if you want.
If you got ssh `Host key verification failed.`, fix it then:
If you got ssh `Host key verification failed.`, to fix it then:
~~~bash
rm _build_arm_steps/yuno_step*
@ -92,20 +114,21 @@ rm _build_arm_steps/yuno_step*
#### 03_copy_sdcard_to_img.sh
When the build is finished the Raspberry will shutdown. Unplug and insert the sdcard back in the computer.
When the build is finished, the Raspberry will shutdown. Unplug and insert the sdcard back in the computer.
~~~bash
./03_copy_sdcard_to_img.sh /dev/sdcard_device
~~~
This will ask your sudo password and dd the resulting img from the sdcard back to your PC. Stored in `_build_arm_steps/` folder. It takes arround 6min on my PC to copy an sdcard of 8G.
This will ask your sudo password and `dd` the resulting img from the sdcard back to your PC.
Stored in `_build_arm_steps/` folder. It takes arround 6min on my PC to copy an sdcard of 8G.
The image will be automaticly shrinked to its minimal size using autosizer.sh.
#### test the image back
You can test the resutling image back with `01_create_sdcard.sh`.
You can test the resutling image back again with `01_create_sdcard.sh`.
~~~bash
./01_create_sdcard.sh _build_arm_steps/newly_created_image.img /dev/sdcard_device

View file

@ -1,9 +0,0 @@
#!/bin/bash
# complete install with some specific ARM (raspberry) scripts.
#
# to be run for building an SD card image.
#
cp etc/init.d/yunohost-firstboot /etc/init.d/
chmod a+x /etc/init.d/yunohost-firstboot
insserv /etc/init.d/yunohost-firstboot