Single

香蕉派正确吃法之编译镜像–Docker环境配置

前言

发现没有官方环境配置的教程,大概写一下,我这里以M5为例,需要一台linux电脑

安装docker

要想配置docker的环境,就得先安装Docker,安装Docker有一键安装脚本,安装命令如下:

curl -fsSL https://test.docker.com -o test-docker.sh
sudo sh test-docker.sh

安装完了需要把当前用户加到docker用户组

sudo groupadd docker
sudo usermod -aG docker $USER

运行Docker镜像

接下来就是配置docker,首先拉取镜像

docker pull sinovoip/bpi-build-linux-4.4:ubuntu16.04


创建一个文件夹,并运行镜像

mkdir /home/qubot/bpi/image
docker run -d -p 2222:22 -v /home/qubot/bpi/image:/root sinovoip/bpi-build-linux-4.4:ubuntu16.04

上面的“/home/qubot/bpi/image:/root”就是把实体机的/home/qubot/bpi/image映射到/root目录,端口是2222

运行之后,可以用docker container ls看得到已经启动的docker

然后就可以通过ssh连上这个docker了,密码是root

连接成功

可以看到,在docker里面创建文件夹,在实体机也能看到这个文件夹

编译镜像

首先拉取源码

git clone https://github.com/BPI-SINOVOIP/BPI-M5-bsp


进入到文件夹,并拉取submodule

cd BPI-M5-bsp
git submodule update --init --recursive


开始编译

./build.sh bpi-m5 1

...

然后等编译完成就行了

编译出来是这些文件

烧录官方镜像

下一步就是烧录官方镜像到SD卡中
镜像下载地址:
https://wiki.banana-pi.org/Banana_Pi_BPI-M5#Ubuntu
工具:Balena Etcher。下载地址:https://balena.io/etcher
安装完成之后打开,选择镜像,选择卡,点击烧录就行了


接下来把卡插到linux电脑中

安装bpi-tools

用下面命令安装bpi-tools

curl -sL https://github.com/BPI-SINOVOIP/bpi-tools/raw/master/bpi-tools | sudo -E bash -

注意,如果一直没反应,下面这个一样也可以

git clone https://github.com/BPI-SINOVOIP/bpi-tools
cd bpi-tools
sudo cp ./bpi* /bin/

输入lsblk命令,可以看到我这里的SD卡是/dev/sdd(注意,下面操作都是在实体机里面,docker没有映射进去,所以操作不了)

进入到实体机的代码目录

cd ~/bpi/image/BPI-M5-bsp

sudo ./build.sh bpi-m5 6
This tool support following building mode(s):
--------------------------------------------------------------------------------
        1. Build all, uboot and kernel and pack to download images.
        2. Build uboot only.
        3. Build kernel only.
        4. kernel configure.
        5. Pack the builds to target download image, this step must execute after u-boot,
           kernel and rootfs build out
        6. Update local build to SD with BPI Image flashed
        7. Clean all build.
--------------------------------------------------------------------------------
 Now building...

scripts/mk_install_sd.sh
--------------------------------------------------------------------------------
  1. M5/M2Pro
--------------------------------------------------------------------------------
Please choose a target to install(1): 1

Please type the SD device(/dev/sdX): /dev/sdd

 type will be intalled to /dev/sdd, [Y/n] y

Yes
...

暂无评论

发表评论