commit d8eed29e3068a6a2f552b184a4234ebbe7e56f1f Author: Stefan Eichenberger Date: Wed Apr 27 14:26:40 2016 +0200 meta-nmrouter: initial commit with a simple test image This commit contains a valid machine configuration and a recipe for creating a NetModule router image. diff --git a/conf/layer.conf b/conf/layer.conf new file mode 100644 index 0000000..8f15885 --- /dev/null +++ b/conf/layer.conf @@ -0,0 +1,15 @@ +# We have a conf and classes directory, add to BBPATH +BBPATH .= ":${LAYERDIR}" + +# We have recipes-* directories, add to BBFILES +BBFILES += "${LAYERDIR}/recipes-*/*/*.bb ${LAYERDIR}/recipes-*/*/*.bbappend" + +BBFILE_COLLECTIONS += "nrhw15" +BBFILE_PATTERN_nrhw15 = "^${LAYERDIR}/" +BBFILE_PRIORITY_nrhw15 = "1" + +# This should only be incremented on significant changes that will +# cause compatibility issues with other layers +LAYERVERSION_nrhw15 = "1" + +LAYERDEPENDS_nrhw15 = "core" diff --git a/recipes-core/busybox/busybox/no_rfkill.cfg b/recipes-core/busybox/busybox/no_rfkill.cfg new file mode 100644 index 0000000..f840ecd --- /dev/null +++ b/recipes-core/busybox/busybox/no_rfkill.cfg @@ -0,0 +1 @@ +# CONFIG_RFKILL is not set diff --git a/recipes-core/busybox/busybox_%.bbappend b/recipes-core/busybox/busybox_%.bbappend new file mode 100644 index 0000000..64cdefc --- /dev/null +++ b/recipes-core/busybox/busybox_%.bbappend @@ -0,0 +1,12 @@ +# Example use of configuration fragments for busybox, which uses the same +# mechanism as the linux-yocto kernel recipe. +# +# The entries here will override any entries in the base busybox recipe +# +# More details can be found in the Kernel Dev Manual +# http://www.yoctoproject.org/docs/current/kernel-dev/kernel-dev.html#changing-the-configuration +FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" + +SRC_URI += " \ + file://no_rfkill.cfg \ + " diff --git a/recipes-core/devmem2/devmem2.bb b/recipes-core/devmem2/devmem2.bb new file mode 100644 index 0000000..5f181e8 --- /dev/null +++ b/recipes-core/devmem2/devmem2.bb @@ -0,0 +1,22 @@ +SUMMARY = "Memory access tool" +DESCRIPTION = "Development tool to access memory addresses via /dev/mem." +AUTHOR = "Jan-Derk Bakker (jdb@lartmaker.nl)" +HOMEPAGE = "http://www.lartmaker.nl/lartware/port/devmem2.c" + +SECTION = "developement" +LICENSE = "GPLv2+" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6" +PR = "r0" + +SRC_URI = "file://devmem2.c" + +S = "${WORKDIR}" + +do_compile() { + ${CC} devmem2.c -o devmem2 +} + +do_install () { + install -d ${D}${bindir} + install -m 0755 devmem2 ${D}${bindir} +} \ No newline at end of file diff --git a/recipes-core/devmem2/devmem2/devmem2.c b/recipes-core/devmem2/devmem2/devmem2.c new file mode 100644 index 0000000..0c1b5b3 --- /dev/null +++ b/recipes-core/devmem2/devmem2/devmem2.c @@ -0,0 +1,132 @@ +/* + * devmem2.c: Simple program to read/write from/to any location in memory. + * + * Copyright (C) 2000, Jan-Derk Bakker (J.D.Bakker@its.tudelft.nl) + * + * + * This software has been developed for the LART computing board + * (http://www.lart.tudelft.nl/). The development has been sponsored by + * the Mobile MultiMedia Communications (http://www.mmc.tudelft.nl/) + * and Ubiquitous Communications (http://www.ubicom.tudelft.nl/) + * projects. + * + * The author can be reached at: + * + * Jan-Derk Bakker + * Information and Communication Theory Group + * Faculty of Information Technology and Systems + * Delft University of Technology + * P.O. Box 5031 + * 2600 GA Delft + * The Netherlands + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define FATAL do { fprintf(stderr, "Error at line %d, file %s (%d) [%s]\n", \ + __LINE__, __FILE__, errno, strerror(errno)); exit(1); } while(0) + +#define MAP_SIZE 4096UL +#define MAP_MASK (MAP_SIZE - 1) + +int main(int argc, char **argv) { + int fd; + void *map_base, *virt_addr; + unsigned long read_result, writeval; + off_t target; + int access_type = 'w'; + + if(argc < 2) { + fprintf(stderr, "\nUsage:\t%s { address } [ type [ data ] ]\n" + "\taddress : memory address to act upon\n" + "\ttype : access operation type : [b]yte, [h]alfword, [w]ord\n" + "\tdata : data to be written\n\n", + argv[0]); + exit(1); + } + target = strtoul(argv[1], 0, 0); + + if(argc > 2) + access_type = tolower(argv[2][0]); + + + if((fd = open("/dev/mem", O_RDWR | O_SYNC)) == -1) FATAL; + printf("/dev/mem opened.\n"); + fflush(stdout); + + /* Map one page */ + map_base = mmap(0, MAP_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, target & ~MAP_MASK); + if(map_base == (void *) -1) FATAL; + printf("Memory mapped at address %p.\n", map_base); + fflush(stdout); + + virt_addr = map_base + (target & MAP_MASK); + switch(access_type) { + case 'b': + read_result = *((unsigned char *) virt_addr); + break; + case 'h': + read_result = *((unsigned short *) virt_addr); + break; + case 'w': + read_result = *((unsigned long *) virt_addr); + break; + default: + fprintf(stderr, "Illegal data type '%c'.\n", access_type); + exit(2); + } + printf("Value at address 0x%lX (%p): 0x%lX\n", target, virt_addr, read_result); + fflush(stdout); + + if(argc > 3) { + writeval = strtoul(argv[3], 0, 0); + switch(access_type) { + case 'b': + *((unsigned char *) virt_addr) = writeval; + read_result = *((unsigned char *) virt_addr); + break; + case 'h': + *((unsigned short *) virt_addr) = writeval; + read_result = *((unsigned short *) virt_addr); + break; + case 'w': + *((unsigned long *) virt_addr) = writeval; + read_result = *((unsigned long *) virt_addr); + break; + } + printf("Written 0x%lX; readback 0x%lX\n", writeval, read_result); + fflush(stdout); + } + + if(munmap(map_base, MAP_SIZE) == -1) FATAL; + close(fd); + return 0; +} + + diff --git a/recipes-core/images/nmrouter-image.bb b/recipes-core/images/nmrouter-image.bb new file mode 100644 index 0000000..0d04d6e --- /dev/null +++ b/recipes-core/images/nmrouter-image.bb @@ -0,0 +1,60 @@ +inherit core-image + +SUMMARY = "Test image" + +UBOOT_CONFIG = "sdcard" + +KERNEL_IMAGETYPE = "uImage" + +IMAGE_FSTYPES_append = " tar.gz " + +IMAGE_FEATURES += " \ + tools-debug \ + " + +IMAGE_FEATURES += " \ + package-management \ + ssh-server-openssh \ + " + +BENCH_TOOLS += " \ + tcpdump \ + lrzsz \ + lmbench \ + dbench \ + memtester \ + nbench-byte \ + tiobench \ + iozone3 \ + iperf \ + strongswan \ + " + +BENCH_TOOLS_cortexa9hf-neon_append += " cpuburn-neon " + +IMAGE_INSTALL += " \ + linux-firmware \ + linux-firmware-ath9k \ + hostapd \ + iw \ + crda \ + wpa-supplicant \ + openssh-sftp-server \ + bash \ + iproute2 \ + ethtool \ + i2c-tools \ + lrzsz \ + devmem2 \ + openvpn \ + iptables \ + pciutils \ + kernel-modules \ + ${BENCH_TOOLS} \ + " + +IMAGE_INSTALL_cortex9hf-neon_append = " kernel-devicetree " +IMAGE_INSTALL_cortex9hf_append = " kernel-devicetree " + +LICENSE = "BSD" +