From 06200e02468a35a75c64cacce64366fc737abae6 Mon Sep 17 00:00:00 2001 From: Joseph Coffland Date: Thu, 16 Jan 2020 12:04:20 -0800 Subject: [PATCH] Improved build instructions. Simplified bbserial build. Added chroot dev setup instructions --- docs/bbdev-chroot.md | 41 +++++++++++++++++++++++++++++++++++++++++ docs/development.md | 11 ++--------- src/bbserial/Makefile | 28 ++++++++++++++++++++++------ 3 files changed, 65 insertions(+), 15 deletions(-) create mode 100644 docs/bbdev-chroot.md diff --git a/docs/bbdev-chroot.md b/docs/bbdev-chroot.md new file mode 100644 index 0000000..be1e45a --- /dev/null +++ b/docs/bbdev-chroot.md @@ -0,0 +1,41 @@ +This document describes how to setup a Buildbotics development environment +on a Debian based system inside a chroot. Building in the chroot ensures that +you have a clean and consistent build environment unaltered by other packages +or manual changes. + +# Install packages required to create chroot + + sudo apt-get update + sudo apt-get install binutils debootstrap + +# Create chroot environment + + mkdir bbdev + sudo debootstrap --arch amd64 stable bbdev http://deb.debian.org/debian + +# Copy downloaded files (optional) +To speed things up you can copy to large downloads, if you already have them, +into the chroot. + + sudo mkdir -p bbdev/opt/bbctrl-firmware/src/bbserial/ + sudo cp 2017-11-29-raspbian-stretch-lite.zip bbdev/opt/bbctrl-firmware/ + sudo cp raspberrypi-kernel_1.20171029-1.tar.gz bbdev/opt/bbctrl-firmware/src/bbserial/ + +# Enter the chroot + + sudo mount --bind /proc bbdev/proc + sudo mount --rbind /sys bbdev/sys + sudo mount --rbind /dev bbdev/dev + sudo chroot bbdev + cd /opt + +Now, follow the instructions in [development.md](development.md) from with in +the chroot. + +# Exit the chroot +To exit the chroot: + + exit + sudo umount bbdev/dev + sudo umount bbdev/sys + sudo umount bbdev/proc diff --git a/docs/development.md b/docs/development.md index b245ecc..6a82eb5 100644 --- a/docs/development.md +++ b/docs/development.md @@ -11,21 +11,14 @@ On a Debian Linux (9.6.0 stable) system install the required packages: sudo apt-get update sudo apt-get install -y build-essential git wget binfmt-support qemu \ parted gcc-avr avr-libc avrdude pylint3 python3 python3-tornado curl \ - unzip python3-setuptools - curl -sL https://deb.nodesource.com/setup_11.x | sudo -E bash - + unzip python3-setuptools gcc-arm-linux-gnueabihf bc sudo + curl -sL https://deb.nodesource.com/setup_13.x | sudo -E bash - sudo apt-get install -y nodejs ## Getting the Source Code git clone https://github.com/buildbotics/bbctrl-firmware -## Install the Linux kernel source - -An optimized Linux serial driver is built as part of the Buildboitcs firmwere. -A copy of the Linux kernel source for the RaspberryPi is necessary for building -this module. [Download the kernel source](https://github.com/dbrgn/linux-rpi/releases/tag/raspberrypi-kernel_1.20171029-1) -and move it to ``src/bbserial/kernel``. - ## Build the Firmware cd bbctrl-firmware diff --git a/src/bbserial/Makefile b/src/bbserial/Makefile index 6482bfc..0b7bbc6 100644 --- a/src/bbserial/Makefile +++ b/src/bbserial/Makefile @@ -1,10 +1,26 @@ -CROSS := arm-linux-gnueabihf- +CROSS:=arm-linux-gnueabihf- DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) -obj-m := bbserial.o -ccflags-y := -std=gnu99 -Wno-declaration-after-statement +obj-m:=bbserial.o +ccflags-y:=-std=gnu99 -Wno-declaration-after-statement -all: - $(MAKE) ARCH=arm CROSS_COMPILE=$(CROSS) -C kernel M=$(DIR) modules +KPKG=raspberrypi-kernel_1.20171029-1.tar.gz +KURL=https://github.com/dbrgn/linux-rpi/archive/$(KPKG) +KDIR=linux-rpi-raspberrypi-kernel_1.20171029-1 +export KERNEL=kernel7 + +KOPTS=ARCH=arm CROSS_COMPILE=$(CROSS) -C $(KDIR) + +all: $(KDIR) + $(MAKE) $(KOPTS) M=$(DIR) modules + +$(KDIR): $(KPKG) + tar xf $(KPKG) + $(MAKE) $(KOPTS) bcm2709_defconfig + $(MAKE) $(KOPTS) modules_prepare + +$(KPKG): + wget $(KURL) clean: - $(MAKE) ARCH=arm CROSS_COMPILE=$(CROSS) -C kernel M=$(DIR) clean + $(MAKE) $(KOPTS) M=$(DIR) clean + rm -rf $(KDIR) $(KPKG) -- 2.27.0