Skip to content

Commit

Permalink
Merge branch 'build-v2.0.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
ikwzm committed Oct 2, 2021
2 parents 14bba4c + 7a5555c commit 9d72879
Show file tree
Hide file tree
Showing 67 changed files with 7,617 additions and 580 deletions.
12 changes: 7 additions & 5 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ Overview

This Repository provides a Linux Boot Image(U-boot, Kernel, Root-fs) for FPGA-SoC.

**Note: Downloading the entire repository is time consuming, so download only the branch you need.**

### Features

* Hardware
Expand All @@ -22,20 +24,20 @@ This Repository provides a Linux Boot Image(U-boot, Kernel, Root-fs) for FPGA-So
+ Customized boot by uEnv.txt
+ Customized boot by boot.scr
+ Enable bootmenu
* Linux Kernel Version v5.4.105
* Linux Kernel Version 5.10.69
+ Available in both Xilinx-Zynq-7000 and Altera-SoC in a single image
+ Enable Device Tree Overlay
+ Enable FPGA Manager
+ Enable FPGA Bridge
+ Enable FPGA Reagion
+ Patch for issue #3(USB-HOST does not work with PYNQ-Z1)
* Debian10(buster) Root File System
* Debian11(bullseye) Root File System
+ Installed build-essential
+ Installed device-tree-compiler
+ Installed ruby ruby-msgpack ruby-serialport
+ Installed python python3 python3-numpy msgpack-rpc-python
+ Installed u-boot-tools
+ Installed Other package list -> [files/debian10-dpkg-list.txt](files/debian10-dpkg-list.txt)
+ Installed Other package list -> [files/debian11-dpkg-list.txt](files/debian11-dpkg-list.txt)
* FPGA Device Drivers and Services
+ [dtbocfg (Device Tree Blob Overlay Configuration File System)](https://github.com/ikwzm/dtbocfg)
+ [fclkcfg (FPGA Clock Configuration Device Driver)](https://github.com/ikwzm/fclkcfg)
Expand Down Expand Up @@ -73,7 +75,7 @@ Build
* [Build U-boot for PYNQ-Z1](doc/build/u-boot-zynq-pynqz1.md)
* [Build U-boot for DE0-Nano-SoC](doc/build/u-boot-de0-nano-soc.md)
* [Build U-boot for DE10-Nano](doc/build/u-boot-de10-nano.md)
* [Build Linux Kernel](doc/build/linux-kernel-5.4.105.md)
* [Build Debian10 RootFS](doc/build/debian10-rootfs.md)
* [Build Linux Kernel](doc/build/linux-kernel-5.10.69.md)
* [Build Debian11 RootFS](doc/build/debian11-rootfs.md)
* [Build Device Drivers and Services Package](doc/build/device-drivers.md)

3 changes: 0 additions & 3 deletions debian10-rootfs-vanilla.tgz

This file was deleted.

3 changes: 3 additions & 0 deletions debian11-rootfs-vanilla.tgz
Git LFS file not shown
227 changes: 227 additions & 0 deletions doc/build/debian11-rootfs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,227 @@
### Build Debian11 RootFS

#### Setup parameters

```console
shell$ apt-get install qemu-user-static debootstrap binfmt-support
shell$ export targetdir=debian11-rootfs
shell$ export distro=bullseye
```

#### Build Debian RootFS first-step in $targetdir(=debian11-rootfs)

```console
shell$ mkdir $PWD/$targetdir
shell$ sudo chown root $PWD/$targetdir
shell$ sudo debootstrap --arch=armhf --foreign $distro $PWD/$targetdir
shell$ sudo cp /usr/bin/qemu-arm-static $PWD/$targetdir/usr/bin
shell$ sudo cp /etc/resolv.conf $PWD/$targetdir/etc
shell$ sudo cp scripts/build-debian11-rootfs-with-qemu.sh $PWD/$targetdir
shell$ sudo cp linux-image-5.10.69-armv7-fpga_5.10.69-armv7-fpga-0_armhf.deb $PWD/$targetdir
````

#### Build Debian RootFS second-step with QEMU

##### Change Root to debian11-rootfs

```console
shell$ sudo chroot $PWD/$targetdir
```

There are two ways

1. run build-debian11-rootfs-with-qemu.sh (easy)
2. run this chapter step-by-step (annoying)

##### Setup APT

````console
debian11-rootfs# distro=bullseye
debian11-rootfs# export LANG=C
debian11-rootfs# /debootstrap/debootstrap --second-stage
```

##### Setup APT

```console
debian11-rootfs# cat <<EOT > /etc/apt/sources.list
deb http://ftp.jp.debian.org/debian bullseye main contrib non-free
deb-src http://ftp.jp.debian.org/debian bullseye main contrib non-free
deb http://ftp.jp.debian.org/debian bullseye-updates main contrib non-free
deb-src http://ftp.jp.debian.org/debian bullseye-updates main contrib non-free
deb http://security.debian.org bullseye-security main contrib non-free
deb-src http://security.debian.org bullseye-security main contrib non-free
EOT
```

```console
debian11-rootfs# cat <<EOT > /etc/apt/apt.conf.d/71-no-recommends
APT::Install-Recommends "0";
APT::Install-Suggests "0";
EOT
```

```console
debian11-rootfs# apt-get update -y
```

##### Install applications

```console
debian11-rootfs# apt-get install -y locales dialog
debian11-rootfs# dpkg-reconfigure locales
debian11-rootfs# apt-get install -y net-tools openssh-server ntpdate resolvconf sudo less hwinfo ntp tcsh zsh file
```

##### Setup hostname

```console
debian11-rootfs# echo debian-fpga > /etc/hostname
```

##### Setup root password

```console
debian11-rootfs# passwd
```

This time, we set the "admin" at the root' password.

To be able to login as root from Zynq serial port.

```console
debian11-rootfs# cat <<EOT >> /etc/securetty
# Seral Port for Xilinx Zynq
ttyPS0
EOT
```

##### Add a new guest user

```console
debian11-rootfs# adduser fpga
```

This time, we set the "fpga" at the fpga'password.

```console
debian11-rootfs# echo "fpga ALL=(ALL:ALL) ALL" > /etc/sudoers.d/fpga
```

##### Setup sshd config

```console
debian11-rootfs# sed -i -e 's/#PasswordAuthentication/PasswordAuthentication/g' /etc/ssh/sshd_config
```

##### Setup Time Zone

```console
debian11-rootfs# dpkg-reconfigure tzdata
```

or if noninteractive set to Asia/Tokyo

```console
debian11-rootfs# echo "Asia/Tokyo" > /etc/timezone
debian11-rootfs# dpkg-reconfigure -f noninteractive tzdata
```


##### Setup fstab

```console
debian11-rootfs# cat <<EOT > /etc/fstab
/dev/mmcblk0p1 /mnt/boot auto defaults 0 0
none /config configfs defaults 0 0
EOT
````

##### Setup Network

```console
debian10-rootfs# apt-get install -y ifupdown
debian10-rootfs# cat <<EOT > /etc/network/interfaces.d/eth0
allow-hotplug eth0
iface eth0 inet dhcp
EOT
````

##### Setup /lib/firmware

```console
debian11-rootfs# mkdir /lib/firmware
```

##### Install Wireless tools and firmware

```console
debian11-rootfs# apt-get install -y wireless-tools
debian11-rootfs# apt-get install -y wpasupplicant
debian11-rootfs# apt-get install -y firmware-realtek
debian11-rootfs# apt-get install -y firmware-ralink
```

##### Install Development applications

```console
debian11-rootfs# apt-get install -y build-essential
debian11-rootfs# apt-get install -y git git-lfs
debian11-rootfs# apt-get install -y u-boot-tools device-tree-compiler
debian11-rootfs# apt-get install -y libssl-dev
debian11-rootfs# apt-get install -y socat
debian11-rootfs# apt-get install -y ruby rake ruby-msgpack ruby-serialport
debian11-rootfs# apt-get install -y python3 python3-dev python3-setuptools python3-wheel python3-pip python3-numpy
debian11-rootfs# pip3 install msgpack-rpc-python
debian11-rootfs# apt-get install -y flex bison pkg-config
```

##### Install Other applications

```console
debian11-rootfs# apt-get install -y samba
debian11-rootfs# apt-get install -y avahi-daemon
```

##### Install haveged for Linux Kernel 4.19

```console
debian11-rootfs# apt-get install -y haveged
```

##### Install Linux Modules

```console
debian11-rootfs# mkdir /mnt/boot
debian11-rootfs# dpkg -i linux-image-5.10.69-armv7-fpga_5.10.69-armv7-fpga-0_armhf.deb
```

##### Clean Cache

```console
debian11-rootfs# apt-get clean
```

##### Create Debian Package List

```console
debian11-rootfs# dpkg -l > dpkg-list.txt
```

##### Finish

```console
debian11-rootfs# exit
shell$ sudo rm -f $PWD/$targetdir/usr/bin/qemu-arm-static
shell$ sudo rm -f $PWD/$targetdir/build-debian11-rootfs-with-qemu.sh
shell$ sudo rm -f $PWD/$targetdir/linux-image-5.10.69-armv7-fpga_5.10.69-armv7-fpga-0_armhf.deb
shell$ sudo mv $PWD/$targetdir/dpkg-list.txt files/debian11-dpkg-list.txt
```

#### Build debian11-rootfs-vanilla.tgz

```console
shell$ cd $PWD/$targetdir
shell$ sudo tar cfz ../debian11-rootfs-vanilla.tgz *
```

Loading

0 comments on commit 9d72879

Please sign in to comment.