Skip to content

Instantly share code, notes, and snippets.

@schappim
Created December 29, 2011 06:21
Show Gist options
  • Save schappim/1532352 to your computer and use it in GitHub Desktop.
Save schappim/1532352 to your computer and use it in GitHub Desktop.
Ninja Config
touch /etc/opkg/ninja.conf;
echo 'src/gz angstrom-base http://us.feeds.angstrom-distribution.org/feeds/unstable/ipk/glibc/armv7a/base' > /etc/opkg/ninja.conf;
opkg update;
opkg install ca-certificates;
opkg install libncurses5;
opkg install ncurses-dev;
opkg install tk-dev;
opkg install tcl-dev;
opkg install libssl1.0.0;
opkg install libcrypto1.0.0;
opkg install openssl-dev;
opkg install ruby-dev;
opkg install avrdude-dev;
opkg install ccache-dev;
opkg install libzmq-dev --force-overwrite;
opkg install tzdata --force-overwrite;
rm /etc/localtime;
ln -s /usr/share/zoneinfo/Australia/Sydney /etc/localtime;
/usr/bin/ntpdate -s -u pool.ntp.org;
mkdir ./gemsrc;
cd ./gemsrc;
curl -O http://production.cf.rubygems.org/rubygems/rubygems-1.8.12.tgz;
tar -xvf rubygems-1.8.12.tgz;
cd rubygems-1.8.12;
ruby ./setup.rb;
cd ../../;
rm -rf /home/root/gemsrc;
gem install ffi-rzmq --verbose;
mkdir -p /OE/angstrom-dev/sysroots/x86_64-linux/usr/bin/;
ln -s /usr/bin/install /OE/angstrom-dev/sysroots/x86_64-linux/usr/bin/install;
curl https://raw.github.com/gist/1532352/154ef35ad279b3b4f224492c8f46f52384c22a26/set_mux.rb > /usr/bin/ninja_set_mux;
chmod 755 /usr/bin/ninja_set_mux;
curl https://raw.github.com/gist/1532352/2527bd55c7b4f194673528e57bd47f004e443c4e/ninja_startup.rb > /etc/init.d/ninja_startup.rb;
ln -s /etc/init.d/ninja_startup.rb /etc/rc5.d/S50ninja_startup.rb
chmod 755 /etc/init.d/ninja_startup.rb
#!/usr/bin/env ruby
# Set the Muxes for Serial
`/usr/bin/ninja_set_mux`;
# Setup the GPIO. (We're echo-ing 38 because it's 32+6).
`echo "38" > /sys/class/gpio/export`
# Set the direction of the GPIO
`echo "out" > /sys/class/gpio/gpio38/direction`
# Turning on an LED
`echo "1" > /sys/class/gpio/gpio38/value`
#!/usr/bin/env ruby
####### Configure MUX ######
DDR_IN = (1 << 5)
DDR_OUT = (0 << 5)
PULL_R_UP = (1 << 4)
PULL_R_DOWN = (0 << 4)
PULL_R_EN = (1 << 3)
PULL_R_DIS = (0 << 3)
uart1_pin_mux = { 'uart1_rxd' => (0 | DDR_IN), 'uart1_txd' => (0)}
uart1_pin_mux.each do |fname,mode|
print "#{fname} = #{mode}\n"
open("/sys/kernel/debug/omap_mux/#{fname}", 'wb') do |f|
printf(f, "%X", mode)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment