On 13/02/14 03:58, Mark Hatch wrote:
Thanks a lot for clearing some of this up!

So I'm trying to get a mesh network running for a university project using AHCPD/Babel. The goal would be for a Ethernet connected node (beaglebone) to use DHCP to acquire an IP address, and then it would share it's internet connection over ad-hoc wlan with it's peers (also beaglebones).

If I can't get AHCPD/Babel to run properly, I'll probably just use a regular ad-hoc network with static IPs. ('m severely time-constrained as this project is due by the end of the semester... and this is only a part of it!)


To assign addresses and handle DNS I would recommend dnsmasq.

I compiled the source code on the bbb. Have you installed gcc/make/etc on the beaglebone black? I think you can also install it using opkg.

08 - Installing dnsmasq

Source

Site:    http://www.thekelleys.org.uk/dnsmasq/
File:        dnsmasq-2.66.tar.gz
Version:    2.66

Compile and Install

Extract dnsmasq-2.66.tar.gz into the home directory.

        cp ~/libconfig-1.4.9/aux-build/install-sh ~/dnsmasq-2.66/install-sh

Modify variable in Makefile to

        INSTALL    = ~/dnsmasq-2.66/install-sh

Build and install:

        make

    make install


dnsmasq Service

Create a file /lib/systemd/dnsmasq.service which contains:

        [Unit]
    Description=A lightweight DHCP and caching DNS server
    After=networking.service

    [Service]
    Type=forking
    ExecStart=/usr/local/sbin/dnsmasq
    ExecStop=/usr/bin/killall dnsmasq

    [Install]
    WantedBy=multi-user.target

Create a link to the dnsmasq service file

        cd /etc/systemd/system

    ln -f /lib/systemd/dnsmasq.service dnsmasq.service

Start the service:

        systemctl daemon-reload

    systemctl enable dnsmasq.service


Configuration file

Create a configuration file /etc/dnsmasq.conf with the following lines

        resolv-file=/var/run/ppp/resolv.conf
    interface=eth0
    no-hosts
    dhcp-range=192.168.0.50,192.168.0.70,12h
    dhcp-option=252,"\n"
    dhcp-option=vendor:MSFT,2,1i

Restart beagle to allow the dnsmasq service to start.

Yes I have got my wifi module working, I was already able to ping google.com from wireless ad-hoc beaglebones over my laptop's eth0 which was awesome! Now I just want to replicate this with only beaglebones, which is why I need the kernel changes for NAT.

great


I do have a microSD card for testing. I ran into some complications last night trying to format the card properly because the mkcard.sh script was not working for me. I followed some of the instructions here http://derekmolloy.ie/custom-kernel-and-angstrom-distribution-recipe/.

I don't use the script. Instead I just use the gnome disk utility. ie

Installing on SD card

Use the disk utility application to create the partitions on a blank micro SD card and mount them.

Create DOS Partition with following:

    Size:                8.00 MB
    Type:                FAT
    Name:                BEAGLEBONE

The edit the DOS partition with the following:

    Partition Label:
    Type:                W95 FAT32 (LBA) (0x0c)
    Bootable:            Check this tickbox

Create a Linux partition to fill the rest of the SD card:

    Size:                7.940 GB
    Type:                Ext4
    Name:                Angstrom
    Take Ownership of filesystem:    Not checked
    Encrypt underlying device:    Not checked

Then mount both partitions. The dos partition will be mounted at /media/BEAGLEBONE and the Linux partition will be mounted at /media/Angstrom.

Copy the Angstrom distribution files to the SD card:

cd ~/Projects/angstrom-v2012.12/setup-scripts/build/tmp-angstrom_v2012_12-eglibc/deploy/images/beaglebone

sudo cp u-boot-beaglebone-2011.09+git-r30.img /media/BEAGLEBONE/u-boot.img

        sudo cp MLO-beaglebone-2011.09+git /media/BEAGLEBONE/MLO

        sudo echo "optargs=quiet" > /media/BEAGLEBONE/uEnv.txt

sudo tar zxv -C /media/Angstrom -f Angstrom-console-image-eglibc-ipk-v2012.12-beaglebone.rootfs.tar.gz

sudo tar zxv -C /media/Angstrom -f modules-3.8.13-r23a-beaglebone.tgz

The SD card now is ready for the Beaglebone. Demount the partitions.

Make sure when the system boots for the first time to run:

    depmod -a



Do you know of any good guides for testing the kernel? I didn't know you could test it before flashing it.

That's what the SD card is used for. Once that is complete you have to build a flasher. But you can complete all software development using the SD card.


I'm also still trying to work through bitbake and just building the custom kernel. It's been difficult to distinguish how the images get built, since there are lots of defconfigs (ti-linux-psp-3.2 vs. linux-mainline-3.8.0) and I'm unsure how they all get tied together.

01 - Building Angstrom-v2012.12

This guide details the process of building a console image from the Angstrom source on an Xubuntu 12.04.3 32-bit Linux host.

Prerequisites

Then we need some additional development tools. Enter the following:

sudo apt-get install sed wget cvs subversion git-core coreutils unzip texi2html texinfo docbook-utils gawk python-pysqlite2 diffstat help2man make gcc build-essential g++ desktop-file-utils chrpath


/bin/sh (ls -l /bin/sh) is symbolically linked to dash. "dash" is a POSIX compliant shell that is much smaller than "bash". Some broken shell scripts still make use of bash extensions while calling into /bin/sh. To work around this issue call "sudo dpkg-reconfigure dash" and select No when it asks you to install dash as /bin/sh.

Download Angstrom Distribution and Build

To download the distribution for Beaglebone enter the following commands:

    cd ~/Projects

    mkdir angstrom-v2012.12

    cd ./angstrom-v2012.12

    git clone git://github.com/Angstrom-distribution/setup-scripts.git

    cd setup-scripts

    MACHINE=beaglebone ./oebb.sh config beaglebone

    MACHINE=beaglebone ./oebb.sh update


And to compile the console version of the distribution:

        . ~/.oe/environment-angstromv2012.12

        bitbake console-image

During these steps the computer must be connected to the Internet.

Custom Kernel

Delete the contents of the directory

/home/rlyon/Projects/angstrom-v2012.12/setup-scripts/build/tmp-angstrom_v2012_12-eglibc/deploy/images/beaglebone

Clean distribution with following commands

        bitbake u-boot-denx -c cleansstate

        bitbake virtual/kernel -c cleansstate

        bitbake -c clean console-image

Create the boot files MLO and u-boot with the following command:

        bitbake u-boot-denx

Set up the custom kernel we require:

        bitbake virtual/kernel -c configure

cd ~/Projects/angstrom-v2012.12/setup-scripts/build/tmp-angstrom_v2012_12-eglibc/work/beaglebone-angstrom-linux-gnueabi/linux-mainline-3.8.13-r23a/git

        make ARCH=arm menuconfig

Disable watchdog shut down:

        -> Device Drivers
        -> Watchdog Timer Support
            -*-   WatchDog Timer Driver Core
            [*]   Disable watchdog shutdown on close
            *** Watchdog Device Drivers ***
            < >   Software watchdog
            < >   Synopsys DesignWare watchdog
            < >   MPcore watchdog
            <*>   OMAP Watchdog
            <*>   TWL4030 Watchdog
            < >   Max63xx watchdog

Enable NAT:

        -> Networking support (NET [=y])
        -> Networking options
-> Network packet filtering framework (Netfilter) (NETFILTER [=y])
                -> Core Netfilter Configuration
                    <M> Netfilter connection tracking support
                    {M} Netfilter Xtables support (required for ip_tables)
                    *** Xtables combined modules ***
                        <M> "NFLOG" target support
                        <M> "conntrack" connection tracking match support
                        <M> "state" match support
                -> IP: Netfilter Configuration
<M> IPv4 connection tracking support (required for NAT) [*] proc/sysctl compatibility with old connection tracking (NEW)
                    <M> IP Userspace queueing via NETLINK (OBSOLETE)
                    <M> IP tables support (required for filtering/masq/NAT)
                        <M> "ah" match support
                        <M> "ecn" match support
                        <M> "rpfilter" reverse path filter match support
                        <M> "ttl" match support
                        <M> Packet filtering
                            <M> REJECT target support
                        <M> ULOG target support
                        <M> IPv4 NAT
                            <M> MASQUERADE target support
                            <M> NETMAP target support
                            <M> REDIRECT target support
                        <M> Packet mangling


Then copy the configuration file:

~/Projects/angstrom-v2012.12/setup-scripts/build/tmp-angstrom_v2012_12-eglibc/work/beaglebone-angstrom-linux-gnueabi/linux-mainline-3.8.13-r23a/git/.config

to

~/Projects/angstrom-v2012.12/setup-scripts/build/tmp-angstrom_v2012_12-eglibc/work/beaglebone-angstrom-linux-gnueabi/linux-mainline-3.8.13-r23a/git/.config.old
~/Projects/angstrom-v2012.12/setup-scripts/build/tmp-angstrom_v2012_12-eglibc/work/beaglebone-angstrom-linux-gnueabi/linux-mainline-3.8.13-r23a/git/defconfig
~/Projects/angstrom-v2012.12/setup-scripts/sources/meta-beagleboard/common-bsp/recipes-kernel/linux/linux-mainline-3.8/beaglebone/defconfig
~/Projects/angstrom-v2012.12/setup-scripts/sources/meta-ti/recipes-kernel/linux/linux-ti33x-psp-3.1/beaglebone/defconfig
~/Projects/angstrom-v2012.12/setup-scripts/sources/meta-ti/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/defconfig

Then compile:

        cd ~/Projects/angstrom-v2012.12/setup-scripts

        bitbake virtual/kernel

        bitbake console-image

Maybe this will give you some ideas.


Thanks again,
Mark

On Wednesday, February 12, 2014 9:39:59 AM UTC-5, [email protected] wrote:

    Some further comments:

        You don't need to rebuild MLO/u-boot.img
        You don't need a serial cable. It can be helpful for
    debugging, but thats all.
        Have you got the wifi device working correctly on your BBB?

        I would recommend you get an micro SD card for testing your
    new kernel, before you copy it to eMMC.

    Regards ...

    On Tuesday, February 11, 2014 6:45:31 AM UTC+11, Mark Hatch wrote:


        Hi friends,

        Total newbie here, so forgive me.

        I
        
<http://www.meadios.com/2012/01/building-angstrom-using-bitbake-and-openembedded/>'m
        trying to add functionality to iptables so I can use the BBB
        as a ad-hoc "router", sharing it's Ethernet connection with
        others.

        From what I've gleamed so far I need to add that functionality
        by recompiling the kernel.

        So following the links at
        http://www.angstrom-distribution.org/
        <http://www.angstrom-distribution.org/> i cloned the
        setup-scripts.

        |MACHINE=beaglebone ./oebb.sh config beaglebone|

        |MACHINE=beagleboard ./oebb.sh update|

        |. environment-angstrom-v2013.06
        |

        |bitbake -c menuconfig virtual/kernel|


        I then change the options I need, but when I built it made a
        zImage file... Which confuses me.

        Now what I don't understand is that the image I want should be
        based off the regular systemd image.

         *

            bitbake systemd-image

        How do I update the kernel configuration from the systemd
        image without just building the regular image?

        A step-by-step explanation would be awesome, cause I've never
        customized/built the linux kernel before.
        I also do not have a serial cable yet. Is this necessary for
        running a custom kernel? Do options in u-boot need to be changed?

        I'm sure I'm asking all the wrong questions, but would really
        appreciate some help!

        Here are the options that I need:

        Networking  ---->
          Networking options  ---->
           Network packet filtering framework (Netfilter)--->
            Core Netfilter Configuration ---->
             <*> Netfilter connection tracking support
             <*> Netfilter Xtables support (required for ip_tables)
             <*>   "NFLOG" target support
             <*>   "conntrack" connection tracking match support
             <*>   "state" match support
            IP: Netfilter Configuration --->
             <*> IPv4 connection tracking support (required for NAT)
             <*> IP tables support (required for filtering/masq/NAT)
             <*>   Packet Filtering
             <*>     REJECT target support
             <*>   Full NAT
             <*>     MASQUERADE target support
             <*> Packet mangling


--
For more options, visit http://beagleboard.org/discuss
--- You received this message because you are subscribed to the Google Groups "BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to