BB Black Rev C Startup?

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
RickDeNatale
 
Posts: 19
Joined: Tue Sep 30, 2014 12:48 am

BB Black Rev C Startup?

Post by RickDeNatale »

I'm making progress on my first BB black project, but I'm not sure how to initialize it property on startup. I want to set up eth0 to initialize from DHCP and also do some GPIO setup.

I've put some scripts into /root/bin

First theres bin/initialize_gpio

Code: Select all

#! /usr/bin/python
import Adafruit_BBIO.GPIO as GPIO
import time

GPIO.setup("P8_10", GPIO.OUT)
GPIO.output("P8_10", GPIO.HIGH)
Then bin/set_eth0_dhcp

Code: Select all

ifconfig eth0 0.0.0.0 0.0.0.0 && dhclient
And finally bin/startup_script

Code: Select all

echo "setting up the GPIO port"
/root/bin/initialize_gpio
echo "setting eth0 to use dhcp"
/root/bin/set_eth0_dhcp
echo "done - let's boogie"
The set_eth0_dhcp script came from googling around and finding someone who said it was better to configure eth0 with ifconfig commands rather than trying to tweak config files on the BB black but maybe this isn't still true on the RevC board which runs Debian in place of Angstrom.

But in any case I'm still not sure the best way to run the startup_script on boot, since it doesn't seem to be following normal Debian patterns.

How do you guys do something like this?

User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

Re: BB Black Rev C Startup?

Post by adafruit_support_mike »

If you're running Debian, try using the standard config files.

Angstrom is a special case because it's a very lightweight version of Linux originally intended to run cell phones. All the standard utilities have been merged into a couple of binaries, so you have to learn how to work with the tools it gives you.

The BBB version of Debian is more like a regular Linux distro, so the usual tools and techniques should work.

WRT executing code at startup, there are a couple of options. There should be an /etc/rc.local file that gets executed toward the end of the boot process, and is one of the standard places to call machine-specific startup and configuration scripts. You should also be able to enter items into the root user's crontab with an @reboot specifier.

User avatar
RickDeNatale
 
Posts: 19
Joined: Tue Sep 30, 2014 12:48 am

Re: BB Black Rev C Startup?

Post by RickDeNatale »

Thanks, I'll try that.

Locked
Please be positive and constructive with your questions and comments.

Return to “Beagle Bone & Adafruit Beagle Bone products”