diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 00000000..d2e9df5d
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,3 @@
+doc/
+_build/
+output/
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
new file mode 100644
index 00000000..95544b72
--- /dev/null
+++ b/.github/workflows/build.yml
@@ -0,0 +1,19 @@
+name: Build
+on: [push]
+jobs:
+ Build:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - run: git fetch --prune --unshallow
+ - name: Install latest Docker
+ run: curl -fsSL https://get.docker.com | sudo sh
+ - name: Build Docker image
+ run: docker build -t openfang .
+ - name: Build openfang
+ run: docker run -v $(pwd)/output:/output openfang
+ - name: Upload artifacts
+ uses: actions/upload-artifact@v1
+ with:
+ name: openfang-${{ github.sha }}
+ path: output/
diff --git a/Dockerfile b/Dockerfile
index df2ddd6c..b38156bb 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,22 +1,28 @@
FROM ubuntu:16.04
+# TODO: 18.04
-RUN \
- apt update && apt upgrade -y && \
- apt install -y \
- build-essential \
- git \
- autoconf \
- cmake \
- python \
- unzip \
- cpio \
- wget \
- vim \
- locales \
- lzop \
- bc \
- libncurses5-dev
+RUN apt-get update && apt-get install -y \
+ autoconf \
+ bc \
+ build-essential \
+ cmake \
+ cpio \
+ git \
+ libncurses5-dev \
+ locales \
+ lzop \
+ python \
+ unzip \
+ vim \
+ wget
+# Can't remove apt lists -- oss configure script libgtk fails without them and
+# installing libgtk takes up way more space than the lists do.
RUN locale-gen --no-purge en_US.UTF-8
-RUN git clone https://github.com/anmaped/openfang/ /root/openfang
+COPY . /root/openfang
WORKDIR /root/openfang
+ENV OPENFANG_OUTPUT_DIR /output
+
+# TODO: non-root user
+
+CMD ["/root/openfang/buildopenfang.sh"]
diff --git a/README.md b/README.md
index 8bd0c20f..4f96115e 100644
--- a/README.md
+++ b/README.md
@@ -1,56 +1,52 @@
# openfang
-The openfang is a bootloader, kernel and toolchain for devices using Ingenic T10 and T20 SOC.
+Openfang is a bootloader, kernel and toolchain for devices using Ingenic T10 and T20 SOC.
-## Overview
-At the present time, this repository only contains kernel and rootfs for cameras using Inegnic T20 SOC. To ease identifying these cameras please use the pictures below. A more detailed technical description can be found [here](doc/overview.md).
+## Overview
+At the present time, this repository only contains kernel and rootfs for cameras using Ingenic T20 SOC. To ease identifying these cameras please use the pictures below. A more detailed technical description can be found [here](doc/overview.md).
Ingenic T20L (64Mb DDR) |
-:-- | --:
- Xiaomi Mijia 2018 |  Xiaomi Xiaofang 1S
+:--: | :--:
+[](https://github.com/mje-nz/openfang/blob/master/doc/SXJ02ZM/SXJ02ZM_instructions.md)
Xiaomi Mijia 2018 | 
Xiaomi Xiaofang 1S
Ingenic T20N (64Mb DDR + SIMD128)
-:-- |
- DIGOO DG W30
+:--: |
+
DIGOO DG W30
-Ingenic T20X (128Mb DDR) |
-:-- | --:
- Wyze Cam V2 |
- Xiaomi Dafang |  Wyze Cam Pan
+Ingenic T20X (128Mb DDR) | |
+:--: | :--: | :--:
+
Wyze Cam V2 | 
Xiaomi Dafang | [](https://github.com/mje-nz/openfang/blob/master/doc/WYZECP1/wyzecp1_instructions.md)
Wyze Cam Pan
-If you have a device with a Ingenic T10 SOC, consider using for now https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks
+If you have a device with a Ingenic T10 SOC, consider using [EliasKotlyar/Xiaomi-Dafang-Hacks](https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks) for now.
-If you have a classic XiaoFang with a ARM-Processor, consider using https://github.com/samtap/fang-hacks
+If you have a classic Xiaofang with a ARM processor, consider using [samtap/fang-hacks](https://github.com/samtap/fang-hacks).
## How to install openfang
-
Before installing openfang, we suggest you carefully read the [FAQ](/doc/faq.md).
After that, continue to the [Installation](/doc/install.md) procedure. More details on [troubleshooting](doc/troubleshooting.md).
-## How to compile openfang
+## How to compile openfang
Openfang is actively developed and releases are only provided when the openfang distribution is stable. If you want to test the development version you can easily compile it using [docker](https://www.docker.com/). More details on how to do it [here](doc/docker.md).
-### Issues and support ###
-
-If you encounter an issue which you think is a bug in the openfang or the associated libraries, you are welcome to submit it here on Github: https://github.com/anmaped/openfang/issues.
+### Issues and support
+If you encounter an issue which you think is a bug in openfang or the associated libraries, you are welcome to submit it [here on Github](https://github.com/anmaped/openfang/issues).
Please provide as much context as possible:
-- buildroot core version which you are using;
-- kernel version and modules you have enable;
-- build root packages you are trying to integrate;
-- when encountering an issue which happens at run time, attach serial output. Wrap it into a code block, just like the code;
-- for issues which happen at compile time, enable verbose compiler output in the buildroot preferences, and attach that output (also inside a code block);
-- development board model and brand;
-- other settings (board choice, flash size, etc.).
+- buildroot core version which you are using
+- kernel version and modules you have enable
+- build root packages you are trying to integrate
+- when encountering an issue which happens at run time, attach serial output (wrap it into a code block)
+- for issues which happen at compile time, enable verbose compiler output in the buildroot preferences, and attach that output (also inside a code block)
+- development board model and brand
+- other settings (board choice, flash size, etc.)
Or ask in our [Gitter channel](https://gitter.im/openfang_project) for help.
### Contributing
-
For minor fixes of code and documentation, please go ahead and submit a pull request.
Check out the list of issues which are easy to fix — [easy issues for openfang 01](https://github.com/anmaped/openfang/issues). Working on them is a great way to move the project forward.
@@ -59,6 +55,5 @@ Larger changes (rewriting parts of existing libraries from scratch, adding new f
Feature branches with lots of small commits (especially titled "oops", "fix typo", "forgot to add file", etc.) should be squashed before opening a pull request. At the same time, please refrain from putting multiple unrelated changes into a single pull request.
-### License and credits ###
-
-Buildroot is developed and maintained by The Buildroot developers.
+### License and credits
+Buildroot is developed and maintained by the Buildroot developers.
diff --git a/buildopenfang.sh b/buildopenfang.sh
index 6a53b0bf..c481b2b1 100755
--- a/buildopenfang.sh
+++ b/buildopenfang.sh
@@ -1,101 +1,127 @@
#!/bin/sh
-TAG=rc05_01
-
set -e
-CPW=$(pwd)
+info() {
+ # Don't bother checking for an ANSI-capable terminal
+ # https://github.com/actions/runner/issues/241
+ echo "\033[0;32m> $*\033[0m"
+}
-DIR=_build
-[ -d $DIR ] || { printf '%s does not exist!\n' "$DIR"; mkdir $DIR; }
-date=$(date +"%Y-%m-%d %H:%M")
-#ID="($(git rev-parse HEAD)) $date"
+# Set up directories
+info "Setting up directories"
+OPENFANG_ROOT_DIR=$(pwd)
+echo "Project directory: $OPENFANG_ROOT_DIR"
+OPENFANG_OUTPUT_DIR="${OPENFANG_OUTPUT_DIR:-$OPENFANG_ROOT_DIR/output}"
+if ! [ -d "$OPENFANG_OUTPUT_DIR" ]; then
+ echo "Creating output directory: $OPENFANG_OUTPUT_DIR"
+ mkdir "$OPENFANG_OUTPUT_DIR"
+else
+ echo "Output directory: $OPENFANG_OUTPUT_DIR"
+fi
+OPENFANG_BUILD_DIR="$OPENFANG_ROOT_DIR/_build"
+if [ ! -d "$OPENFANG_BUILD_DIR" ]; then
+ echo "Creating build directory: $OPENFANG_BUILD_DIR"
+ mkdir "$OPENFANG_BUILD_DIR"
+else
+ echo "Build directory: $OPENFANG_BUILD_DIR"
+fi
+
+
+# Update version info
+info "Updating version info"
+TAG=rc05_01
+DATE=$(date +"%Y-%m-%d %H:%M")
+#ID="($(git rev-parse HEAD)) $DATE"
ID="$(git describe --tags)"
SHORTID=$(git rev-parse --short HEAD)
-
echo "$ID" > fs/opt/version
-cp fs $DIR/ -r;
+cp -r fs/ "$OPENFANG_BUILD_DIR/"
-sed -i "s/VERSION=.*/VERSION=\"$date\"/g" $DIR/fs/opt/autoupdate.sh
-sed -i "s/TAG=.*/TAG=\"$TAG\"/g" $DIR/fs/opt/autoupdate.sh
-sed -i "s/ID=.*/ID=\"$SHORTID\"/g" $DIR/fs/opt/autoupdate.sh
+sed -i "s/VERSION=.*/VERSION=\"$DATE\"/g" "$OPENFANG_BUILD_DIR/fs/opt/autoupdate.sh"
+sed -i "s/TAG=.*/TAG=\"$TAG\"/g" "$OPENFANG_BUILD_DIR/fs/opt/autoupdate.sh"
+sed -i "s/ID=.*/ID=\"$SHORTID\"/g" "$OPENFANG_BUILD_DIR/fs/opt/autoupdate.sh"
-[ "$1" = "stamp" ] && { exit 0; }
+echo "VERSION: $DATE"
+echo "TAG: $TAG"
+echo "ID: $ID"
+echo "SHORTID: $SHORTID"
+[ "$1" = "stamp" ] && exit 0
-cd $DIR
-BUILDROOT_VERSION=2016.02
-
-[ -d "buildroot-$BUILDROOT_VERSION" ] || {
-wget https://buildroot.org/downloads/buildroot-$BUILDROOT_VERSION.tar.gz;
-tar xvf buildroot-$BUILDROOT_VERSION.tar.gz;
-rm buildroot-$BUILDROOT_VERSION.tar.gz;
-cd buildroot-$BUILDROOT_VERSION
-patch -p1 < "$CPW"/patches/add_fp_no_fused_madd.patch
-cd ..
-}
+cd "$OPENFANG_BUILD_DIR"
+info "Setting up buildroot"
+# Download buildroot
+BUILDROOT_VERSION=2016.02
+if [ ! -d "buildroot-$BUILDROOT_VERSION" ]; then
+ info "Downloading and patching buildroot $BUILDROOT_VERSION"
+ wget -q https://buildroot.org/downloads/buildroot-$BUILDROOT_VERSION.tar.gz
+ tar -xf buildroot-$BUILDROOT_VERSION.tar.gz
+ rm buildroot-$BUILDROOT_VERSION.tar.gz
+ cd buildroot-$BUILDROOT_VERSION
+ patch -p1 < "$OPENFANG_ROOT_DIR/patches/add_fp_no_fused_madd.patch"
+ cd ..
+fi
cd buildroot-$BUILDROOT_VERSION
-# update config files
-cp "$CPW"/config/buildroot.config ./.config
-cp "$CPW"/config/busybox.config ./package/busybox
-cp "$CPW"/config/uClibc-ng.config ./package/uclibc
-
-[ -d "dl" ] || { mkdir dl; }
+# Update config files
+cp "$OPENFANG_ROOT_DIR/config/buildroot.config" .config
+cp "$OPENFANG_ROOT_DIR/config/busybox.config" package/busybox/
+cp "$OPENFANG_ROOT_DIR/config/uClibc-ng.config" package/uclibc/
-cp ../../kernel-3.10.14.tar.xz dl/
-cp ../../uboot-v2013.07.tar.xz dl/
+[ -d "dl" ] || mkdir dl
-WDIR=$CPW/$DIR/buildroot-$BUILDROOT_VERSION
+cp "$OPENFANG_ROOT_DIR/kernel-3.10.14.tar.xz" dl/
+cp "$OPENFANG_ROOT_DIR/uboot-v2013.07.tar.xz" dl/
# Patch buildroot if gcc >= 5
-#
+echo "GCC version: $(gcc -dumpversion)"
GCCVER=$(gcc -dumpversion | cut -d'.' -f1)
-echo "GCC version: $GCCVER"
if [ "$GCCVER" -ge "5" ]; then
- cp "$CPW"/patches/automake.in.patch "$WDIR"/package/automake
- cp "$CPW"/patches/python/python2.7_gcc8__fix.patch "$WDIR"/package/python
- cp "$CPW"/patches/lzop-gcc6.patch "$WDIR"/package/lzop
+ cp "$OPENFANG_ROOT_DIR/patches/automake.in.patch" package/automake/
+ cp "$OPENFANG_ROOT_DIR/patches/python/python2.7_gcc8__fix.patch" package/python/
+ cp "$OPENFANG_ROOT_DIR/patches/lzop-gcc6.patch" package/lzop/
fi
-# copy python patches to address host-python build failing
-# when host has openssl 1.1.0 headers installed
-cp -f "$CPW"/patches/python/111-optional-ssl.patch "$WDIR"/package/python
-cp "$CPW"/patches/python/019-force-internal-hash-if-ssl-disabled.patch "$WDIR"/package/python
+# Copy Python patches to address host-python build failing when host has
+# openssl 1.1.0 headers installed
+cp -f "$OPENFANG_ROOT_DIR/patches/python/111-optional-ssl.patch" package/python/
+cp "$OPENFANG_ROOT_DIR/patches/python/019-force-internal-hash-if-ssl-disabled.patch" package/python/
-# copy custom openfang packages to buildroot directory
-rm -r "$WDIR"/package/ffmpeg # use updated package version instead
-rm -r "$WDIR"/package/libtirpc # use updated package version instead
-#rm -r "$WDIR"/package/python # use updated package version instead
-#rm -r "$WDIR"/package/uclibc # use updated package version instead
-cp "$CPW"/buildroot/* . -rf
+# Copy custom openfang packages to buildroot directory
+rm -r package/ffmpeg # use updated package version instead
+rm -r package/libtirpc # use updated package version instead
+#rm -r package/python # use updated package version instead
+#rm -r package/uclibc # use updated package version instead
+cp -rf "$OPENFANG_ROOT_DIR/buildroot"/* .
+
+info "Building"
make
-#
-# compile different versions of uboot
-#
+# Compile different versions of uboot
[ -f "output/images/u-boot-lzo-with-spl.bin" ] && mv output/images/u-boot-lzo-with-spl.bin output/images/u-boot-lzo-with-spl_t20_128M.bin
-# change uboot configuration
+# Change uboot configuration
sed -i "s/BR2_TARGET_UBOOT_BOARDNAME=.*/BR2_TARGET_UBOOT_BOARDNAME=\"isvp_t20_sfcnor\"/g" .config
make uboot-dirclean
make uboot
[ -f "output/images/u-boot-lzo-with-spl.bin" ] && mv output/images/u-boot-lzo-with-spl.bin output/images/u-boot-lzo-with-spl_t20_64M.bin
-
# end uboot compilation
-# constructs release with git hash label
-echo "Compressing toolchain..."
-tar -c -C "$WDIR"/output/host --transform s/./mipsel-ingenic-linux-uclibc/ --checkpoint=.1000 . | xz --best > "$CPW"/toolchain-$SHORTID.tar.xz
-echo "Compressing rootfs images..."
-tar -c -C "$WDIR"/output/images --transform s/./openfang-images/ --checkpoint=.1000 . | xz --best > "$CPW"/images-$SHORTID.tar.xz
-echo "Build completed successfully."
+# Copy images to output dir
+cp output/images/* "$OPENFANG_OUTPUT_DIR"
+# Construct release with git hash label
+info "Compressing toolchain..."
+tar -c -C output/host/ --transform s/./mipsel-ingenic-linux-uclibc/ --checkpoint=.1000 . | xz --best > "$OPENFANG_OUTPUT_DIR/toolchain-$SHORTID.tar.xz"
+info "Compressing rootfs images..."
+tar -c -C output/images/ --transform s/./openfang-images/ --checkpoint=.1000 . | xz --best > "$OPENFANG_OUTPUT_DIR/images-$SHORTID.tar.xz"
+info "Build completed successfully."
diff --git a/doc/SXJ02ZM/SXJ02ZM_instructions.md b/doc/SXJ02ZM/SXJ02ZM_instructions.md
index b0f8acb8..df9db516 100644
--- a/doc/SXJ02ZM/SXJ02ZM_instructions.md
+++ b/doc/SXJ02ZM/SXJ02ZM_instructions.md
@@ -1,145 +1,131 @@
-# Introduction and requirements
+# Installation on SXJ02ZM
-The Xiaomi Mijia 1080p v3 model is the snow-white model that was released in 2018, and has an Ingenic T20L SOC with 64MB of RAM.
-Unfortunately there is no known firmware exploit that allows us to easily edit the firmware to get ssh access to the camera.
-In order to install OpenFang on the camera, we need to program a custom bootloader for the camera using a ch341a programmer.
-
+The Xiaomi Mijia 1080p v3 is the snow-white model that was released in 2018, and has an Ingenic T20L SoC with 64MB of RAM.
+Unfortunately there is no known exploit for enabling ssh access, so in order to install openfang on the camera we need to flash a custom bootloader to the flash chip.
## Requirements
You will need:
+
- USB CH341A programmer ([amazon link](https://www.amazon.de/Programmer-CH341A-Burner-EEPROM-Writer/dp/B01D4CXYJE)) and Programmer Testing Clip for SOP8 packages ([amazon link](https://www.amazon.de/dp/B07GLB1M75/ref=cm_sw_r_tw_dp_U_x_aQdKCbTGZ0032))
-- Soldering iron (any below 15w; you should avoid warming to much the SMD components)
-- Solder Flux (any rosin flux)
-- Phillips Screwdrivers (size PH00, or PH0)
-- a piece of plastic foil (e.g. kapton tape) to isolate the vcc pin when programming the chip
+- soldering iron (any below 15W; you should avoid warming too much the SMD components)
+- solder flux (any rosin flux)
+- Phillips screwdrivers (size PH00, or PH0)
+- a piece of plastic foil (e.g. kapton tape) to isolate the VCC pin when programming the chip
# 1. Case disassembly
-- Remove the back of the camera, starting from the botton.
+- Remove the back of the camera, starting from the bottom.
-
-
-- After the back has been losen, carefully remove the speaker/mic connector before removing the back.
+- After the back has been loosened, carefully remove the speaker/mic connector before removing the back.
-
-
- Unscrew the 3 black screws to separate the board from the front cover. Leave the middle screws in there!
-
-
-- After removing the screws, carefully remove the 2 frontpanel LED connectors.
+- After removing the screws, carefully remove the 2 front panel LED connectors.
-
-# 2. (De)soldering and preparing to flash
+# 2. Desoldering and preparing to flash
## Desoldering
-- Desolder the VCC leg (Leg 8) of the SOP8 chip.
+- Desolder the VCC pin (pin 8) of the SOP8 chip.
-
-
-
-- Put a piece of plastic foil between the desoldered leg and the PCB. We do this to avoid powering-up the whole PCB through the chip+programmer, as the chip would net be flashable like this.
+- Put a piece of plastic foil between the desoldered pin and the PCB. We do this to avoid powering up the whole PCB through the programmer, as the chip would not be flashable like this.
-
-## Conecting the SPI Flash to the programmer
-- Put the programmer clip tight on the SOP8 package, having in mind that the red cable is always for PIN1. Make sure it sits tight on the SOP8 package.
+## Connecting the SPI flash to the programmer
+- Put the programmer clip tight on the SOP8 package, with the red wire going to pin 1. Make sure it sits tight on the SOP8 package. You may have to wiggle it around to get a solid connection.
-
-
-
-- Connect the clip cable to the programmer as seen in here.
+- Connect the clip cable to the programmer as seen here.
+- Plug in the programmer to the computer and start the flashing process.
-- Plug in the programer to the computer and start the flashing process.
-
-# 3. Flashing the SPI Flash (Windows / Mac / Linux)
+# 3. Flashing the bootloader (Windows/macOS/Linux)
## Downloading the needed files
- Download the latest release package from [OpenFang/releases](https://github.com/anmaped/openfang/releases) and extract it somewhere.
-- Download the proper flashing software from the tools directory. It is recommended to flash the SPI Flash under Linux / MacOS as I never had success in flashing it with windows! Feel free to report otherwise.
-- You might have to recompile CH341aprog. Download the latest release at [setarcos/ch341prog](https://github.com/setarcos/ch341prog)and compile it.
-
+- Download the proper flashing software from the tools directory. It is recommended to flash the SPI flash under Linux/macOS as I never had success in flashing it with Windows! Feel free to report otherwise.
+- You might have to recompile CH341Prog. Download the latest release at [setarcos/ch341prog](https://github.com/setarcos/ch341prog) and compile it.
-### Flashing under MacOS / Linux
-- Use ch341prog to first erase the SPI Flash: ``` ./ch341prog -e ```
-- Use ch341prog to write the custom bootloader to the SPI Flash: ``` ./ch341prog -w u-boot-lzo-with-spl_t20_64M.bin ``` Caution: flash the 64M binary file!
+## Flashing under macOS/Linux
+- First, use CH341Prog to back up the original bootloader: `./ch341prog -r xiaomi-bootloader.bin` (it will take a few minutes).
+- Save this file somewhere safe; it is the only way you can revert your camera's firmware back to stock!
+- Use CH341Prog to erase the SPI flash: `./ch341prog -e`
+- Use CH341Prog to write the custom bootloader to the SPI flash: `./ch341prog -w u-boot-lzo-with-spl_t20_64M.bin`
+- Caution: flash the binary file ending in `_64M`, not `_128M`!
+- Don't forget to resolder the VCC pin.
-### Flashing under Windows
+## Flashing under Windows
- Download the [CH341A programmer v1.29](https://www.bios-mods.com/forum/Thread-CH341A-v1-29), extract it somewhere and run it.
-
-- After clicking on connect, you will be prompted to select your flash memory. Select any of the two.
+- After clicking on connect, you will be prompted to select your flash memory. Select any of the two.
### Making backup
Attention: it's highly recommended NOT TO IGNORE THIS STEP, because this is the only way you can revert your camera's firmware back to stock!
- Click on "Read".
-
- When reading is completed, click on "Verify" to verify that reading result matches content on flash.
-
- Click on "Save" and save your backup.
### Flashing
-- Click on erase at the top icons and wait for the process to finish.
+- Click on erase at the top icons and wait for the process to finish.
-
-- If the erasing has been completed, you will be prompted with a message.
+- If the erasing has been completed, you will be prompted with a message.
-
-- Click on read at the top icons and make sure that everything is set to FF.
+- Click on read at the top icons and make sure that everything is set to FF.
-
-- Click on File -> open and select the u-boot-lzo-with-spl_t20_64M.bin file. Do not select the 128m one.
+- Click on File -> open and select the u-boot-lzo-with-spl_t20_64M.bin file. Do not select the 128M one.
-
-- After the flashing, click on read at the top icons and see is something was written to the flash.
+- After the flashing, click on read at the top icons and see if something was written to the flash.
+- Don't forget to resolder the VCC pin.
+
+
+# 4. Preparing the SD card (Windows/macOS/Linux)
+TODO: For this section, you need an openfang rootfs.
-# 4. Preparing the SD-Card (Windows / Mac / Linux)
## Flash rootfs using Windows
- Download and install any partitioning software. My favourite freeware for this is Active Partition Manager.
-- On active partiton manager erase all partitions of the sd-card.
-- Create one NTFS-Partition with about 4GB (4096 mbytes)
+- In Active Partition Manager, erase all partitions of the SD card.
+- Create one NTFS partition of about 4GB (4096MB).
- Select edit params of the partition and make sure you assign a drive letter to it.
-- Use the rest of the unallocated space to create one exFat partition.
+- Use the rest of the unallocated space to create one exFAT partition.
- Select edit params of the partition and make sure you assign a drive letter to it.
-- Open DiskImage 1.6 ([link](http://www.roadkil.net/program.php/P12/Disk%20Image)) and flash the rootfs.ext2 imagefile onto the 4GB NTFS partition you created.
+- Open [DiskImage 1.6](http://www.roadkil.net/program.php/P12/Disk%20Image) and flash the rootfs.ext2 image file onto the 4GB NTFS partition you created.
+
+## Flash rootfs using macOS/Linux
+Assuming your SD card is `/dev/sdb`:
-## Flash rootfs using linux
-```
+```bash
fdisk /dev/sdb
```
Use `p` to see the list of partitions and `n` to create a new one.
-After creating all the partitions we should see something like that
+After creating all the partitions you should see something like this:
```
Command (m for help): p
@@ -157,35 +143,46 @@ Device Boot Start End Sectors Size Id Type
The first partition is the boot partition and is where we should store the rootfs. For that use the command
-```
+```bash
dd if=/path/to/image/rootfs.ext2 of=/dev/sdb1
```
to flash the rootfs image.
+# Flash rootfs using macOS
+In a terminal, use
+
+```bash
+diskutil list
+```
+
+to find the name for your SD card (e.g. `disk2`), then run
-## Flash rootfs using MacOS
-Follow the same instructions for Linux.
+```bash
+sudo diskutil partitionDisk disk2 2 MBR exFAT boot 4G exFAT home R
+diskutil umount disk2s1
+sudo dd if=/path/to/image/rootfs.ext2 of=/dev/disk2s1
+```
+to partition it (into one 4GB exFAT partition named "boot" and another filling the rest of the card named "home") and copy in the rootfs.
# 5. Configuration of the camera
-If everything went well so far, your cam's front LED should be flashing in different colors, and after some couple of seconds should stay orange. If this is the case, you can now connect your computer to the temporary created hotspot from the camera for the initial setup.
-When you connect to the OpenFang access point, you can open a browser and call https://192.168.14.1 in the browser to access the panel. Use admin / admin in order to log on.
+Eject the SD card and put it into the camera.
+If everything went well so far, your camera's front LED should be flashing in different colors, and after a couple of seconds should stay orange. If this is the case, you can now connect your computer to the temporary created hotspot from the camera for the initial setup.
+When you connect to the openfang network, go to https://192.168.14.1 in a browser to access the panel. Use admin/admin in order to log on.
## Resize the rootfs image
The rootfs image is smaller than the available partition where we have written the rootfs directories. To be able to use all the available space we allocated for the partition, we have to resize the filesystem.
-- Log on a SSH shell to 192.168.14.1 with username admin / admin.
-- On the shell type ``` su ``` press return.
-- Type ``` resize2fs /dev/mmcblk0p1 ``` press return.
+- Log on a SSH shell to 192.168.14.1 with username admin/admin.
+- On the shell type `su` and press return.
+- Type `resize2fs /dev/mmcblk0p1` and press return.
- It will take a short while. Note that the time it takes depends of the size of the partition you are resizing.
-
## Configure the camera on the WebUi
-- Go to Settings and select the Model of the cam (in this case the Mijia 2018)
-- Go to wireless in the settings, select the mode and insert your home router's network credentials. Don't chose the type AP, as it will create an acess point/hotspot and this is not what we want.
-
+- Go to Settings and select the Model of the cam (in this case the Mijia 2018).
+- Go to wireless in the settings, select the mode and insert your home router's network credentials. Don't chose the type AP, as it will create an access point/hotspot and this is not what we want.
diff --git a/doc/docker.md b/doc/docker.md
index 7fcff87d..e10324ca 100644
--- a/doc/docker.md
+++ b/doc/docker.md
@@ -1,30 +1,21 @@
# Use docker to generate the openfang firmware and toolchain
-
Docker is well known among software developers. Even if you are not familiar with it, you can easily follow the build procedure in just a few small steps. We recommend starting with the first option.
-## Build openfang using pre-built docker image (recommended)
-The next set of commands will retrieve the image from dockerhub and compile it. To do so, use the following commands:
+## Build openfang using pre-built Docker image (recommended)
+To retrieve the image from Docker Hub and use it to compile the latest development version of openfang:
-```
-docker run -it -d --name openfangdev anmaped/openfang
-docker exec openfangdev sh /root/openfang/buildopenfang.sh
+```bash
+docker run -it -v $(pwd)/output:/output anmaped/openfang
```
-Now you can use the `docker cp` command to copy the image file containing the openfang bottoloader and rootfs.
+Now the image files containing the openfang bootloader and rootfs are in the current directory.
-```
-docker cp openfangdev:/root/openfang/_build/buildroot-2016.02/output/images/. .
-```
-
-Replace `openfangdev` with the container id generated by the run command if you chose to use multiple containers. You can use `docker container ls -a` to see the available containers and ids.
## Build openfang from git repository
+To build a local version of openfang:
-This step will generate the image locally and compile it from scratch.
-
-```
-docker build -f ./Dockerfile -t openfang/container .
-docker run -it -d --name openfangdev openfang/container
-docker exec openfangdev sh /root/openfang/buildopenfang.sh
+```bash
+docker build -t openfang .
+docker run -it -v $(pwd)/output:/output openfang
```