Firmware now builds in a VSCode "Remote Container"

This commit is contained in:
David Carley
2022-08-04 01:40:27 +00:00
parent 0525158c87
commit 95697a4e93
6 changed files with 71 additions and 19 deletions

15
.devcontainer/Dockerfile Normal file
View File

@@ -0,0 +1,15 @@
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/blob/v0.241.1/containers/debian/.devcontainer/base.Dockerfile
# [Choice] Debian version (use bullseye on local arm64/Apple Silicon): bullseye, buster
ARG VARIANT=bullseye
FROM mcr.microsoft.com/vscode/devcontainers/base:${VARIANT}
RUN apt update \
&& apt upgrade -y \
&& apt install -y \
build-essential git wget binfmt-support qemu gcc-9 \
parted gcc-avr avr-libc avrdude python3 python3-tornado curl \
unzip python3-setuptools gcc-arm-linux-gnueabihf bc sudo \
&& update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 9 \
&& curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \
&& apt install -y nodejs

View File

@@ -0,0 +1,26 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/blob/v0.241.1/containers/debian
{
"name": "Debian",
"build": {
"dockerfile": "Dockerfile",
// Update 'VARIANT' to pick an Debian version: bullseye, buster
// Use bullseye on local arm64/Apple Silicon.
"args": { "VARIANT": "bullseye" }
},
"runArgs": ["--privileged"],
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Uncomment to use the Docker CLI from inside the container. See https://aka.ms/vscode-remote/samples/docker-from-docker.
// "mounts": [ "source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind" ],
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
// "remoteUser": "vscode",
"features": {
"sshd": "latest"
}
}

View File

@@ -8,12 +8,18 @@ Debian Linux are not supported.
On a Debian Linux (9.6.0 stable) system install the required packages: On a Debian Linux (9.6.0 stable) system install the required packages:
sudo apt-get update apt update
sudo apt-get install -y build-essential git wget binfmt-support qemu \ apt upgrade -y
parted gcc-avr avr-libc avrdude pylint3 python3 python3-tornado curl \ apt install -y \
unzip python3-setuptools gcc-arm-linux-gnueabihf bc sudo build-essential git wget binfmt-support qemu gcc-9 \
curl -sL https://deb.nodesource.com/setup_13.x | sudo -E bash - parted gcc-avr avr-libc avrdude python3 python3-tornado curl \
sudo apt-get install -y nodejs unzip python3-setuptools gcc-arm-linux-gnueabihf bc sudo
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 9
curl -fsSL https://deb.nodesource.com/setup_18.x | bash -
apt install -y nodejs
## Getting the Source Code ## Getting the Source Code

View File

@@ -1,7 +1,6 @@
#!/bin/bash -ex #!/bin/bash -ex
ROOT="$PWD/rpi-root" ROOT="$PWD/rpi-root"
LOOP=12
if [ $# -lt 1 ]; then if [ $# -lt 1 ]; then
echo "Usage: $0 <image> <exec>" echo "Usage: $0 <image> <exec>"
@@ -9,7 +8,8 @@ if [ $# -lt 1 ]; then
fi fi
IMAGE="$1" IMAGE="$1"
LOOP_DEV=/dev/loop${LOOP} LOOP_BOOT=
LOOP_ROOT=
EXEC= EXEC=
if [ $# -gt 1 ]; then if [ $# -gt 1 ]; then
@@ -26,25 +26,28 @@ fi
# Clean up on EXIT # Clean up on EXIT
function cleanup { function cleanup {
umount "$ROOT"/{dev/pts,dev,sys,proc,boot,mnt/host,} 2>/dev/null || true umount "$ROOT"/{dev/pts,dev,sys,proc,boot,mnt/host,} 2>/dev/null || true
losetup -d $LOOP_DEV 2>/dev/null || true losetup -d $LOOP_BOOT 2>/dev/null || true
losetup -d $LOOP_ROOT 2>/dev/null || true
rmdir "$ROOT" 2>/dev/null || true rmdir "$ROOT" 2>/dev/null || true
} }
trap cleanup EXIT trap cleanup EXIT
# set up image as loop device LOOP_BOOT=`losetup -f`
losetup $LOOP_DEV "$IMAGE" losetup -o 4194304 $LOOP_BOOT "$IMAGE"
partprobe $LOOP_DEV
LOOP_ROOT=`losetup -f`
losetup -o 48234496 $LOOP_ROOT "$IMAGE"
# check and fix filesystems # check and fix filesystems
fsck -f ${LOOP_DEV}p1 fsck -f $LOOP_BOOT
fsck -f ${LOOP_DEV}p2 fsck -f $LOOP_ROOT
# make dir # make dir
mkdir -p "$ROOT" mkdir -p "$ROOT"
# mount partition # mount partition
mount -o rw ${LOOP_DEV}p2 -t ext4 "$ROOT" mount -o rw $LOOP_ROOT -t ext4 "$ROOT"
mount -o rw ${LOOP_DEV}p1 "$ROOT/boot" mount -o rw $LOOP_BOOT "$ROOT/boot"
# mount binds # mount binds
mount --bind /dev "$ROOT/dev/" mount --bind /dev "$ROOT/dev/"

View File

@@ -5,7 +5,7 @@ ccflags-y:=-std=gnu99 -Wno-declaration-after-statement
KPKG=raspberrypi-kernel_1.20171029-1.tar.gz KPKG=raspberrypi-kernel_1.20171029-1.tar.gz
KURL=https://github.com/dbrgn/linux-rpi/archive/$(KPKG) KURL=https://github.com/dbrgn/linux-rpi/archive/$(KPKG)
KDIR=linux-rpi-raspberrypi-kernel_1.20171029-1 KDIR=/tmp/rpi-kernel
export KERNEL=kernel7 export KERNEL=kernel7
KOPTS=ARCH=arm CROSS_COMPILE=$(CROSS) -C $(KDIR) KOPTS=ARCH=arm CROSS_COMPILE=$(CROSS) -C $(KDIR)
@@ -14,7 +14,9 @@ all: $(KDIR)
$(MAKE) $(KOPTS) M=$(DIR) modules $(MAKE) $(KOPTS) M=$(DIR) modules
$(KDIR): $(KPKG) $(KDIR): $(KPKG)
tar xf $(KPKG) rm -rf $(KDIR)
mkdir -p $(KDIR)
tar xf $(KPKG) -C $(KDIR) --strip-components 1
$(MAKE) $(KOPTS) bcm2709_defconfig $(MAKE) $(KOPTS) bcm2709_defconfig
$(MAKE) $(KOPTS) modules_prepare $(MAKE) $(KOPTS) modules_prepare

View File

@@ -1,2 +1,2 @@
script#settings-view-template(type="text/x-template") script#settings-view-template(type="text/x-template")
#settings #settings