Skip to content

Latest commit

 

History

History
205 lines (126 loc) · 7.84 KB

README.md

File metadata and controls

205 lines (126 loc) · 7.84 KB

meta-chip

NextThingCo C.H.I.P. Yocto meta layer.

This layer contains kernel, u-boot and image recipes to flash the NextThingCo C.H.I.P. boards.

This layer depends on the additional mandatory layers:

  • meta-yocto
  • meta-yocto-bsp
  • meta-openembedded/meta-oe
  • meta-openembedded/meta-python
  • meta-openembedded/meta-networking

Optionally, the following layers will be required:

Examples to use this layer are available in my Github at https://github.com/joelguittet/meta-chip-examples.

Philosophy of this meta layer

The main positions of this meta layer are the following:

  • A single meta layer for all NextThingCo C.H.I.P. boards. Today, C.H.I.P. and C.H.I.P. PRO are both supported.
  • The same baseline for all boards: same u-boot version (2016.01), the same kernel version (4.4), the same default kernel configuration. Only the specificities of the hardware differ (device tree and WiFi driver module).
  • A step by step tutorial to help you building and flashing your first C.H.I.P. board (see chapter Using just below).
  • Some simple tools to flash the boards (a single script to launch).

The whishes of the meta layer is to provide the most important abstraction to the hardware. Following the design rules described above, many applications can be executed on C.H.I.P. or C.H.I.P. PRO without to worry about the hardware version used in you final design.

Moreover, the meta layer is improved thinking to the impacts on your own meta layer and trying to reduce them to the minimum.

Images

The following images are available:

  • chip-image-minimal: the minimal image which is used to get the hardware running. Images all require this image.

The wanted image is chosen during the build with bitbake command.

New images created in other layers should at least require chip-image-minimal.

Package groups

The following package groups are available:

  • chip-packagegroup-wifi: to build images with WiFi tools to connect to an external network.
  • chip-packagegroup-wifi-hotspot: to build images with WiFi tools to create an hotspot.
  • chip-packagegroup-java: to build images with OpenJdk to execute Java applications.
  • chip-packagegroup-java-dio: to build images with OpenJdk and OpenJdk-DIO project used to access hardware from Java applications.

Package groups are included in wanted images.

Using

The following tutorial is useful to start building your own Yocto project and loading C.H.I.P. or C.H.I.P. PRO board. The development machine is running Ubuntu 16.04.

1- Install System Dependencies (once)

sudo apt-get update && sudo apt-get upgrade
sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib build-essential chrpath socat libsdl1.2-dev xterm lzop u-boot-tools git build-essential curl libusb-1.0-0-dev python-pip minicom android-tools-fsutils android-tools-fastboot libncurses5-dev
sudo pip install --upgrade pip && sudo pip install pyserial

2- Get sources and flashing tools (once)

Clone sources:

git clone --branch fido git://git.yoctoproject.org/poky.git ~/yocto/poky
git clone --branch fido git://git.openembedded.org/meta-openembedded ~/yocto/meta-openembedded
git clone https://github.com/joelguittet/meta-chip.git ~/yocto/meta-chip

Get and build sunxi tools:

git clone http://github.com/linux-sunxi/sunxi-tools ~/yocto/sunxi-tools
cd ~/yocto/sunxi-tools
make
make misc
sudo make install
sudo make install-misc

Get C.H.I.P. tools:

git clone https://github.com/joelguittet/chip-tools ~/yocto/chip-tools

Update udev rules:

echo -e 'SUBSYSTEM=="usb", ATTRS{idVendor}=="1f3a", ATTRS{idProduct}=="efe8", GROUP="plugdev", MODE="0660" SYMLINK+="usb-chip"
SUBSYSTEM=="usb", ATTRS{idVendor}=="18d1", ATTRS{idProduct}=="1010", GROUP="plugdev", MODE="0660" SYMLINK+="usb-chip-fastboot"
SUBSYSTEM=="usb", ATTRS{idVendor}=="1f3a", ATTRS{idProduct}=="1010", GROUP="plugdev", MODE="0660" SYMLINK+="usb-chip-fastboot"
SUBSYSTEM=="usb", ATTRS{idVendor}=="067b", ATTRS{idProduct}=="2303", GROUP="plugdev", MODE="0660" SYMLINK+="usb-serial-adapter"
' | sudo tee /etc/udev/rules.d/99-allwinner.rules
sudo udevadm control --reload-rules

Create images directory:

mkdir -p ~/yocto/images

3- Configure build (once)

Setup environnement:

cd ~/yocto
source poky/oe-init-build-env

Add layers to the configuration file ~/yocto/build/conf/bblayers.conf:

BBLAYERS ?= " \
  ${TOPDIR}/../poky/meta \
  ${TOPDIR}/../poky/meta-yocto \
  ${TOPDIR}/../poky/meta-yocto-bsp \
  ${TOPDIR}/../meta-openembedded/meta-oe \
  ${TOPDIR}/../meta-openembedded/meta-python \
  ${TOPDIR}/../meta-openembedded/meta-networking \
  ${TOPDIR}/../meta-chip \
"

Set machine in the configuration file ~/yocto/build/conf/local.conf:

MACHINE ??= "chip"

Or:

MACHINE ??= "chip-pro"

Depending of the expected target.

4- Restore environnement (when restarting the development machine)

Restore environnement:

    cd ~/yocto
    source poky/oe-init-build-env

5- Build

Build minimal image:

cd ~/yocto/build
bitbake chip-image-minimal

6- Flash target

C.H.I.P.

Copy files in the images directory (replace chip-image-minimal-chip.ubi by the wanted rootfs if you have build another image):

cp ~/yocto/build/tmp/deploy/images/chip/chip-image-minimal-chip.ubi ~/yocto/images/rootfs.ubi
cp ~/yocto/build/tmp/deploy/images/chip/sunxi-spl.bin ~/yocto/images
cp ~/yocto/build/tmp/deploy/images/chip/u-boot-dtb.bin ~/yocto/images

Then start the target in FEL mode (put a jumper between the FEL pin and GND and then power ON) as shown on the following image.

FEL

Flash the target:

cd ~/yocto/chip-tools/
sudo ./chip-flash-chip.sh ~/yocto/images

Logs are displayed on the serial console interface (UART1) of the target to check the progression and the verification of the flashing procedure.

At the end of the flashing procedure, the target is running your image. Disconnect the power supply and remove the FEL jumper. Restart the target. The console is available on UART1 pins of the board and another one is also available throw the USB OTG cable (you should see a new tty device when connecting C.H.I.P. to your computer). Speed is 115200 for both consoles. Login is 'root' with no password.

C.H.I.P. PRO

Copy files in the images directory (replace chip-image-minimal-chip-pro.ubi by the wanted rootfs if you have build another image):

cp ~/yocto/build/tmp/deploy/images/chip-pro/chip-image-minimal-chip-pro.ubi ~/yocto/images/rootfs.ubi
cp ~/yocto/build/tmp/deploy/images/chip-pro/sunxi-spl.bin ~/yocto/images
cp ~/yocto/build/tmp/deploy/images/chip-pro/u-boot-dtb.bin ~/yocto/images

Then start the target in FEL mode (press FEL button while power ON) as shown on the following image.

FEL

Flash the target:

cd ~/yocto/chip-tools/
sudo ./chip-flash-chip-pro.sh ~/yocto/images

Logs are displayed on the serial console interface (UART1) of the target to check the progression and the verification of the flashing procedure. Using the dev kit, UART1 console interface is available on the host throw an USB to Serial converter.

At the end of the flashing procedure, the target is running your image. The console is available on UART1 pins of the board and another one is also available throw the USB OTG cable (you should see a new tty device when connecting C.H.I.P. PRO to your computer). Speed is 115200 for both consoles. Login is 'root' with no password.

Contributing

All contributions are welcome :-)

Use Github Issues to report anomalies or to propose enhancements (labels are available to clearly identify what you are writing) and Pull Requests to submit modifications.

References

Special thanks to Rikard Soderstrom who integrated C.H.I.P. in the meta-sunxi layer in the past.