Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM kicad/kicad:9.0

# Set environment variables
ENV PYTHONUNBUFFERED=1

# Install make, pip, and kikit for hardware build pipeline
USER root
RUN mkdir -p /var/lib/apt/lists/partial && \
apt-get update && \
apt-get install -y --no-install-recommends make python3-pip && \
python3 -m pip install --break-system-packages kikit && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

# Switch back to kicad user for security
USER kicad

# Set working directory
WORKDIR /workspace

# Default command
CMD ["/bin/bash"]
63 changes: 31 additions & 32 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,38 +1,37 @@
VENV?=.venv
VENV_ACTIVATE=. $(VENV)/bin/activate
PIP=$(VENV)/bin/pip
.PHONY: clean prepare drc_carrier gerbers_carrier schematic_carrier drc_m2 gerbers_m2 schematic_m2
.PHONY: clean prepare drc gerbers schematic pdfs drc_carrier gerbers_carrier schematic_carrier pdfs_carrier drc_m2 gerbers_m2 schematic_m2 pdfs_m2
.ONESHELL:

# Install dependencies (for local development)
prepare:
python -m venv --system-site-packages .venv
$(VENV_ACTIVATE)
$(PIP) install --quiet kikit
remove_env:
rm -rf $(VENV)
pip3 install --quiet --break-system-packages kikit

# Clean all generated files
clean:
rm -rf Carrier/production M2/production Carrier/pdfs M2/pdfs
rm -rf hardware/production hardware/pdfs

# Blackpants board targets
drc:
mkdir -p hardware/production
kikit drc run ./hardware/blackpants.kicad_pcb

gerbers:
mkdir -p hardware/production
kikit fab jlcpcb --assembly --schematic hardware/blackpants.kicad_sch hardware/blackpants.kicad_pcb hardware/production

schematic:
mkdir -p hardware/pdfs
kicad-cli sch export pdf --output hardware/pdfs/schematic.pdf hardware/blackpants.kicad_sch

# Carrier board
drc_carrier:
[ -d ".venv" ] && $(VENV_ACTIVATE); \
kikit drc run ./Carrier/badgeCarrierCard.kicad_pcb
gerbers_carrier:
[ -d ".venv" ] && $(VENV_ACTIVATE); \
kikit fab jlcpcb --assembly --schematic Carrier/badgeCarrierCard.kicad_sch Carrier/badgeCarrierCard.kicad_pcb Carrier/production
schematic_carrier:
kicad-cli sch export pdf --output Carrier/pdfs/schematic.pdf Carrier/badgeCarrierCard.kicad_sch
pdfs_carrier:
kicad-cli pcb export pdf --mode-separate --output Carrier/pdfs Carrier/badgeCarrierCard.kicad_pcb -l "F.Cu,In1.Cu,In2.Cu,B.Cu,F.Paste,B.Paste,Edge.Cuts,F.Fab,B.Fab"
pdfs:
mkdir -p hardware/pdfs
kicad-cli pcb export pdf --mode-separate --output hardware/pdfs hardware/blackpants.kicad_pcb -l "F.Cu,In1.Cu,In2.Cu,B.Cu,F.Paste,B.Paste,Edge.Cuts,F.Fab,B.Fab"

# M2 board
drc_m2:
[ -d ".venv" ] && $(VENV_ACTIVATE); \
kikit drc run ./M2/badgeM2Card.kicad_pcb
gerbers_m2:
[ -d ".venv" ] && $(VENV_ACTIVATE); \
kikit fab jlcpcb --assembly --schematic M2/badgeM2Card.kicad_sch M2/badgeM2Card.kicad_pcb M2/production
schematic_m2:
kicad-cli sch export pdf --output M2/pdfs/schematic.pdf M2/badgeM2Card.kicad_sch
pdfs_m2:
kicad-cli pcb export pdf --mode-separate --output M2/pdfs M2/badgeM2Card.kicad_pcb -l "F.Cu,In1.Cu,In2.Cu,B.Cu,F.Paste,B.Paste,Edge.Cuts,F.Fab,B.Fab"
# Backward compatibility aliases for old target names
drc_carrier: drc
gerbers_carrier: gerbers
schematic_carrier: schematic
pdfs_carrier: pdfs
drc_m2: drc
gerbers_m2: gerbers
schematic_m2: schematic
pdfs_m2: pdfs
17 changes: 17 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: '3.8'

services:
hardware-build:
build:
context: .
dockerfile: Dockerfile
args:
BUILDKIT_INLINE_CACHE: 1
image: blackpants:latest
volumes:
- .:/workspace
working_dir: /workspace
environment:
- PYTHONUNBUFFERED=1
tty: true
stdin_open: true
79 changes: 79 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,82 @@
![](img/blackpants.jpg)

The Blackhat is a combination of the [Flipper Blackhat](https://github.com/o7-machinehum/flipper-blackhat) and the "Blackpants" (this repo). They combine to make a completely open source, handheld Linux computer.

## Development Setup

### Using Docker (Recommended - Self-Contained)

Build and run the Docker container with all dependencies included:

```bash
# Build the Docker image
docker-compose build

# Run the container
docker-compose run --rm hardware-build bash

# Inside the container, run any make commands
make prepare
make drc
make gerbers
make schematic
make pdfs
```

Or use Docker directly:

```bash
docker build -t blackpants:latest .
docker run -it -v ${PWD}:/workspace blackpants:latest bash
```

### Local Development (Manual Setup)

If you prefer to install tools locally:

1. **Install Make**:
- Windows: `choco install make` or download from GnuWin32
- macOS: `brew install make`
- Linux: `apt-get install make`

2. **Install Python 3.8+**

3. **Install KiCAD and CLI tools**:
- Download from https://kicad.org

4. **Prepare environment**:
```bash
make prepare
```

5. **Run make targets**:
```bash
make drc
make gerbers
make schematic
make pdfs
```

## Make Targets

### Blackpants Board
- `make drc` - Run design rule checks
- `make gerbers` - Generate Gerber files for manufacturing
- `make schematic` - Export schematic to PDF
- `make pdfs` - Export PCB layers to PDF

### Backward Compatibility Aliases
- `make drc_carrier` - Alias for `make drc`
- `make gerbers_carrier` - Alias for `make gerbers`
- `make schematic_carrier` - Alias for `make schematic`
- `make pdfs_carrier` - Alias for `make pdfs`
- `make drc_m2` - Alias for `make drc`
- `make gerbers_m2` - Alias for `make gerbers`
- `make schematic_m2` - Alias for `make schematic`
- `make pdfs_m2` - Alias for `make pdfs`

### Utilities
- `make clean` - Remove all generated production files and PDFs
- `make prepare` - Install kikit (only needed for local development)
- `make remove_env` - Remove Python virtual environment (deprecated, not used in Docker)