Improved build instructions. Simplified bbserial build. Added chroot dev setup...
authorJoseph Coffland <joseph@cauldrondevelopment.com>
Thu, 16 Jan 2020 20:04:20 +0000 (12:04 -0800)
committerJoseph Coffland <joseph@cauldrondevelopment.com>
Thu, 16 Jan 2020 20:04:20 +0000 (12:04 -0800)
docs/bbdev-chroot.md [new file with mode: 0644]
docs/development.md
src/bbserial/Makefile

diff --git a/docs/bbdev-chroot.md b/docs/bbdev-chroot.md
new file mode 100644 (file)
index 0000000..be1e45a
--- /dev/null
@@ -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
index b245ecc81a426bec62a68a3c1bba8c2f99b6cdc4..6a82eb51772b8169eff964382139fae5eeaf63ad 100644 (file)
@@ -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
index 6482bfcd3899eac6c5b0e5801fe81151ea0c3365..0b7bbc640e02d99d41c22cf215e2ae708dfc2ae8 100644 (file)
@@ -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)