|
| 1 | +--- |
| 2 | +layout: post |
| 3 | +title: "LinuxLab 真板开发:编译 qemu-arm-mcimx6ul-evk" |
| 4 | +author: iosdevlog |
| 5 | +date: 2020-12-25 18:53:14 +0800 |
| 6 | +description: "" |
| 7 | +cover-img: /assets/images/LinuxLab/IMX6ULL/error.png |
| 8 | +category: |
| 9 | +tags: [LinuxLab, IMX6ULL] |
| 10 | +--- |
| 11 | + |
| 12 | +## Ubuntu 18.04 VirtualBox |
| 13 | + |
| 14 | +### 运行 qemu-arm-mcimx6ul-evk |
| 15 | + |
| 16 | +```bash |
| 17 | +git clone https://gitee.com/tinylab/qemu-arm-mcimx6ul-evk |
| 18 | +cd qemu-arm-mcimx6ul-evk/ |
| 19 | +sudo apt install make gcc-arm-linux-gnueabihf gcc bison flex libssl-dev dpkg-dev lzop |
| 20 | +sudo apt install libsdl2-image-dev -y |
| 21 | +sudo vim /etc/apt/sources.list |
| 22 | +# deb http://cz.archive.ubuntu.com/ubuntu xenial main |
| 23 | +sudo apt update |
| 24 | +sudo apt install libpng12-0 -y |
| 25 | +``` |
| 26 | + |
| 27 | +./boot.sh |
| 28 | + |
| 29 | +```bash |
| 30 | +linux-lab login: root |
| 31 | +[ 36.390412] usb_otg1_vbus: disabling |
| 32 | +# uname -a |
| 33 | +Linux linux-lab 5.4.0-dirty #1 SMP Wed Apr 8 23:55:27 CST 2020 armv7l GNU/Linux |
| 34 | +# poweroff |
| 35 | +``` |
| 36 | + |
| 37 | +### 编译内核 |
| 38 | + |
| 39 | +[https://github.com/Embedfire/ebf_linux_kernel](https://github.com/Embedfire/ebf_linux_kernel) |
| 40 | + |
| 41 | +## LinuxLab Ubuntu 20.04 (macOS Big Sur 11.1) |
| 42 | + |
| 43 | +[泰晓科技/Linux Lab](https://gitee.com/tinylab/linux-lab) |
| 44 | + |
| 45 | +```bash |
| 46 | +sudo useradd --create-home --shell /bin/bash --user-group --groups adm,sudo iosdevlog |
| 47 | +sudo passwd iosdevlog |
| 48 | +sudo -su iosdevlog |
| 49 | +whoami |
| 50 | +# iosdevlog |
| 51 | +``` |
| 52 | + |
| 53 | +### 下载 LinuxLab |
| 54 | + |
| 55 | +```bash |
| 56 | +git clone https://gitee.com/tinylab/cloud-lab.git |
| 57 | +cd cloud-lab/ && tools/docker/choose linux-lab |
| 58 | +``` |
| 59 | + |
| 60 | +### 运行 LinuxLab |
| 61 | + |
| 62 | +```bash |
| 63 | +tools/docker/run linux-lab |
| 64 | +tools/docker/bash |
| 65 | +``` |
| 66 | + |
| 67 | +### IMX6ULL + 野火 Patch |
| 68 | + |
| 69 | +```bash |
| 70 | +make list | grep imx6ul |
| 71 | +# [ arm/mcimx6ul-evk ]: |
| 72 | +make BOARD=mcimx6ul-evk |
| 73 | +make boot |
| 74 | +``` |
| 75 | + |
| 76 | +### LinuxLab 开发 Linux (真板还不支持以下操作) |
| 77 | + |
| 78 | +```bash |
| 79 | +make kernel-download |
| 80 | +make kernel-checkout |
| 81 | +make kernel-patch |
| 82 | +make kernel-defconfig |
| 83 | +make kernel-menuconfig |
| 84 | +make kernel |
| 85 | +make boot |
| 86 | +``` |
| 87 | + |
| 88 | +### Linux Kernel 手动编译 |
| 89 | + |
| 90 | +链接: [https://pan.baidu.com/s/1AZHdBMnB63zLbZjbsa73xg](https://pan.baidu.com/s/1AZHdBMnB63zLbZjbsa73xg) 密码: csnu |
| 91 | + |
| 92 | +```bash |
| 93 | +# 下载 Linux 源码 |
| 94 | +make kernel-download |
| 95 | +cd /labs/linux-lab/src/patch/linux |
| 96 | +# 解压patch补丁 |
| 97 | +tar xzvf ebf_6ull_patch.v4.19.35.tar.gz |
| 98 | +ls v4.19.35 | wc |
| 99 | +# 5194 5194 321387 |
| 100 | +# 进入 linux stable 内核目录 |
| 101 | +cd /labs/linux-lab/src/linux-stable |
| 102 | +# 检出 linux stable 4.19.35 标签 |
| 103 | +git checkout v4.19.35 |
| 104 | +# 打补丁 |
| 105 | +git am /labs/linux-lab/src/patch/linux/v4.19.35/*.patch |
| 106 | +# Applying: MLK-11265-10 ARM: configs: add imx v7 support |
| 107 | +# Applying: MLK-11265-1 ARM: dts: add imx7d soc dtsi support |
| 108 | +# ... |
| 109 | +# 基本 1 秒 1 个补丁,可能要等 1 个多小时 |
| 110 | +``` |
| 111 | + |
| 112 | + |
| 113 | + |
| 114 | +2 个 多小时后终于好了。 |
| 115 | + |
| 116 | + |
| 117 | + |
| 118 | +添加 `sdma-imx6q.bin` |
| 119 | + |
| 120 | +```bash |
| 121 | +cp sdma-imx6q.bin firmware/sdma-imx6q.bin |
| 122 | +git add -f . |
| 123 | +git commit -m "sdma-imx6q.bin" |
| 124 | +``` |
| 125 | + |
| 126 | + |
| 127 | + |
| 128 | +编译内核前建议先安装以下工具 |
| 129 | + |
| 130 | +```bash |
| 131 | +sudo apt install make gcc-arm-linux-gnueabihf gcc bison flex libssl-dev dpkg-dev lzop |
| 132 | +# 报错,编辑 /etc/apt/sources.list |
| 133 | +sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak |
| 134 | +sudo vi /etc/apt/sources.list |
| 135 | +``` |
| 136 | + |
| 137 | +ubuntu 20.04 官方源 |
| 138 | + |
| 139 | +```bash |
| 140 | +# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to |
| 141 | +# newer versions of the distribution. |
| 142 | +deb http://archive.ubuntu.com/ubuntu focal main restricted |
| 143 | +# deb-src http://archive.ubuntu.com/ubuntu focal main restricted |
| 144 | + |
| 145 | +## Major bug fix updates produced after the final release of the |
| 146 | +## distribution. |
| 147 | +deb http://archive.ubuntu.com/ubuntu focal-updates main restricted |
| 148 | +# deb-src http://archive.ubuntu.com/ubuntu focal-updates main restricted |
| 149 | + |
| 150 | +## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu |
| 151 | +## team. Also, please note that software in universe WILL NOT receive any |
| 152 | +## review or updates from the Ubuntu security team. |
| 153 | +deb http://archive.ubuntu.com/ubuntu focal universe |
| 154 | +# deb-src http://archive.ubuntu.com/ubuntu focal universe |
| 155 | +deb http://archive.ubuntu.com/ubuntu focal-updates universe |
| 156 | +# deb-src http://archive.ubuntu.com/ubuntu focal-updates universe |
| 157 | + |
| 158 | +## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu |
| 159 | +## team, and may not be under a free licence. Please satisfy yourself as to |
| 160 | +## your rights to use the software. Also, please note that software in |
| 161 | +## multiverse WILL NOT receive any review or updates from the Ubuntu |
| 162 | +## security team. |
| 163 | +deb http://archive.ubuntu.com/ubuntu focal multiverse |
| 164 | +# deb-src http://archive.ubuntu.com/ubuntu focal multiverse |
| 165 | +deb http://archive.ubuntu.com/ubuntu focal-updates multiverse |
| 166 | +# deb-src http://archive.ubuntu.com/ubuntu focal-updates multiverse |
| 167 | + |
| 168 | +## N.B. software from this repository may not have been tested as |
| 169 | +## extensively as that contained in the main release, although it includes |
| 170 | +## newer versions of some applications which may provide useful features. |
| 171 | +## Also, please note that software in backports WILL NOT receive any review |
| 172 | +## or updates from the Ubuntu security team. |
| 173 | +deb http://archive.ubuntu.com/ubuntu focal-backports main restricted universe multiverse |
| 174 | +# deb-src http://archive.ubuntu.com/ubuntu focal-backports main restricted universe multiverse |
| 175 | + |
| 176 | +## Uncomment the following two lines to add software from Canonical's |
| 177 | +## 'partner' repository. |
| 178 | +## This software is not part of Ubuntu, but is offered by Canonical and the |
| 179 | +## respective vendors as a service to Ubuntu users. |
| 180 | +# deb http://archive.canonical.com/ubuntu focal partner |
| 181 | +# deb-src http://archive.canonical.com/ubuntu focal partner |
| 182 | + |
| 183 | +deb http://archive.ubuntu.com/ubuntu focal-security main restricted |
| 184 | +# deb-src http://archive.ubuntu.com/ubuntu focal-security main restricted |
| 185 | +deb http://archive.ubuntu.com/ubuntu focal-security universe |
| 186 | +# deb-src http://archive.ubuntu.com/ubuntu focal-security universe |
| 187 | +deb http://archive.ubuntu.com/ubuntu focal-security multiverse |
| 188 | +# deb-src http://archive.ubuntu.com/ubuntu focal-security multiverse |
| 189 | +``` |
| 190 | + |
| 191 | +更新源 |
| 192 | + |
| 193 | +```bash |
| 194 | +sudo apt update |
| 195 | +sudo apt --fix-broken install |
| 196 | +sudo apt install make gcc-arm-linux-gnueabihf gcc bison flex libssl-dev dpkg-dev lzop |
| 197 | +``` |
| 198 | + |
| 199 | +arm-linux-gnueabihf-gcc 9.3.0 |
| 200 | + |
| 201 | +```bash |
| 202 | +$ arm-linux-gnueabihf-gcc -v |
| 203 | +Using built-in specs. |
| 204 | +COLLECT_GCC=arm-linux-gnueabihf-gcc |
| 205 | +COLLECT_LTO_WRAPPER=/usr/lib/gcc-cross/arm-linux-gnueabihf/9/lto-wrapper |
| 206 | +Target: arm-linux-gnueabihf |
| 207 | +Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.3.0-17ubuntu1~20.04' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libitm --disable-libquadmath --disable-libquadmath-support --enable-plugin --enable-default-pie --with-system-zlib --without-target-system-zlib --enable-libpth-m2 --enable-multiarch --enable-multilib --disable-sjlj-exceptions --with-arch=armv7-a --with-fpu=vfpv3-d16 --with-float=hard --with-mode=thumb --disable-werror --enable-multilib --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=arm-linux-gnueabihf --program-prefix=arm-linux-gnueabihf- --includedir=/usr/arm-linux-gnueabihf/include |
| 208 | +Thread model: posix |
| 209 | +gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04) |
| 210 | +``` |
| 211 | + |
| 212 | +一键编译内核 deb 包 |
| 213 | + |
| 214 | +```bash |
| 215 | +./make_deb.sh |
| 216 | +... |
| 217 | +make[6]: *** [/labs/linux-lab/src/linux-stable/Makefile:1052: drivers] Error 2 |
| 218 | +make[5]: *** [Makefile:146: sub-make] Error 2 |
| 219 | +make[4]: *** [Makefile:24: __sub-make] Error 2 |
| 220 | +make[3]: *** [debian/rules:4: build] Error 2 |
| 221 | +dpkg-buildpackage: error: debian/rules build subprocess returned exit status 2 |
| 222 | +make[2]: *** [/labs/linux-lab/src/linux-stable/scripts/package/Makefile:80: bindeb-pkg] Error 2 |
| 223 | +make[1]: *** [/labs/linux-lab/src/linux-stable/Makefile:1365: bindeb-pkg] Error 2 |
| 224 | +make[1]: Leaving directory '/labs/linux-lab/src/linux-stable/build_image/build' |
| 225 | +make: *** [Makefile:146: sub-make] Error 2 |
| 226 | +``` |
| 227 | + |
| 228 | +失败了,明天再看。 |
| 229 | + |
| 230 | + |
| 231 | + |
| 232 | +## 升级 deb |
| 233 | + |
| 234 | +[4. 构建野火Debian系统固件 - [野火]i.MX Linux开发实战指南 文档](http://doc.embedfire.com/linux/imx6/base/zh/latest/building_image/building_debian.html) |
| 235 | + |
| 236 | +[update-fire-kernel.sh](http://update-fire-kernel.sh/) |
| 237 | + |
| 238 | +```bash |
| 239 | +#!/bin/sh -e |
| 240 | + |
| 241 | +_do () { |
| 242 | + $@ || ( cp -rf /tmp/boot /; echo "kernel update failed: $@"; exit -1; ) |
| 243 | +} |
| 244 | + |
| 245 | +if [ ! -f /boot/vmlinuz* ]; then |
| 246 | + echo "error:fire kernel no exit!" |
| 247 | +else |
| 248 | + cp -rf /boot /tmp |
| 249 | + |
| 250 | + _do dpkg -r linux-image-$(uname -r) |
| 251 | + |
| 252 | + _do dpkg -i $1 |
| 253 | + |
| 254 | + if [ -f /boot/vmlinuz* ]; then |
| 255 | + rm -rf /tmp/boot |
| 256 | + else |
| 257 | + cp -rf /tmp/boot / |
| 258 | + fi |
| 259 | +fi |
| 260 | +``` |
| 261 | + |
| 262 | +执行升级操作 |
| 263 | + |
| 264 | +```bash |
| 265 | +chmod +x ./update-fire-kernel.sh |
| 266 | +sudo ./update-fire-kernel.sh ./linux-image-4.19.71-imx-r1_1stable_armhf.deb |
| 267 | +``` |
0 commit comments