Cross-Compiling Bottlerocket for CM17a Firecracker on Synology

Cross-Compiling Bottlerocket, which uses the Firecracker CM17a:
http://www.linuxha.com/bottlerocket/

Following the 3rd-party app integration guide; configure, make, make install. This puts it in your local machines /usr/local/bin. You then have to upload the program ‘br’ to your Synology in the same directory.

Set your cross-compiling environment variables to point to the toolchain you installed in /usr/local:

root@xubuntu-vm:/usr/local/bottlerocket-0.04c# export CC=/usr/local/powerpc-linux/bin/powerpc-linux-gcc
root@xubuntu-vm:/usr/local/bottlerocket-0.04c# export LD=/usr/local/powerpc-linux/bin/powerpc-linux-ld
root@xubuntu-vm:/usr/local/bottlerocket-0.04c# export RANLIB=/usr/local/powerpc-linux/bin/powerpc-linux-ranlib
root@xubuntu-vm:/usr/local/bottlerocket-0.04c# export CFLAGS="-I/usr/local/powerpc-linux/include"
root@xubuntu-vm:/usr/local/bottlerocket-0.04c# export LDFLAGS="-L/usr/local/powerpc-linux/lib"

Run the configure that came with the code giving it a few extra parameters as specified in the guide:

root@xubuntu-vm:/usr/local/bottlerocket-0.04c# ./configure \
> --host=powerpc-unknown-linux \
> --target=powerpc-unknown-linux \
> --build=i686-pc-linux \
> --prefix=/usr/local
creating cache ./config.cache
checking for gcc... /usr/local/powerpc-linux/bin/powerpc-linux-gcc
checking whether the C compiler (/usr/local/powerpc-linux/bin/powerpc-linux-gcc -I/usr/local/powerpc-linux/include -L/usr/local/powerpc-linux/lib) works... yes
checking whether the C compiler (/usr/local/powerpc-linux/bin/powerpc-linux-gcc -I/usr/local/powerpc-linux/include -L/usr/local/powerpc-linux/lib) is a cross-compiler... yes
checking whether we are using GNU C... yes
checking whether /usr/local/powerpc-linux/bin/powerpc-linux-gcc accepts -g... yes
checking how to run the C preprocessor... /usr/local/powerpc-linux/bin/powerpc-linux-gcc -E
checking for a BSD compatible install... /usr/bin/install -c
checking for features.h... yes
checking for errno.h... yes
checking for sys/termios.h... yes
checking for termios.h... yes
guessing x10 port
using /dev/ttyS0 for x10 port
updating cache ./config.cache
creating ./config.status
creating Makefile
creating config.h

Run make:

root@xubuntu-vm:/usr/local/bottlerocket-0.04c# make
/usr/local/powerpc-linux/bin/powerpc-linux-gcc -I/usr/local/powerpc-linux/include -I. -Wall -O2 -DX10_PORTNAME=\"/dev/ttyS0\" -DHAVE_CONFIG_H -c ./br_cmd.c
/usr/local/powerpc-linux/bin/powerpc-linux-gcc -I/usr/local/powerpc-linux/include -I. -Wall -O2 -DX10_PORTNAME=\"/dev/ttyS0\" -DHAVE_CONFIG_H -c ./br.c
/usr/local/powerpc-linux/bin/powerpc-linux-gcc -I/usr/local/powerpc-linux/include -I. -Wall -O2 -DX10_PORTNAME=\"/dev/ttyS0\" -DHAVE_CONFIG_H -o br br.o br_cmd.o

Run ‘make install’ which installs it in /usr/local/bin on your local machine:

root@xubuntu-vm:/usr/local/bottlerocket-0.04c# make install
/usr/bin/install -c -d -m 755 /usr/local/bin
/usr/bin/install -c -m 555 br /usr/local/bin

Now copy the file /usr/local/bin/br to your synology in the same directory.

Once that is running, you issue commands as such:

DiskStation> cd /usr/local/bin/
DiskStation> ./br
BottleRocket version 0.04c

Usage: ./br [][() ...]

Options:
-v, --verbose add v's to increase verbosity
-x, --port=PORT set port to use
-c, --house=[A-P] use alternate house code (default "A")
-n, --on=LIST turn on devices in LIST
-f, --off=LIST turn off devices in LIST
-N, --ON turn on all devices in housecode
-F, --OFF turn off all devices in housecode
-d, --dim=LEVEL[,LIST] dim devices in housecode to relative LEVEL
-B, --lamps_on turn all lamps in housecode on
-D, --lamps_off turn all lamps in housecode off
-r, --repeat=NUM repeat commands NUM times (0 = ~ forever)
-h, --help this help

is a comma separated list of devices (no spaces),
each ranging from 1 to 16
is an integer from -12 to 12 (0 means no change)
is a letter between A and P
is one of ON, OFF, DIM, BRIGHT, ALL_ON, ALL_OFF,
LAMPS_ON or LAMPS_OFF

For native commands, should only be specified for ON or OFF.

DiskStation> ./br -x /dev/ttyUSB0 -v M3 OFF
./br: Turning off appliance M3
DiskStation> ./br -x /dev/ttyUSB0 -v M3 ON
./br: Turning on appliance M3
DiskStation> ./br -x /dev/ttyUSB0 -v M3 OFF
./br: Turning off appliance M3
DiskStation> ./br -x /dev/ttyUSB0 -v C1 ON
./br: Turning on appliance C1
DiskStation> ./br -x /dev/ttyUSB0 -v C1 OFF
./br: Turning off appliance C1
DiskStation> ./br -x /dev/ttyUSB0 -v C1 ON
./br: Turning on appliance C1
DiskStation> ./br -x /dev/ttyUSB0 -v C3 ON
./br: Turning on appliance C3
DiskStation> ./br -x /dev/ttyUSB0 -v C3 OFF
./br: Turning off appliance C3
DiskStation> ./br -x /dev/ttyUSB0 -v C3 ON
./br: Turning on appliance C3
DiskStation> ./br -x /dev/ttyUSB0 -v C1 OFF
./br: Turning off appliance C1
DiskStation> ./br -x /dev/ttyUSB0 -v C3 OFF
./br: Turning off appliance C3
DiskStation> ./br -x /dev/ttyUSB0 -v C LAMPS_ON
DiskStation> ./br -x /dev/ttyUSB0 -v C LAMPS_OFF
DiskStation> ./br -x /dev/ttyUSB0 -v C1 ON
./br: Turning on appliance C1
DiskStation> ./br -x /dev/ttyUSB0 -v -d25 C1
./br: For dimming either specify just a dim level or a comma
separated list containing the dim level and the devices to dim.
./br: Valid dimlevels are numbers between -12 and 12.
DiskStation> ./br -x /dev/ttyUSB0 -v -d6 C1
BottleRocket version 0.04c

Usage: ./br [][() ...]

Options:
-v, --verbose add v's to increase verbosity
-x, --port=PORT set port to use
-c, --house=[A-P] use alternate house code (default "A")
-n, --on=LIST turn on devices in LIST
-f, --off=LIST turn off devices in LIST
-N, --ON turn on all devices in housecode
-F, --OFF turn off all devices in housecode
-d, --dim=LEVEL[,LIST] dim devices in housecode to relative LEVEL
-B, --lamps_on turn all lamps in housecode on
-D, --lamps_off turn all lamps in housecode off
-r, --repeat=NUM repeat commands NUM times (0 = ~ forever)
-h, --help this help

is a comma separated list of devices (no spaces),
each ranging from 1 to 16
is an integer from -12 to 12 (0 means no change)
is a letter between A and P
is one of ON, OFF, DIM, BRIGHT, ALL_ON, ALL_OFF,
LAMPS_ON or LAMPS_OFF

For native commands, should only be specified for ON or OFF.

DiskStation> ./br -x /dev/ttyUSB0 -v -cC -d6,1
./br: Brightening lamp C1 by 6.
DiskStation> ./br -x /dev/ttyUSB0 -v -cC -d-6,1
./br: Dimming lamp C1 by 6.
DiskStation> ./br -x /dev/ttyUSB0 -v -cC -d6,3
./br: Brightening lamp C3 by 6.
DiskStation> ./br -x /dev/ttyUSB0 -v -cC -d-3,3
./br: Dimming lamp C3 by 3.
DiskStation> ./br -x /dev/ttyUSB0 -v -cC -d-3,3
./br: Dimming lamp C3 by 3.
DiskStation> ./br -x /dev/ttyUSB0 -v -cC -d-3,2
./br: Dimming lamp C2 by 3.
DiskStation> ./br -x /dev/ttyUSB0 -v -cC -d3,2
./br: Brightening lamp C2 by 3.
DiskStation> ./br -x /dev/ttyUSB0 -v C LAMPS_OFF

Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s