|
| 1 | +# Build Linux Kernel |
| 2 | + |
| 3 | +There are two ways |
| 4 | + |
| 5 | +1. run scripts/build-linux-xlnx-v2020.1-zynqmp-fpga.sh (easy) |
| 6 | +2. run this chapter step-by-step (annoying) |
| 7 | + |
| 8 | +## Download ATWILC3000 Linux Driver for Ultra96-V2 |
| 9 | + |
| 10 | +```console |
| 11 | +shell$ git clone https://github.com/Avnet/u96v2-wilc-driver.git |
| 12 | +``` |
| 13 | +## Download Linux Kernel Source |
| 14 | + |
| 15 | +### Clone from linux-xlnx.git |
| 16 | + |
| 17 | +```console |
| 18 | +shell$ git clone --depth 1 -b xilinx-v2020.1 https://github.com/Xilinx/linux-xlnx.git linux-xlnx-v2020.1-zynqmp-fpga |
| 19 | +``` |
| 20 | + |
| 21 | +### Make Branch linux-xlnx-v2020.1-zynqmp-fpga |
| 22 | + |
| 23 | +```console |
| 24 | +shell$ cd linux-xlnx-v2020.1-zynqmp-fpga |
| 25 | +shell$ git checkout -b linux-xlnx-v2020.1-zynqmp-fpga refs/tags/xilinx-v2020.1 |
| 26 | +``` |
| 27 | + |
| 28 | +## Patch for linux-xlnx-v2020.1-zynqmp-fpga |
| 29 | + |
| 30 | +```console |
| 31 | +shell$ patch -p1 < ../files/linux-xlnx-v2020.1-zynqmp-fpga.diff |
| 32 | +shell$ git add --update |
| 33 | +shell$ git add arch/arm64/boot/dts/xilinx/zynqmp-uz3eg-iocc.dts |
| 34 | +shell$ git commit -m "[patch] for linux-xlnx-v2020.1-zynqmp-fpga." |
| 35 | +``` |
| 36 | + |
| 37 | +## Patch for linux-xlnx-v2020.1-builddeb |
| 38 | + |
| 39 | +```console |
| 40 | +shell$ patch -p1 < ../files/linux-xlnx-v2020.1-builddeb.diff |
| 41 | +shell$ git add --update |
| 42 | +shell$ git commit -m "[update] scripts/package/builddeb to add tools/include and postinst script to header package." |
| 43 | +``` |
| 44 | + |
| 45 | +## Patch for drivers/drivers/tty/serial/xilinx_uartps.c |
| 46 | + |
| 47 | +```console |
| 48 | +shell$ patch -p1 < ../files/linux-xlnx-v2020.1-zynqmp-fpga-xilinx_uartps.diff |
| 49 | +shell$ git add --update |
| 50 | +shell$ git commit -m "[fix] the problem that only the first port that xilinx_uartps.c found was the console." |
| 51 | +``` |
| 52 | + |
| 53 | +## Add ATWILC3000 Linux Driver for Ultra96-V2 |
| 54 | + |
| 55 | +```console |
| 56 | +shell$ cp -r ../u96v2-wilc-driver/wilc drivers/staging/wilc3000/ |
| 57 | +shell$ patch -p1 < ../files/linux-xlnx-v2020.1-zynqmp-fpga-wilc3000.diff |
| 58 | +shell$ git add --update |
| 59 | +shell$ git add drivers/staging/wilc3000 |
| 60 | +shell$ git commit -m "[add] drivers/staging/wilc3000" |
| 61 | +``` |
| 62 | + |
| 63 | +## Patch for Ultra96-V2 |
| 64 | + |
| 65 | +```console |
| 66 | +shell$ patch -p1 < ../files/linux-xlnx-v2020.1-zynqmp-fpga-ultra96v2.diff |
| 67 | +shell$ git add --update |
| 68 | +shell$ git add arch/arm64/boot/dts/xilinx/avnet-ultra96v2-rev1.dts |
| 69 | +shell$ git commit -m "[add] devicetree for Ultra96-V2." |
| 70 | +``` |
| 71 | + |
| 72 | +## Patch for Xilinx APF Driver |
| 73 | + |
| 74 | +```console |
| 75 | +shell$ patch -p1 < ../files/linux-xlnx-v2020.1-zynqmp-fpga-apf.diff |
| 76 | +shell$ git add --update |
| 77 | +shell$ git commit -m "[add] Xilinx APF driver." |
| 78 | +``` |
| 79 | + |
| 80 | +## Create tag and .version |
| 81 | + |
| 82 | +```console |
| 83 | +shell$ git tag -a xilinx-v2020.1-zynqmp-fpga-1 -m "release xilinx-v2020.1-zynqmp-fpga-1" |
| 84 | +shell$ echo 1 > .version |
| 85 | +``` |
| 86 | + |
| 87 | +## Setup for Build |
| 88 | + |
| 89 | +```console |
| 90 | +shell$ cd linux-xlnx-v2020.1-zynqmp-fpga |
| 91 | +shell$ export ARCH=arm64 |
| 92 | +shell$ export CROSS_COMPILE=aarch64-linux-gnu- |
| 93 | +shell$ make xilinx_zynqmp_defconfig |
| 94 | +``` |
| 95 | + |
| 96 | +## Build Linux Kernel and device tree |
| 97 | + |
| 98 | +```console |
| 99 | +shell$ export DTC_FLAGS=--symbols |
| 100 | +shell$ make deb-pkg |
| 101 | +``` |
| 102 | + |
| 103 | +## Build kernel image and devicetree to target/UltraZed-EG-IOCC/boot/ |
| 104 | + |
| 105 | +```console |
| 106 | +shell$ cp arch/arm64/boot/Image ../target/UltraZed-EG-IOCC/boot/image-5.4.0-xlnx-v2020.1-zynqmp-fpga |
| 107 | +shell$ cp arch/arm64/boot/dts/xilinx/zynqmp-uz3eg-iocc.dtb ../target/UltraZed-EG-IOCC/boot/devicetree-5.4.0-xlnx-v2020.1-zynqmp-fpga-uz3eg-iocc.dtb |
| 108 | +shell$ ./scripts/dtc/dtc -I dtb -O dts --symbols -o ../target/UltraZed-EG-IOCC/boot/devicetree-5.4.0-xlnx-v2020.1-zynqmp-fpga-uz3eg-iocc.dts ../target/UltraZed-EG-IOCC/boot/devicetree-5.4.0-xlnx-v2020.1-zynqmp-fpga-uz3eg-iocc.dtb |
| 109 | +``` |
| 110 | + |
| 111 | +## Build kernel image and devicetree to target/Ultra96/boot/ |
| 112 | + |
| 113 | +```console |
| 114 | +shell$ cp arch/arm64/boot/Image ../target/Ultra96/boot/image-5.4.0-xlnx-v2020.1-zynqmp-fpga |
| 115 | +shell$ cp arch/arm64/boot/dts/xilinx/avnet-ultra96-rev1.dtb ../target/Ultra96/boot/devicetree-5.4.0-xlnx-v2020.1-zynqmp-fpga-ultra96.dtb |
| 116 | +shell$ ./scripts/dtc/dtc -I dtb -O dts --symbols -o ../target/Ultra96/boot/devicetree-5.4.0-xlnx-v2020.1-zynqmp-fpga-ultra96.dts ../target/Ultra96/boot/devicetree-5.4.0-xlnx-v2020.1-zynqmp-fpga-ultra96.dtb |
| 117 | +``` |
| 118 | + |
| 119 | +## Build kernel image and devicetree to target/Ultra96-V2/boot/ |
| 120 | + |
| 121 | +```console |
| 122 | +shell$ cp arch/arm64/boot/Image ../target/Ultra96-V2/boot/image-5.4.0-xlnx-v2020.1-zynqmp-fpga |
| 123 | +shell$ cp arch/arm64/boot/dts/xilinx/avnet-ultra96v2-rev1.dtb ../target/Ultra96-V2/boot/devicetree-5.4.0-xlnx-v2020.1-zynqmp-fpga-ultra96v2.dtb |
| 124 | +shell$ ./scripts/dtc/dtc -I dtb -O dts --symbols -o ../target/Ultra96-V2/boot/devicetree-5.4.0-xlnx-v2020.1-zynqmp-fpga-ultra96v2.dts ../target/Ultra96-V2/boot/devicetree-5.4.0-xlnx-v2020.1-zynqmp-fpga-ultra96v2.dtb |
| 125 | +``` |
| 126 | + |
0 commit comments