md
Créer une image personnalisée d'Armbian
2019-01-24
<- --

Dernièrement, j'expérimente beaucoup avec la nouvelle version de Raspbian Stretch Lite, essayant différentes configurations et logiciels. Pour vérifier que tout fonctionne, je préfère revenir au système d'exploitation tel qu'obtenu de la Fondation Raspberry. Chaque fois que l'image est copiée sur la carte SD, il faut modifier la partition /boot pour pouvoir démarrer le Raspberry Pi sans clavier ni moniteur. Puis il faut mettre à jour le système d'exploitation. Tout ceci prend du temps. Alors j'ai décidé de créer une image binaire qui permet d'éviter ces étapes.

Table des matières

  1. Copier Stretch sur une carte SD
  2. Configuration étêtée
  3. Empêcher l'expansion automatique du système de fichiers
  4. Mise à jour de Stretch
  5. Sauvegarder l'image modifiée
  6. Accroître la taille de la partition root
  7. Utilisation

Copier Stretch sur une carte SD toc

Comme auparavant, j'ai téléchargé la plus récente version Lite de Raspbian :

  Raspbian Stretch Lite
  Minimal image based on Debian Stretch
  Version: November 2018
  Release date: 2018-11-13
  Kernel version: 4.14

On la trouve à l'URL suivant :https://www.raspberrypi.org/downloads/raspbian/. J'ai suivi les instructions Installing operating system images pour copier l'image vers une carte micro-SD en utilisant le logiciel Balena Etcher.

L'image de la Fondation Raspberry est déjà vieille de deux mois, alors il y a des mises à jour qu'il faudra ajouter un peu plus loin.

Configuration étêtée toc

The initial boot and configuration of the Orange Pi Zero is done with the serial connection.

U-Boot SPL 2018.05-armbian (Jan 09 2019 - 22:27:17 +0100) DRAM: 512 MiB Trying to boot from MMC1 U-Boot 2018.05-armbian (Jan 09 2019 - 22:27:17 +0100) Allwinner Technology CPU: Allwinner H3 (SUN8I 1680) Model: Xunlong Orange Pi Zero DRAM: 512 MiB MMC: SUNXI SD/MMC: 0 Loading Environment from EXT4... ** File not found /boot/boot.env ** .... Debian GNU/Linux 9 orangepizero ttyS0 orangepizero login: root Password: 1234 You are required to change your password immediately (root enforced) Changing password for root. (current) UNIX password: 1234 Enter new UNIX password: xxxxyyyy Retype new UNIX password: xxxxyyyy ___ ____ _ _____ / _ \ _ __ __ _ _ __ __ _ ___ | _ \(_) |__ /___ _ __ ___ | | | | '__/ _` | '_ \ / _` |/ _ \ | |_) | | / // _ \ '__/ _ | |_| | | | (_| | | | | (_| | __/ | __/| | / /| __/ | | (_) | \___/|_| \__,_|_| |_|\__, |\___| |_| |_| /____\___|_| \___/ |___/ Welcome to ARMBIAN 5.69 stable Debian GNU/Linux 9 (stretch) 4.19.13-sunxi System load: 0.11 0.26 0.15 Up time: 4 min Memory usage: 11 % of 493MB IP: CPU temp: 38°C Usage of /: 6% of 15G [ General system configuration (beta): armbian-config ] New to Armbian? Check the documentation first: https://docs.armbian.com Thank you for choosing Armbian! Support: www.armbian.com Creating a new user account. Press to abort Please provide a username (eg. your forename): zero Trying to add user zero Adding user `zero' ... Adding new group `zero' (1000) ... Adding new user `zero' (1000) with group `zero' ... Creating home directory `/home/zero' ... Copying files from `/etc/skel' ... Enter new UNIX password: xxxyyy Retype new UNIX password: xxxyyy passwd: password updated successfully Changing the user information for zero Enter the new value, or press ENTER for the default Full Name []: Room Number []: Work Phone []: Home Phone []: Other []: Is the information correct? [Y/n] y Dear zero, your account zero has been created and is sudo enabled. Please use this account for your daily work from now on.

While still being root, minimal configuration is undertaken.

root@orangepizero:~# armbian-config Warning. Configurator can't work properly without internet connection. Press CTRL C to stop to stop or any key to ignore and continue. k ────────────────────────────────────────────────────────────────────────────── Configuration utility, Armbian 5.69 stable ────────────────────────────────────────────────────────────────────────────── ┌─────────────────────────── armbian-config ──────────────────────────────┐ │ │ │ Configure Debian stretch based Armbian for the Orange Pi Zero │ │ │ │ Support: https://forum.armbian.com │ │ │ │ ┌─────────────────────────────────────────────────────────────────────┐ │ │ │ System System and security settings │ │ │ │ Network Wired, wireless, Bluetooth, access point │ │ │ │ Personal Timezone, language, hostname │ │ │ │ Software System and 3rd party software install │ │ │ │ Help Documentation, support, sources │ │ │ └─────────────────────────────────────────────────────────────────────┘ │ ├─────────────────────────────────────────────────────────────────────────┤ │ < OK > <Cancel> │ └─────────────────────────────────────────────────────────────────────────┘

In the main screen show above, use the cursor keys to highlight Network, then press Tab to get to the < OK > button and press the space bar or the Enter key go on to configure the wireless network interface.

┌──────Select default interface────────┐ │ ┌──────────────────────────────────┐ │ │ │ eth0 │ │ │ │ wlan0 │ │ │ └──────────────────────────────────┘ │ ├──────────────────────────────────────┤ │ < OK > │ └──────────────────────────────────────┘

Use the cursor keys to highlight wlan0, then press Tab to get to the < OK > button and press the space bar or the Enter key to go on.

Use the arrow key to highlight wlan0, then tabbed to < OK > and pressed the space bar or Enter key ┌────────────── Wired, Wireless, Bluetooth, Hotspot ─────────────────┐───── │ │ │ IP (wlan0) via Network Manager: │ │ │ │ Note: This tool can be successful only when drivers are in good │ │ shape. If autodetection fails, you are on your own. │ │ │ │ ┌────────────────────────────────────────────────────────────────┐ │ │ │ IP Select dynamic or edit static IP address │ │ │ │ Hotspot Create WiFi access point │ │ │ │ IPV6 Disable IPV6 for APT and system │ │ │ │ Iperf3 Enable network throughput tests daemon │ │ │ │ WiFi Manage wireless networking │ │ │ │ IR Install IR support │ │ │ │ BT install Install Bluetooth support │ │ │ │ Advanced Edit /etc/network/interfaces │ │ │ └────────────────────────────────────────────────────────────────┘ │ ├────────────────────────────────────────────────────────────────────┤ │ < OK > <Cancel> │ └────────────────────────────────────────────────────────────────────┘ ┌───────────────────────────────────────────────┐ │ │ │ ┌──────────────────────────────┐ │ │ │ Wired ↑ │ <Activate> │ │ │ Wired connection 1 ▒ │ │ │ │ ▒ │ │ │ │ Wi-Fi ▒ │ │ │ │ COROBRUN-2 *** ▒ │ │ │ │ ▒ │ │ │ │ ▒ │ │ │ │ ▒ │ │ │ │ ▒ │ │ │ │ ▒ │ │ │ │ ▒ │ │ │ │ ▒ │ │ │ │ ▒ │ │ │ │ ▒ │ │ │ │ ▮ │ │ │ │ ↓ │ <Quit> │ │ └──────────────────────────────┘ │ │ │ └───────────────────────────────────────────────┘ ┌───────┤ Authentication required by wireless network ├────────┐ │ │ │ Passwords or encryption keys are required to access the │ │ wireless network 'COROBRUN-2'. │ │ │ │ Password ______________________________ │ │ │ │ <Cancel> <OK> │ │ │ └──────────────────────────────────────────────────────────────┘ Press OK, the Authentication window will close and a connection will be attempted. Once the Connecting... pop-up is no longer displayed, select the network again and click on Activate to see a * appear to the left of the name. Then press Quit Choose IPV6 Disable IPV6 for APT and system and tab to OK Press <Cancel>, to return to the main armbian-config menu and select Personal to change the timezone. Press <Cancel> <Cancel> etc to backout of the configuration. And check that the wireless interface is up. This is a good time to update all packages.

root@orangepizero:~# ifconfig wlan0 wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.0.136 netmask 255.255.255.0 broadcast 192.168.0.255 ... root@orangepizero:~# apt update && apt upgrade -y

On January 30, 2019, a total of 22 packages were updated which require downloading 35.4MB from the archives.

root@orangepizero:~# apt-cache policy avahi-daemon avahi-daemon: Installed: (none) Candidate: 0.6.32-2 Version table: 0.6.32-2 500 500 http://httpredir.debian.org/debian stretch/main armhf Packages root@orangepizero:~# apt install -y avahi-daemon ... root@orangepizero:~# nano /etc/sudoers
... # Allow members of group sudo to execute any command %sudo ALL=(ALL:ALL) ALL zero ALL=(ALL:ALL) NOPASSWD: ALL # See sudoers(5) for more information on "#include" directives: #includedir /etc/sudoers.d root@orangepizero:~# shutdown now Green LED goes off!
GParted on main computer right click on the ext4 partition and select unmount in the menu. Gparted will again read the information, key icon will not be visible. Select the ext4 partition again, and click on the resize icon ->| Select 2044 MiB for the partition size (with the 4 MiB non allocated this will make for a 2GiB image exactly and 826.73 MiB free Click on apply button and let Gparted do its thing. ======================

Pour pouvoir démarrer le Raspberry Pi sans y brancher un moniteur et un clavier il faut autoriser les sessions ssh. De plus, il est plus pratique d'utiliser une connexion sans fil ce qui implique qu'il faut inscrire les coordonnées du Wi-Fi dans l'image.

Cela peut être fait avec un ordinateur de bureau sous Linux, Windows and probablement Mac OS X car cela implique des modifications de la partition boot l'image SD qui utilise le format FAT32 reconnu par la plupart des systèmes d'exploitation.

  1. Activer ssh. On active les sessions ssh en créant un fichier nommé ssh dans la partition boot qu'importe sa taille et son contenu. Il peut donc être vide.
    michel@hp:~$ cd /media/michel/boot michel@hp:/media/michel/boot$ touch ssh michel@hp:/media/michel/boot$ ls -l ssh just checking -rw-r--r-- 1 michel michel 0 jan 3 11:04 ssh
  2. Créez le fichier de configuration wpa_supplicant avec les informations d'identification Wi-Fi. J'ai utilisé nano à partir de la ligne de commande, mais tout éditeur de texte tel comme Geany pourrait sans doute être utilisé. Le fichier, wpa_supplicant.conf, va dans la partition boot à côté du fichier ssh créé à l’étape précédente. Il faut bien sûr ajuster les informations d'identification du réseau.
    michel@hp:/media/michel/boot$ nano wpa_supplicant.conf
    country=ca <<-- 2 code de lettres identifiant le pays update_config=1 ctrl_interface=/var/run/wpa_supplicant network={ scan_ssid=1 ssid="wifi_network_name" psk="wifi_password" }

Save the image toc

The partition should not be mounted, but if it is then unmount it as shown below and then save it.

michel@hp:~/Téléchargements/OS/Armbian$ df -h Sys. de fichiers Taille Utilisé Dispo Uti% Monté sur udev 5,9G 0 5,9G 0% /dev ... /dev/sde1 2,0G 931M 1015M 48% /media/michel/9cecf84e-027e-40ad-b711-ae5d323d9043 michel@hp:~/Téléchargements/OS/Armbian$ sudo umount /dev/sde1 michel@hp:~/Téléchargements/OS/Armbian$ sudo dd bs=4M count=512 if=/dev/sde of=armbian_2019-01-30.img

Utilisation toc

It takes a very long time for Orange Pi Zero to boot. Be patient.

michel@hp:~$ ssh zero@orangepizero.local zero@orangepizero.local's password: xxxxyyyy ___ ____ _ _____ / _ \ _ __ __ _ _ __ __ _ ___ | _ \(_) |__ /___ _ __ ___ | | | | '__/ _` | '_ \ / _` |/ _ \ | |_) | | / // _ \ '__/ _ \ | |_| | | | (_| | | | | (_| | __/ | __/| | / /| __/ | | (_) | \___/|_| \__,_|_| |_|\__, |\___| |_| |_| /____\___|_| \___/ |___/ Welcome to ARMBIAN 5.73 stable Debian GNU/Linux 9 (stretch) 4.19.17-sunxi System load: 0.18 0.11 0.07 Up time: 8 min Memory usage: 12 % of 493MB IP: 192.168.0.136 CPU temp: 42°C Usage of /: 48% of 2.0G [ General system configuration (beta): armbian-config ] New to Armbian? Check the documentation first: https://docs.armbian.com change hostname to opi zero@orangepizero:~$ sudo reboot Connection to orangepizero.local closed by remote host. Connection to orangepizero.local closed. michel@hp:~$ ssh zero@opi.local zero@opi.local's password: ___ ____ _ _____ / _ \ _ __ __ _ _ __ __ _ ___ | _ \(_) |__ /___ _ __ ___ | | | | '__/ _` | '_ \ / _` |/ _ \ | |_) | | / // _ \ '__/ _ \ | |_| | | | (_| | | | | (_| | __/ | __/| | / /| __/ | | (_) | \___/|_| \__,_|_| |_|\__, |\___| |_| |_| /____\___|_| \___/ |___/ Welcome to ARMBIAN 5.73 stable Debian GNU/Linux 9 (stretch) 4.19.17-sunxi System load: 1.27 0.30 0.10 Up time: 0 min Memory usage: 12 % of 493MB IP: 192.168.0.136 CPU temp: 46°C Usage of /: 48% of 2.0G Last login: Wed Jan 30 22:26:00 2019 from 192.168.0.126 zero@opi:~$
<- --