summaryrefslogtreecommitdiffstats
path: root/meta-ti-extras
diff options
context:
space:
mode:
Diffstat (limited to 'meta-ti-extras')
-rw-r--r--meta-ti-extras/recipes-ti/beagleboard/beaglebone-capes.bb26
-rwxr-xr-xmeta-ti-extras/recipes-ti/beagleboard/beaglebone-capes/cape-stop.sh14
-rw-r--r--meta-ti-extras/recipes-ti/beagleboard/beaglebone-capes/cape.service11
-rwxr-xr-xmeta-ti-extras/recipes-ti/beagleboard/beaglebone-capes/cape.sh22
-rw-r--r--meta-ti-extras/recipes-ti/beagleboard/beaglebone-getting-started.bb21
-rw-r--r--meta-ti-extras/recipes-ti/beagleboard/gadget-init.bb60
-rw-r--r--meta-ti-extras/recipes-ti/beagleboard/gadget-init/bone-gmass-eject.rules1
-rwxr-xr-xmeta-ti-extras/recipes-ti/beagleboard/gadget-init/g-ether-load.sh46
-rwxr-xr-xmeta-ti-extras/recipes-ti/beagleboard/gadget-init/g-ether-start-service.sh10
-rwxr-xr-xmeta-ti-extras/recipes-ti/beagleboard/gadget-init/g-storage-reinsert.sh4
-rw-r--r--meta-ti-extras/recipes-ti/beagleboard/gadget-init/network-gadget-init.service11
-rw-r--r--meta-ti-extras/recipes-ti/beagleboard/gadget-init/storage-gadget-init.service11
-rw-r--r--meta-ti-extras/recipes-ti/beagleboard/gadget-init/udhcpd.conf5
-rw-r--r--meta-ti-extras/recipes-ti/beagleboard/gadget-init/udhcpd.rules2
-rw-r--r--meta-ti-extras/recipes-ti/beagleboard/gadget-init/udhcpd.service12
-rwxr-xr-xmeta-ti-extras/recipes-ti/beagleboard/gadget-init/update-image-info-on-mmcblk0p1.sh37
16 files changed, 293 insertions, 0 deletions
diff --git a/meta-ti-extras/recipes-ti/beagleboard/beaglebone-capes.bb b/meta-ti-extras/recipes-ti/beagleboard/beaglebone-capes.bb
new file mode 100644
index 00000000..ceefe0d6
--- /dev/null
+++ b/meta-ti-extras/recipes-ti/beagleboard/beaglebone-capes.bb
@@ -0,0 +1,26 @@
1DESCRIPTION = "Userspace setup for beaglebone capes"
2
3LICENSE = "MIT"
4LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
5
6PR = "r4"
7
8inherit allarch
9
10SRC_URI = "file://cape.service \
11 file://cape.sh \
12 file://cape-stop.sh \
13 "
14
15do_install() {
16 install -d ${D}${base_libdir}/systemd/system/
17 install -m 0644 ${WORKDIR}/cape.service ${D}${base_libdir}/systemd/system
18
19 install -d ${D}${base_libdir}/systemd/system/basic.target.wants
20 ln -sf ../cape.service ${D}${base_libdir}/systemd/system/basic.target.wants/
21
22 install -d ${D}${bindir}
23 install -m 0755 ${WORKDIR}/cape*.sh ${D}${bindir}
24}
25
26FILES:${PN} += "${base_libdir}/systemd/system"
diff --git a/meta-ti-extras/recipes-ti/beagleboard/beaglebone-capes/cape-stop.sh b/meta-ti-extras/recipes-ti/beagleboard/beaglebone-capes/cape-stop.sh
new file mode 100755
index 00000000..222a010d
--- /dev/null
+++ b/meta-ti-extras/recipes-ti/beagleboard/beaglebone-capes/cape-stop.sh
@@ -0,0 +1,14 @@
1#!/bin/sh
2for eeprom in /sys/bus/i2c/devices/3-005*/eeprom ; do
3 PARTNUMBER=$(hexdump -e '8/1 "%c"' $eeprom -s 58 -n16)
4 case $PARTNUMBER in
5 "BB-BONE-LCD3-01.")
6 echo "Turning off backlight for LCD3 cape"
7 i2cset -f -y 1 0x24 0x07 0x00;;
8 "BB-BONE-LCD4"*)
9 echo "Turning off backlight for LCD4 cape"
10 i2cset -f -y 1 0x24 0x07 0x00;;
11 *)
12 echo "unknown cape: $PARTNUMBER";;
13 esac
14done
diff --git a/meta-ti-extras/recipes-ti/beagleboard/beaglebone-capes/cape.service b/meta-ti-extras/recipes-ti/beagleboard/beaglebone-capes/cape.service
new file mode 100644
index 00000000..ce0db719
--- /dev/null
+++ b/meta-ti-extras/recipes-ti/beagleboard/beaglebone-capes/cape.service
@@ -0,0 +1,11 @@
1[Unit]
2Description=Beaglebone cape support
3
4[Service]
5Type=oneshot
6RemainAfterExit=yes
7ExecStart=/usr/bin/cape.sh
8ExecStop=/usr/bin/cape-stop.sh
9
10[Install]
11WantedBy=basic.target
diff --git a/meta-ti-extras/recipes-ti/beagleboard/beaglebone-capes/cape.sh b/meta-ti-extras/recipes-ti/beagleboard/beaglebone-capes/cape.sh
new file mode 100755
index 00000000..c279349d
--- /dev/null
+++ b/meta-ti-extras/recipes-ti/beagleboard/beaglebone-capes/cape.sh
@@ -0,0 +1,22 @@
1#!/bin/sh
2for eeprom in /sys/bus/i2c/devices/3-005*/eeprom ; do
3 PARTNUMBER=$(hexdump -e '8/1 "%c"' $eeprom -s 58 -n16)
4 case $PARTNUMBER in
5 "BB-BONE-LCD3-01.")
6 echo "Turning on backlight for LCD3 cape"
7 i2cset -f -y 1 0x24 0x07 0x09
8 i2cset -f -y 1 0x24 0x08 0x60;;
9 "BB-BONE-LCD4"*)
10 echo "Turning on backlight for LCD4 cape"
11 i2cset -f -y 1 0x24 0x07 0x09
12 i2cset -f -y 1 0x24 0x08 0x60;;
13 "BB-BONE-WTHR-01.")
14 echo "Initializing I2C devices"
15 echo sht21 0x40 > /sys/class/i2c-adapter/i2c-3/new_device
16 echo bmp085 0x77 > /sys/class/i2c-adapter/i2c-3/new_device
17 echo tsl2550 0x39 > /sys/class/i2c-adapter/i2c-3/new_device
18 echo 1 > /sys/bus/i2c/devices/3-0039/operating_mode;;
19 *)
20 echo "unknown cape: $PARTNUMBER";;
21 esac
22done
diff --git a/meta-ti-extras/recipes-ti/beagleboard/beaglebone-getting-started.bb b/meta-ti-extras/recipes-ti/beagleboard/beaglebone-getting-started.bb
new file mode 100644
index 00000000..25538ace
--- /dev/null
+++ b/meta-ti-extras/recipes-ti/beagleboard/beaglebone-getting-started.bb
@@ -0,0 +1,21 @@
1SUMMARY = "BeagleBone Getting Started Guide"
2
3PR = "r22"
4
5inherit allarch
6
7LICENSE = "CC-BY-SA-3.0 & GPLv3+ & MIT & PD"
8LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=f6f02761e31334c48f7021fb94c89aaa"
9
10SRCREV = "05bedba192646152b7bc80b0accaea75aef864e5"
11SRC_URI = "git://github.com/jadonk/beaglebone-getting-started.git;protocol=https;branch=master"
12
13S = "${WORKDIR}/git"
14
15do_install() {
16 install -d ${D}${datadir}/${PN}
17 cp -R --no-dereference --preserve=mode,links ${S}/* ${D}${datadir}/${PN}
18}
19
20FILES:${PN} += "${datadir}/${PN}"
21INSANE_SKIP:${PN} = "file-rdeps"
diff --git a/meta-ti-extras/recipes-ti/beagleboard/gadget-init.bb b/meta-ti-extras/recipes-ti/beagleboard/gadget-init.bb
new file mode 100644
index 00000000..3ab00ec3
--- /dev/null
+++ b/meta-ti-extras/recipes-ti/beagleboard/gadget-init.bb
@@ -0,0 +1,60 @@
1DESCRIPTION = "Units to initialize usb gadgets"
2
3PR = "r19"
4
5LICENSE = "MIT"
6LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
7
8COMPATIBLE_MACHINE = "(ti33x)"
9PACKAGE_ARCH = "${MACHINE_ARCH}"
10
11SRC_URI = "file://storage-gadget-init.service \
12 file://network-gadget-init.service \
13 file://udhcpd.service \
14 file://udhcpd.conf \
15 file://bone-gmass-eject.rules \
16 file://udhcpd.rules \
17 file://g-storage-reinsert.sh \
18 file://g-ether-start-service.sh \
19 file://g-ether-load.sh \
20 file://update-image-info-on-mmcblk0p1.sh \
21 "
22
23do_install() {
24 install -d ${D}${base_libdir}/systemd/system/basic.target.wants
25 install -m 0644 ${WORKDIR}/*.service ${D}${base_libdir}/systemd/system
26
27 for i in ${WORKDIR}/storage-gadget-init.service ; do
28 install -m 0644 $i ${D}${base_libdir}/systemd/system
29 ln -sf ../$(basename $i) ${D}${base_libdir}/systemd/system/basic.target.wants/
30 done
31
32 install -d ${D}${sysconfdir}/udev/rules.d
33 install -m 0644 ${WORKDIR}/*.rules ${D}${sysconfdir}/udev/rules.d
34 install -m 0644 ${WORKDIR}/*.conf ${D}${sysconfdir}
35
36 install -d ${D}${bindir}
37 install -m 0755 ${WORKDIR}/*.sh ${D}${bindir}
38}
39
40PACKAGES =+ "${PN}-storage ${PN}-network ${PN}-udhcpd"
41
42ALLOW_EMPTY:${PN} = "1"
43
44FILES:${PN}-storage = "${base_libdir}/systemd/system/storage-gadget-init.service \
45 ${base_libdir}/systemd/system/basic.target.wants/storage-gadget-init.service \
46 ${bindir}/g-storage-reinsert.sh \
47 ${bindir}/update-image-info-on-mmcblk0p1.sh \
48 ${sysconfdir}/udev/rules.d/bone-gmass-eject.rules"
49
50FILES:${PN}-network = "${base_libdir}/systemd/system/network-gadget-init.service \
51 ${base_libdir}/systemd/system/basic.target.wants/network-gadget-init.service \
52 ${bindir}/g-ether-load.sh \
53 ${bindir}/g-ether-start-service.sh \
54 ${sysconfdir}/udev/rules.d/udhcpd.rules"
55
56FILES:${PN}-udhcpd = "${base_libdir}/systemd/system/udhcpd.service \
57 ${base_libdir}/systemd/system/basic.target.wants/udhcpd.service \
58 ${sysconfdir}/udhcpd.conf"
59
60RRECOMMENDS:${PN} = "${PN}-storage ${PN}-network ${PN}-udhcpd"
diff --git a/meta-ti-extras/recipes-ti/beagleboard/gadget-init/bone-gmass-eject.rules b/meta-ti-extras/recipes-ti/beagleboard/gadget-init/bone-gmass-eject.rules
new file mode 100644
index 00000000..ee6f93e2
--- /dev/null
+++ b/meta-ti-extras/recipes-ti/beagleboard/gadget-init/bone-gmass-eject.rules
@@ -0,0 +1 @@
SUBSYSTEM=="block",ACTION=="change",KERNEL=="mmcblk0p1",RUN+="/usr/bin/g-ether-start-service.sh"
diff --git a/meta-ti-extras/recipes-ti/beagleboard/gadget-init/g-ether-load.sh b/meta-ti-extras/recipes-ti/beagleboard/gadget-init/g-ether-load.sh
new file mode 100755
index 00000000..f9400649
--- /dev/null
+++ b/meta-ti-extras/recipes-ti/beagleboard/gadget-init/g-ether-load.sh
@@ -0,0 +1,46 @@
1#!/bin/sh
2
3function get_devmem()
4{
5 /usr/bin/devmem2 $1 | grep ": " | cut -d ":" -f 2|cut -d "x" -f 2
6}
7
8function hex_to_mac_addr()
9{
10 addr=$1
11 n=0
12 mac_addr=$(echo ${addr} | while read -r -n2 c; do
13 if [ ! -z "$c" ]; then
14 if [ $n -ne 0 ] ; then
15 echo -n ":${c}"
16 else
17 echo -n "${c}"
18 fi
19 fi
20 n=$(($n+1))
21 done)
22 echo ${mac_addr}
23}
24
25function reverse_bytes()
26{
27 addr=$1
28 New_addr=$(echo ${addr} | while read -r -n2 c; do
29 if [ ! -z "$c" ]; then
30 New_addr=${c}${New_addr}
31 else echo
32 echo ${New_addr}
33 fi
34 done)
35 echo ${New_addr}
36}
37
38DEVMEM_ADDR_LO=$(get_devmem 0x44e10638|bc)
39DEVMEM_ADDR_LO=$(reverse_bytes ${DEVMEM_ADDR_LO})
40
41DEVMEM_ADDR_HI=$(get_devmem 0x44e1063C)
42DEVMEM_ADDR_HI=$(reverse_bytes ${DEVMEM_ADDR_HI})
43
44DEV_ADDR=$(hex_to_mac_addr "${DEVMEM_ADDR_HI}${DEVMEM_ADDR_LO}")
45
46modprobe g_ether host_addr=${DEV_ADDR}
diff --git a/meta-ti-extras/recipes-ti/beagleboard/gadget-init/g-ether-start-service.sh b/meta-ti-extras/recipes-ti/beagleboard/gadget-init/g-ether-start-service.sh
new file mode 100755
index 00000000..6e73b155
--- /dev/null
+++ b/meta-ti-extras/recipes-ti/beagleboard/gadget-init/g-ether-start-service.sh
@@ -0,0 +1,10 @@
1#!/bin/sh
2if [ -a /sys/devices/platform/omap/musb-ti81xx/musb-hdrc.0/gadget/lun0/file ]
3then
4 x=$(cat /sys/devices/platform/omap/musb-ti81xx/musb-hdrc.0/gadget/lun0/file)
5 if [ -z "$x" ]
6 then
7 /bin/systemctl stop storage-gadget-init.service
8 /bin/systemctl start network-gadget-init.service
9 fi
10fi
diff --git a/meta-ti-extras/recipes-ti/beagleboard/gadget-init/g-storage-reinsert.sh b/meta-ti-extras/recipes-ti/beagleboard/gadget-init/g-storage-reinsert.sh
new file mode 100755
index 00000000..d358640a
--- /dev/null
+++ b/meta-ti-extras/recipes-ti/beagleboard/gadget-init/g-storage-reinsert.sh
@@ -0,0 +1,4 @@
1#!/bin/sh
2/bin/systemctl stop storage-gadget-init.service
3/bin/systemctl stop network-gadget-init.service
4/bin/systemctl start storage-gadget-init.service
diff --git a/meta-ti-extras/recipes-ti/beagleboard/gadget-init/network-gadget-init.service b/meta-ti-extras/recipes-ti/beagleboard/gadget-init/network-gadget-init.service
new file mode 100644
index 00000000..0ee29147
--- /dev/null
+++ b/meta-ti-extras/recipes-ti/beagleboard/gadget-init/network-gadget-init.service
@@ -0,0 +1,11 @@
1[Unit]
2Description=Start USB Ethernet gadget
3Conflicts=storage-gadget-init.service
4
5[Service]
6RemainAfterExit=yes
7ExecStart=/usr/bin/g-ether-load.sh
8ExecStop=/sbin/rmmod g_ether
9
10[Install]
11WantedBy=gether.target
diff --git a/meta-ti-extras/recipes-ti/beagleboard/gadget-init/storage-gadget-init.service b/meta-ti-extras/recipes-ti/beagleboard/gadget-init/storage-gadget-init.service
new file mode 100644
index 00000000..9a8513e8
--- /dev/null
+++ b/meta-ti-extras/recipes-ti/beagleboard/gadget-init/storage-gadget-init.service
@@ -0,0 +1,11 @@
1[Unit]
2Description=Start usb mass storage gadget
3After=dev-mmcblk0p1.device
4
5[Service]
6RemainAfterExit=yes
7ExecStart=/sbin/modprobe g_mass_storage file=/dev/mmcblk0p1 cdrom=0 stall=0 removable=1 nofua=1
8ExecStop=/sbin/rmmod g_mass_storage
9
10[Install]
11WantedBy=basic.target
diff --git a/meta-ti-extras/recipes-ti/beagleboard/gadget-init/udhcpd.conf b/meta-ti-extras/recipes-ti/beagleboard/gadget-init/udhcpd.conf
new file mode 100644
index 00000000..3bcf00f0
--- /dev/null
+++ b/meta-ti-extras/recipes-ti/beagleboard/gadget-init/udhcpd.conf
@@ -0,0 +1,5 @@
1start 192.168.7.1
2end 192.168.7.1
3interface usb0
4max_leases 1
5option subnet 255.255.255.252
diff --git a/meta-ti-extras/recipes-ti/beagleboard/gadget-init/udhcpd.rules b/meta-ti-extras/recipes-ti/beagleboard/gadget-init/udhcpd.rules
new file mode 100644
index 00000000..db65f9ac
--- /dev/null
+++ b/meta-ti-extras/recipes-ti/beagleboard/gadget-init/udhcpd.rules
@@ -0,0 +1,2 @@
1SUBSYSTEM=="net",ACTION=="add",KERNEL=="usb0",RUN+="/sbin/ifconfig usb0 192.168.7.2 netmask 255.255.255.252",RUN+="/bin/systemctl start udhcpd.service"
2SUBSYSTEM=="net",ACTION=="remove",KERNEL=="usb0",RUN+="/bin/systemctl stop udhcpd.service"
diff --git a/meta-ti-extras/recipes-ti/beagleboard/gadget-init/udhcpd.service b/meta-ti-extras/recipes-ti/beagleboard/gadget-init/udhcpd.service
new file mode 100644
index 00000000..1f4ac688
--- /dev/null
+++ b/meta-ti-extras/recipes-ti/beagleboard/gadget-init/udhcpd.service
@@ -0,0 +1,12 @@
1[Unit]
2Description=DHCP server for USB0 network gadget
3After=dev-usb0.device
4Conflicts=storage-gadget-init.service
5
6[Service]
7ExecStart=/usr/sbin/udhcpd -f -S /etc/udhcpd.conf
8ExecStop=/bin/kill -TERM $MAINPID
9KillSignal=SIGINT
10
11[Install]
12WantedBy=gether.target
diff --git a/meta-ti-extras/recipes-ti/beagleboard/gadget-init/update-image-info-on-mmcblk0p1.sh b/meta-ti-extras/recipes-ti/beagleboard/gadget-init/update-image-info-on-mmcblk0p1.sh
new file mode 100755
index 00000000..a4daf734
--- /dev/null
+++ b/meta-ti-extras/recipes-ti/beagleboard/gadget-init/update-image-info-on-mmcblk0p1.sh
@@ -0,0 +1,37 @@
1#!/bin/sh
2mount /dev/mmcblk0p1 /mnt
3echo "Image info snapshot" > /mnt/info.txt
4
5echo >> /mnt/info.txt
6echo "/etc/angstrom-version:" >> /mnt/info.txt
7cat /etc/angstrom-version >> /mnt/info.txt
8
9echo >> /mnt/info.txt
10echo "/proc/cpuinfo:" >> /mnt/info.txt
11cat /proc/cpuinfo >> /mnt/info.txt
12
13echo >> /mnt/info.txt
14echo "uname -a:" >> /mnt/info.txt
15uname -a >> /mnt/info.txt
16
17echo >> /mnt/info.txt
18echo "/proc/cmdline:" >> /mnt/info.txt
19cat /proc/cmdline >> /mnt/info.txt
20
21echo >> /mnt/info.txt
22echo "ifconfig:" >> /mnt/info.txt
23ifconfig >> /mnt/info.txt
24
25echo >> /mnt/info.txt
26echo "/etc/angstrom-build-info:" >> /mnt/info.txt
27cat /etc/angstrom-build-info >> /mnt/info.txt
28
29echo >> /mnt/info.txt
30echo "/etc/image-version-info:" >> /mnt/info.txt
31cat /etc/image-version-info >> /mnt/info.txt
32
33echo >> /mnt/info.txt
34echo "opkg list-installed:" >> /mnt/info.txt
35opkg list-installed >> /mnt/info.txt
36
37umount /mnt