From 3a135164d8cb2851e8a233ab51c42484db774372 Mon Sep 17 00:00:00 2001 From: Julio Guerra Date: Tue, 21 Mar 2017 15:51:19 +0100 Subject: [PATCH] Table of Contents And a script to maintain the readme: - updating the ToC - updating links relative to the branch name --- Makefile | 4 ++++ README.md | 40 ++++++++++++++++++++++++++++++++++++++++ scripts/update-readme.sh | 33 +++++++++++++++++++++++++++++++++ sdk/Dockerfile | 6 ++++++ 4 files changed, 83 insertions(+) create mode 100755 scripts/update-readme.sh diff --git a/Makefile b/Makefile index b81bcc5..f4bdb62 100644 --- a/Makefile +++ b/Makefile @@ -35,3 +35,7 @@ endef shell: $(docker/build) docker run -it -v $$PWD:$$PWD -w $$PWD --privileged $$($(docker/build) -q) + +.PHONY: README.md +README.md: + ./scripts/update-readme.sh diff --git a/README.md b/README.md index 5e34ca7..410ffd6 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,46 @@ session and **without any JTAG probe**. This repository contains the freemium distribution of [Alpha] for any version of the Raspberry Pi. + + +Table of Contents +================= + + * [Alpha](#alpha) + * [Table of Contents](#table-of-contents) + * [Use Cases](#use-cases) + * [Bare Metal Programming](#bare-metal-programming) + * [Benchmarking](#benchmarking) + * [Writing drivers](#writing-drivers) + * [High performance](#high-performance) + * [Learning by doing](#learning-by-doing) + * [Operating System Debugging](#operating-system-debugging) + * [Multi-core Debugging](#multi-core-debugging) + * [A convenient programming environment](#a-convenient-programming-environment) + * [A bare metal C library](#a-bare-metal-c-library) + * [List of delegated syscalls](#list-of-delegated-syscalls) + * [List of implemented syscalls](#list-of-implemented-syscalls) + * [A stack](#a-stack) + * [An address space](#an-address-space) + * [An extended GDB server](#an-extended-gdb-server) + * [Exiting GDB resets the SoC](#exiting-gdb-resets-the-soc) + * [Stopping the execution](#stopping-the-execution) + * [Alpha-specific commands](#alpha-specific-commands) + * [Installation](#installation) + * [Alpha](#alpha-1) + * [Wiring](#wiring) + * [Examples](#examples) + * [Hello World](#hello-world) + * [Compiling](#compiling) + * [Running](#running) + * [Raytracer](#raytracer) + * [Compiling](#compiling-1) + * [Running](#running-1) + * [Support](#support) + * [Licensing](#licensing) + +Generated by [gh-md-toc](https://github.com/ekalinin/github-markdown-toc) + # Use Cases diff --git a/scripts/update-readme.sh b/scripts/update-readme.sh new file mode 100755 index 0000000..38158a6 --- /dev/null +++ b/scripts/update-readme.sh @@ -0,0 +1,33 @@ +#!/bin/sh + +# immediately exit on any unhandled error +set -e + +# current working directory +cwd=${0%/*} + + +# +# script entry function +# +cmd() { + gawk -i inplace \ + 'BEGIN { toc = 0; } + // { + toc = 1; + print; + system("gh-md-toc README.md"); + } + // { toc = 0; } + toc == 0 { print; }' \ + README.md + + sed -i \ + -e 's/Created by \[gh-md-toc\]/Generated by [gh-md-toc]/g' \ + -e "s#\(https://cdn.rawgit.com/farjump/raspberry-pi/\)feature-readme-get-started/#\1$(git rev-parse --abbrev-ref HEAD)/#g" \ + README.md + + return 0 +} + +cmd $@ diff --git a/sdk/Dockerfile b/sdk/Dockerfile index 6dc9ecd..4664140 100644 --- a/sdk/Dockerfile +++ b/sdk/Dockerfile @@ -20,6 +20,8 @@ RUN apt-get update && apt-get install --no-install-recommends -y \ curl \ make \ libncurses5 \ + gawk \ + git \ ca-certificates # Official distribution of the ARM Toolchain @@ -27,6 +29,10 @@ COPY ./scripts/ /tmp/scripts/ RUN /tmp/scripts/install-toolchain.sh --prefix=/opt/arm-none-eabi ENV PATH="/opt/arm-none-eabi/bin:$PATH" +# Helper script to generate the markdown Table of Content +RUN curl -sSL https://raw.githubusercontent.com/ekalinin/github-markdown-toc/master/gh-md-toc > /usr/local/bin/gh-md-toc \ + && chmod +x /usr/local/bin/gh-md-toc + # Create a non-root user with the same uid as on the host to allow proper file # permissions created inside the container. Since it is not root, allow calling # sudo without password when required.