add missing prerequiste packagesin Dockerfile

Signed-off-by: Michel-FK <michel.stempin@funkey-project.com>
This commit is contained in:
Michel-FK 2020-11-18 23:06:43 +01:00
parent b622483707
commit 3d548c3906
5 changed files with 154 additions and 92 deletions

185
README.md
View File

@ -1,61 +1,172 @@
# FunKey
Intro
=====
# FunKey-OS
This directory contains a buildroot-based external configuration for
building the FunKey.
## Intro
This repository contains all the sources required to build FunKey-OS, the Open-Source firmware at the heart of the [FunKey S retro-gaming console](https://www.funkey-project.com/).
How to get it
===============
As the FunKey-S console is based on a sophisticated [Allwinner V3s ARM Cortex-A7 1.2GHz CPU](http://www.allwinnertech.com/index.php?c=product&a=index&id=38), an Operating System is mandatory in order to access all the hardware resources without re-inventing the wheel.
Clone the FunKey OS repository from Github:
FunKey-OS is based on Linux, and is built from scratch using the [buildroot](http://nightly.buildroot.org/) tool that simplifies and automates the process of building a complete Linux system for an embedded system like this.
$ git clone https://github.com/FunKey-Project/FunKey-OS.git <Funkey directory>
Technically, Funkey-OS is a [buildroot (v2) based external tree](https://buildroot.org/downloads/manual/manual.html#outside-br-custom) for building the bootloader, the Linux kernel and user utilities, as well as the optimized retro-game launcher and console emulators.
## Build host requirements
Even if the resulting disk image and firmware update files are relatively small (202 MB and 55MB, respectively), the size of the corresponding sources and the compilation by-products tend to be rather large, such that an available disk space of at least 12GB is required during the build.
And even if the resulting FunKey-OS boots in less than 5s, it still requires a considerable amount of time to compile: please account for 1 1/2 hour on a modern multi-core CPU with SSD drives and a decent Internet bandwidth.
As the target CPU is probably different from the one running on your build host machine, a process known as [_cross-compilation_](https://en.wikipedia.org/wiki/Cross_compiler) is required for the build, and as the target system will eventually be Linux, this is much better handled on hosts running a Linux-based operating system too.
As a matter of fact, the FunKey-OS is meant to be built on a native Ubuntu or Debian Linux host machine (Ubuntu 20.04 LTS in our case, but this should also work with other versions, too). And with only a few changes to the prerequisites, it can certainly be adapted to build on other common Linux distros.
However, if your development machine does not match this setup, there are still several available solutions:
- use a lightweight container system such as [Docker](https://www.docker.com/) and run an Ubuntu or Debian Linux container in it
- use a VM (Virtual Machine) , such as provided by [VirtualBox](https://www.virtualbox.org/) and run an Ubuntu or Debian Linux in it
- for Windows 10 users, use the [WSL2](https://docs.microsoft.com/en-us/windows/wsl/install-win10) (Windows System for Linux 2) subsystem and run an Ubuntu Linux distro in it
In order to install one of these virtualized environments on your machine, please refer to the corresponding documentation.
## Build on a Physical/Virtual Machine
### Prerequisites
While Buildroot itself will build most host packages it needs for the compilation, some standard Linux utilities are expected to be already installed on the host system. If not already present, you will need to install the following packages beforehand:
- bash
- bc
- binutils
- build-essential
- bzip2
- ca-certificates
- cpio
- cvs
- expect
- file
- g++
- gcc
- git
- gzip
- liblscp-dev
- libncurses5-dev
- locales
- make
- mercurial
- openssh-client
- patch
- perl
- procps
- python
- python-dev
- python3
- python3-dev
- python3-distutils
- python3-setuptools
- rsync
- rsync
- sed
- subversion
- sudo
- tar
- unzip
- wget
- which
- xxd
On Ubuntu/Debian Linux, this is achieved by running the following command:
```bash
$ sudo apt install bash bc binutils build-essential bzip2 ca-certificates cpio cvs expect file g++ gcc git gzip liblscp-dev libncurses5-dev locales make mercurial openssh-client patch perl procps python python-dev python3 python3-dev python3-distutils python3-setuptools rsync rsync sed subversion sudo tar unzip wget which xxd
```
### How to get the sources
When using either physical or virtual Linux machines, you must clone the FunKey OS repository from Github:
```bash
$ git clone https://github.com/FunKey-Project/FunKey-OS.git <FunKey directory>
```
Then enter into the created directory:
$ cd <Funkey directory>
How to build it
===============
Build the disk image & firmware update files
--------------------------------------------
Note: you will need to have access to the network, since buildroot
will download the packages' sources.
```bash
$ cd <FunKey directory>
```
### Build the disk image & firmware update files
You may now build your FunKey with:
$ make
```bash
$ make
```
This may take a while, consider getting yourself a cup or glass of your favorite beverage ;-)
(This may take a while, consider getting yourself a coffee ;-) )
<ins>Note</ins>: you will need to have access to the network, since buildroot will download the package sources.
Result of the build
-------------------
### Result of the build
After building, you should obtain the SD Card image `sdcard.img` and the firmware update file `FunKey-rootfs-X.Y.fwu` in the `image` directory.
After building, you should obtain this tree:
## Build in a container
images/
+-- FunKey-rootfs-X.Y.fwu
`-- sdcard.img
### Prerequisites
When using a Docker container, all the prerequisites are automatically installed.
How to write the SD card
========================
### How to get the sources
When using a Docker container, you must first get the FunKey-OS [Dockerfile](https://raw.githubusercontent.com/Michel-FK/FunKey-Project/master/docker/Dockerfile) and Debian [apt-sources.list](https://raw.githubusercontent.com/Michel-FK/FunKey-Project/master/docker/apt-sources.list) and put them into a separate directory:
Once the build process is finished you will have an image called
"sdcard.img" in the images/ directory.
```bash
$ mkdir <FunKey directory>
$ cd <FunKey directory>
$ wget https://raw.githubusercontent.com/FunKey-Project/FunKey-OS/master/docker/Dockerfile
$ wget https://raw.githubusercontent.com/FunKey-Project/FunKey-OS/master/docker/apt-sources.list
```
You must then build the docker image (don't forget the final dot!):
```bash
$ docker build -t funkey-project/funkey-os .
```
Copy the bootable "sdcard.img" onto an SD card with "dd":
You are now ready to run interactively a new container based on this docker image:
```bash
$ docker run -d -it --name funkey-os funkey-project/funkey-os
```
You can then clone the FunKey OS repository from Github in this brand new container:
$ sudo dd if=<Funkey directory>/images/sdcard.img of=/dev/sdX
```bash
$ git clone https://github.com/FunKey-Project/FunKey-OS.git <FunKey directory>
```
Then enter into the created directory:
Alternatively, you can use the Etcher graphical tool to burn the image
```bash
$ cd <FunKey directory>
```
### Build the disk image & firmware update files
You may now build your FunKey with:
```bash
$ make
```
This may take a while, consider getting yourself a cup or glass of your favorite beverage ;-)
<ins>Note</ins>: you will need to have access to the network, since buildroot will download the package sources.
### Result of the build
After building, you can exit the container by typing Ctrl+D.
You can copy the SD Card image `sdcard.img` and the firmware update file `FunKey-rootfs-X.Y.fwu` from the container into the host current directory:
```bash
$ docker cp funkey-os:/home/funkey/<FunKey directory>/images/sdcard.img ./
$ docker cp funkey-os:/home/funkey/<FunKey directory>/images/FunKey-rootfs-X.Y.fwu ./
```
## How to write to the SD card
You can copy the bootable "sdcard.img" onto an SD card using "dd":
```bash
$ sudo dd if=sdcard.img of=/dev/sdX
```
<ins>Warning</ins>: Please make sure that */dev/sdX* device corresponds to your SD Card, otherwise you may wipe out one of your hard drive partitions!
Alternatively, you can use the Balena-Etcher graphical tool to burn the image
to the SD card safely and on any platform:
https://etcher.io/
https://www.balena.io/etcher/
Once the SD card is burned, insert it into your FunKey board, and
Once the SD card is burnt, insert it into your FunKey S console slot, and
power it up. Your new system should come up now and start a console on
the UART0 serial port.
the UART0 serial port and display the retro game launcher on the graphical screen.

View File

@ -39,6 +39,8 @@ RUN \
wget \
# OPTIONAL recommended dependencies
python \
python-dev \
xxd \
# OPTIONAL configuration interface dependencies
libncurses5-dev \
#libqt5-dev \
@ -58,7 +60,10 @@ RUN \
# OPTIONAL documentation generation tools
#asciidoc \
#w3m \
#python3 \
python3 \
python3-dev \
python3-distutils \
python3-setuptools \
#dblatex \
# OPTIONAL graph generation tools
#graphviz \

View File

@ -1,36 +0,0 @@
Installer Docker si pas déjà fait
Avoir 11.4GB de libre sur le disque (!)
Décompresser le ZIP et lancer une CLI dans le répertoire "FunKey-OS-docker" résultant
Construire l'image Docker (attention au "." final) :
docker build -t funkey-project/funkey-os .
Lancer le container :
docker run -d -it --name funkey-os funkey-project/funkey-os
En attendant d'être publics, pour pouvoir accéder à nos repositories privés sur Github, il faut configurer SSH correctement dans le container :
docker exec funkey-os mkdir .ssh
for i in id_rsa_funkey* config known_hosts; do docker cp $i funkey-os:/home/funkey/.ssh/;done
Se rattacher au container qui tourne :
docker attach funkey-os
Cloner notre repository FunKey-OS :
git clone --recurse-submodules git@fk:FunKey-Project/FunKey-OS.git
Là, il faut lancer les commandes habituelles pour compiler FunKey-OS :
cd FunKey-OS
./fun funkey_defconfig
./have fun
Et au bout d'1h47 (contre 10 min sur ma machine non virtuelle avec ccache...) la compilation est enfin terminée (Ctrl-P + Ctrl-Q pour sortir du container sans le stopper) et tu peux récupérer l'image de la carte SD sur la machine hôte :
docker cp funkey-os:/home/funkey/FunKey-OS/FunKey/output/images/sdcard.img ./

View File

@ -1,13 +0,0 @@
Host FunKey
hostname FunKey
User root
Host funkey
hostname funkey
User root
Host fk
HostName github.com
User Michel-FK
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa_funkey

View File

@ -1,5 +0,0 @@
|1|BuNvANzfO2zw1w0eg8eyiJLbhgY=|24taKCdTsqHCi0/2Mwc1UxSHxog= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBJ9WoqmYiRDqcgZbhuvCJOdAaCJ9mPXeg3rnJxfKL078Lr+aTKyANT8l5wGu3UX03zDzUm7MJNwfAWv3XPXHmp0=
|1|dwNzOK8zDIRKu45XvdfbpHJ3BC0=|iRQPqlaZndUL42KXy6kyLwOlap8= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBJ9WoqmYiRDqcgZbhuvCJOdAaCJ9mPXeg3rnJxfKL078Lr+aTKyANT8l5wGu3UX03zDzUm7MJNwfAWv3XPXHmp0=
|1|muZDgtm4oU973IiPGnq/FYcbLt8=|FtWXsc8ImVkAvOItIus22Xwv/Os= ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==
|1|z7hn4DtxvaTRp6fP1ww9R4D4HgY=|K41cgRW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