meta-digi-del: add busybox version 1.20.2

Signed-off-by: Javier Viguera <javier.viguera@digi.com>
This commit is contained in:
Javier Viguera 2012-11-28 11:23:34 +01:00
parent e5e72b240d
commit 9300fecf72
17 changed files with 1744 additions and 0 deletions

View File

@ -0,0 +1,109 @@
From: Javier Viguera <javier.viguera@digi.com>
Date: Wed, 20 Apr 2011 11:08:27 +0200
Subject: [PATCH] del-baudrates
http://thread.gmane.org/gmane.linux.busybox/22612
Signed-off-by: Javier Viguera <javier.viguera@digi.com>
---
libbb/speed_table.c | 67 ++++++++++++++++++++++++++++++++++++++++++-----------
1 file changed, 54 insertions(+), 13 deletions(-)
diff --git a/libbb/speed_table.c b/libbb/speed_table.c
index 45159f1..9806a60 100644
--- a/libbb/speed_table.c
+++ b/libbb/speed_table.c
@@ -29,30 +29,68 @@ static const struct speed_map speeds[] = {
{B2400, 2400},
{B4800, 4800},
{B9600, 9600},
-#ifdef B19200
- {B19200, 19200},
+/* To fit in 16 bits with larget values, scale by 256 or by 10000 and mark */
+#define MARKER_MASK 0xc000U
+#define MARKER_256 0x8000U
+#define MARKER_10k 0x4000U
+#define SCALE_256(x) ((x)/256 | MARKER_256)
+#define SCALE_10k(x) ((x)/10000 | MARKER_10k)
+#define DO_256(x) {B##x, SCALE_256(x)}
+#define DO_10k(x) {B##x, SCALE_10k(x)}
+#ifdef B19200
+ DO_256(19200),
#elif defined(EXTA)
- {EXTA, 19200},
+ {EXTA, SCALE_256(19200)},
#endif
-#ifdef B38400
- {B38400, 38400/256 + 0x8000U},
+#ifdef B38400
+ DO_256(38400),
#elif defined(EXTB)
- {EXTB, 38400/256 + 0x8000U},
+ {EXTB, SCALE_256(38400)},
#endif
#ifdef B57600
- {B57600, 57600/256 + 0x8000U},
+ DO_256(57600),
#endif
#ifdef B115200
- {B115200, 115200/256 + 0x8000U},
+ DO_256(115200),
#endif
#ifdef B230400
- {B230400, 230400/256 + 0x8000U},
+ DO_256(230400),
#endif
#ifdef B460800
- {B460800, 460800/256 + 0x8000U},
+ DO_256(460800),
+#endif
+#ifdef B500000
+ DO_10k(500000),
+#endif
+#ifdef B576000
+ DO_256(576000),
#endif
#ifdef B921600
- {B921600, 921600/256 + 0x8000U},
+ DO_256(921600),
+#endif
+#ifdef B1000000
+ DO_10k(1000000),
+#endif
+#ifdef B1152000
+ DO_256(1152000),
+#endif
+#ifdef B1500000
+ DO_10k(1500000),
+#endif
+#ifdef B2000000
+ DO_10k(2000000),
+#endif
+#ifdef B2500000
+ DO_10k(2500000),
+#endif
+#ifdef B3000000
+ DO_10k(3000000),
+#endif
+#ifdef B3500000
+ DO_10k(3500000),
+#endif
+#ifdef B4000000
+ DO_10k(4000000),
#endif
};
@@ -64,8 +102,11 @@ unsigned FAST_FUNC tty_baud_to_value(speed_t speed)
do {
if (speed == speeds[i].speed) {
- if (speeds[i].value & 0x8000U) {
- return ((unsigned long) (speeds[i].value) & 0x7fffU) * 256;
+ if (speeds[i].value & MARKER_256) {
+ return ((unsigned long) (speeds[i].value) & ~MARKER_MASK) * 256;
+ }
+ if (speeds[i].value & MARKER_10k) {
+ return ((unsigned long) (speeds[i].value) & ~MARKER_MASK) * 10000;
}
return speeds[i].value;
}

View File

@ -0,0 +1,39 @@
From: Javier Viguera <javier.viguera@digi.com>
Date: Wed, 20 Apr 2011 11:13:10 +0200
Subject: [PATCH] del-mdev_regulatory
Signed-off-by: Javier Viguera <javier.viguera@digi.com>
---
util-linux/mdev.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/util-linux/mdev.c b/util-linux/mdev.c
index c4829a5..c7b038d 100644
--- a/util-linux/mdev.c
+++ b/util-linux/mdev.c
@@ -94,6 +94,7 @@
//usage: "to match $SEQNUM variable. This prevents plug/unplug races.\n"
//usage: "To activate this feature, create empty /dev/mdev.seq at boot."
+#include <syslog.h>
#include "libbb.h"
#include "xregex.h"
@@ -826,6 +827,17 @@ int mdev_main(int argc UNUSED_PARAM, char **argv)
load_firmware(fw, temp);
}
}
+ /* DigiEL: Handle regulatory domain change events */
+ else if (strcmp(action, "change") == 0) {
+ char *modalias;
+ modalias = getenv("MODALIAS");
+ if (strcmp(modalias, "platform:regulatory") == 0) {
+ char *crda = xasprintf("%s", "/sbin/crda");
+ system(crda);
+ free(crda);
+ syslog(LOG_INFO, "[mdev] change regulatory domain [%s]", getenv("COUNTRY"));
+ }
+ }
if (seq) {
xopen_xwrite_close("mdev.seq", utoa(xatou(seq) + 1));

View File

@ -0,0 +1,65 @@
From: Javier Viguera <javier.viguera@digi.com>
Date: Fri, 17 Jun 2011 15:00:09 -0500
Subject: [PATCH] del-flash_eraseall
flash_eraseall: disable JFFS2 clean markers for some platforms
Some platforms (i.MX5X, CPX2) require atomic access to OOB otherwise
the JFFS2 information in the OOB leads to errors when mounting the
file system.
For these platforms, disable the possibility of writing JFFS2 clean
markers when erasing the flash.
Signed-off-by: Javier Viguera <javier.viguera@digi.com>
---
Makefile.flags | 4 ++++
miscutils/flash_eraseall.c | 13 +++++++++++++
2 files changed, 17 insertions(+)
diff --git a/Makefile.flags b/Makefile.flags
index c43c8dc..6735e97 100644
--- a/Makefile.flags
+++ b/Makefile.flags
@@ -138,6 +138,10 @@ ifeq ($(CONFIG_DMALLOC),y)
LDLIBS += dmalloc
endif
+ifeq ($(CONFIG_FLASH_ERASEALL),y)
+LDLIBS += digi
+endif
+
# If a flat binary should be built, CFLAGS_busybox="-elf2flt"
# env var should be set for make invocation.
# Here we check whether CFLAGS_busybox indeed contains that flag.
diff --git a/miscutils/flash_eraseall.c b/miscutils/flash_eraseall.c
index 0598371..ea5b969 100644
--- a/miscutils/flash_eraseall.c
+++ b/miscutils/flash_eraseall.c
@@ -21,6 +21,8 @@
#include <mtd/mtd-user.h>
#include <linux/jffs2.h>
+#include "libdigi/digi-platforms.h" // is_nand_oob_atomic
+
#define OPTION_J (1 << 0)
#define OPTION_Q (1 << 1)
#define IS_NAND (1 << 2)
@@ -84,6 +86,17 @@ int flash_eraseall_main(int argc UNUSED_PARAM, char **argv)
if (meminfo.type == MTD_NANDFLASH)
flags |= IS_NAND;
+ /*
+ * Some platforms (i.MX5X, CPX2) require atomic access to OOB, otherwise
+ * the JFFS2 information in the OOB leads to errors when mounting the
+ * file system.
+ * For those platforms, disable clean-markers option (-j).
+ */
+ if ((flags & OPTION_J) && is_nand_oob_atomic()) {
+ flags &= (~0 - OPTION_J);
+ bb_info_msg("%s: JFFS2 doesn't use OOB in this platform", applet_name);
+ }
+
clmpos = 0;
clmlen = 8;
if (flags & OPTION_J) {

View File

@ -0,0 +1,38 @@
From: Javier Viguera <javier.viguera@digi.com>
Date: Mon, 10 Sep 2012 14:13:18 +0200
Subject: [PATCH] kernel_ver
Upstream patch
Signed-off-by: Javier Viguera <javier.viguera@digi.com>
---
libbb/kernel_version.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/libbb/kernel_version.c b/libbb/kernel_version.c
index a168a1e..738ed02 100644
--- a/libbb/kernel_version.c
+++ b/libbb/kernel_version.c
@@ -20,18 +20,15 @@
int FAST_FUNC get_linux_version_code(void)
{
struct utsname name;
- char *s;
+ char *s, *t;
int i, r;
- if (uname(&name) == -1) {
- bb_perror_msg("can't get system information");
- return 0;
- }
-
+ uname(&name); /* never fails */
s = name.release;
r = 0;
for (i = 0; i < 3; i++) {
- r = r * 256 + atoi(strtok(s, "."));
+ t = strtok(s, ".");
+ r = r * 256 + (t ? atoi(t) : 0);
s = NULL;
}
return r;

View File

@ -0,0 +1,39 @@
#!/bin/sh
DAEMON=/usr/sbin/crond
NAME=crond
DESC="Busybox Periodic Command Scheduler"
ARGS="-c /etc/cron/crontabs"
test -f $DAEMON || exit 0
set -e
case "$1" in
start)
echo -n "starting $DESC: $NAME... "
start-stop-daemon -S -b -n $NAME -a $DAEMON -- $ARGS
echo "done."
;;
stop)
echo -n "stopping $DESC: $NAME... "
start-stop-daemon -K -n $NAME
echo "done."
;;
restart)
echo -n "restarting $DESC: $NAME... "
$0 stop
$0 start
echo "done."
;;
reload)
echo -n "reloading $DESC: $NAME... "
killall -HUP $(basename ${DAEMON})
echo "done."
;;
*)
echo "Usage: $0 {start|stop|restart|reload}"
exit 1
;;
esac
exit 0

View File

@ -0,0 +1,44 @@
#!/bin/sh
DAEMON=/usr/sbin/httpd
NAME=httpd
DESC="Busybox HTTP Daemon"
HTTPROOT="/srv/www"
ARGS="-h $HTTPROOT"
test -f $DAEMON || exit 0
set -e
case "$1" in
start)
echo -n "starting $DESC: $NAME... "
if [ ! -d $HTTPROOT ]; then
echo "$HTTPROOT is missing."
exit 1
fi
start-stop-daemon -S -b -n $NAME -a $DAEMON -- $ARGS
echo "done."
;;
stop)
echo -n "stopping $DESC: $NAME... "
start-stop-daemon -K -n $NAME
echo "done."
;;
restart)
echo "restarting $DESC: $NAME... "
$0 stop
$0 start
echo "done."
;;
reload)
echo -n "reloading $DESC: $NAME... "
killall -HUP $(basename ${DAEMON})
echo "done."
;;
*)
echo "Usage: $0 {start|stop|restart|reload}"
exit 1
;;
esac
exit 0

View File

@ -0,0 +1,25 @@
#!/bin/sh
#
# (c) 2010-2011 Wind River Systems, Inc.
#
# Busybox udhcpc init script
#
# script to start the udpchc DHCP client on boots where
# the parameter 'ip=dhcp' was included in the kernel parameters
# ensure the required binaries are present
[ -x /sbin/udhcpc ] || exit 1
[ -x /bin/grep ] || exit 1
[ -x /bin/mount ] || exit 1
# ensure /proc is mounted
if ! mount | grep -q "/proc "; then
exit 2
fi
rc=0
if grep -q -E "\bip=dhcp\b" /proc/cmdline; then
/sbin/udhcpc -D -s /usr/share/udhcpc/default.script
rc=$?
fi
exit $rc

View File

@ -0,0 +1,43 @@
#!/bin/sh
DAEMON=/usr/sbin/udhcpd
NAME=udhcpd
DESC="Busybox UDHCP Server"
ARGS="/etc/udhcpd.conf"
test -f $DAEMON || exit 1
set -e
case "$1" in
start)
echo -n "starting $DESC: $NAME... "
if [ ! -f /etc/udhcpd.conf ]; then
echo "error: /etc/udhcpd.conf is missing."
exit 1
fi
/sbin/start-stop-daemon -S -b -n $NAME -a $DAEMON -- $ARGS
echo "done."
;;
stop)
echo -n "stopping $DESC: $NAME... "
/sbin/start-stop-daemon -K -n $NAME
echo "done."
;;
restart)
echo "restarting $DESC: $NAME... "
$0 stop
$0 start
echo "done."
;;
reload)
echo -n "reloading $DESC: $NAME... "
killall -HUP $(basename ${DAEMON})
echo "done."
;;
*)
echo "Usage: $0 {start|stop|restart|reload}"
exit 1
;;
esac
exit 0

View File

@ -0,0 +1,4 @@
#!/bin/sh
exec run-parts -a "$1" /etc/udhcpc.d

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,82 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: hwclock
# Required-Start:
# Required-Stop: $local_fs
# Default-Start: S
# Default-Stop: 0 6
# Short-Description: Set system clock
# Description: Set system clock to hardware clock, according to the UTC
# setting in /etc/default/rcS (see also rcS(5)).
### END INIT INFO
#
# WARNING: If your hardware clock is not in UTC/GMT, this script
# must know the local time zone. This information is
# stored in /etc/localtime. This might be a problem if
# your /etc/localtime is a symlink to something in
# /usr/share/zoneinfo AND /usr isn't in the root
# partition! The workaround is to define TZ either
# in /etc/default/rcS, or in the proper place below.
[ ! -x /sbin/hwclock ] && exit 0
. /etc/default/rcS
case "$1" in
start)
if [ "$VERBOSE" != no ]
then
echo "System time was `date`."
echo "Setting the System Clock using the Hardware Clock as reference..."
fi
if [ "$HWCLOCKACCESS" != no ]
then
if [ -z "$TZ" ]
then
hwclock --hctosys
else
TZ="$TZ" hwclock --hctosys
fi
fi
if [ "$VERBOSE" != no ]
then
echo "System Clock set. System local time is now `date`."
fi
;;
stop|restart|reload|force-reload)
#
# Updates the Hardware Clock with the System Clock time.
# This will *override* any changes made to the Hardware Clock.
#
# WARNING: If you disable this, any changes to the system
# clock will not be carried across reboots.
#
if [ "$VERBOSE" != no ]
then
echo "Saving the System Clock time to the Hardware Clock..."
fi
if [ "$HWCLOCKACCESS" != no ]
then
hwclock --systohc
fi
if [ "$VERBOSE" != no ]
then
echo "Hardware Clock updated to `date`."
fi
exit 0
;;
show)
if [ "$HWCLOCKACCESS" != no ]
then
hwclock --show
fi
;;
*)
echo "Usage: hwclock.sh {start|stop|show|reload|restart}" >&2
echo " start sets kernel (system) clock from hardware (RTC) clock" >&2
echo " stop and reload set hardware (RTC) clock from kernel (system) clock" >&2
exit 1
;;
esac

View File

@ -0,0 +1,7 @@
#!/bin/sh
mount -t tmpfs tmpfs /dev -o size=64k,mode=0755
mkdir /dev/pts /dev/shm
mount -t devpts devpts /dev/pts
echo "/sbin/mdev" > /proc/sys/kernel/hotplug
mdev -s

View File

@ -0,0 +1,43 @@
# storage drives
sd[a-z][0-9]+ 0:0 0660 */lib/mdev/sd
mmcblk[0-9]+p[0-9]+ 0:0 0660 */lib/mdev/mmc
# serial
ttyNS([0-9]) 0:0 0660 >ttyS%1
ttySAC([0-9]) 0:0 0660 >ttyS%1
ttymxc([0-9]) 0:0 0660 >ttyS%1
ttyAM0 0:0 0660 >ttyS0
ttySP0 0:0 0660 >ttyBt
ttySP([1-9]) 0:0 0660 >ttyS%1
# old Samsung serial port name (for backwards compatibility)
s3c2410_serial([0-9]) 0:0 0660 >ttyS%1
# watchdog
ns9[[:alnum:]]+-wdt 0:0 0660 >watchdog
# rtc
rtc0 0:0 0660 >rtc
# alsa sound devices
pcm.* 0:0 0660 =snd/
control.* 0:0 0660 =snd/
midi.* 0:0 0660 =snd/
seq 0:0 0660 =snd/
timer 0:0 0660 =snd/
# adc
adc-ns9215 0:0 0660 */lib/mdev/adc
s3c2443-adc 0:0 0660 */lib/mdev/adc
# input devices
mice.* 0:0 0660 =input/
mouse.* 0:0 0660 =input/
event.* 0:0 0660 =input/ */lib/mdev/ts
# fix some permissions (default is 0660)
null 0:0 0666
zero 0:0 0666
# FSL settings
mxc_iim 0:0 0444 >mxc_mem

View File

@ -0,0 +1,72 @@
#!/bin/sh
# udhcpc script edited by Tim Riker <Tim@Rikers.org>
[ -z "$1" ] && echo "Error: should be called from udhcpc" && exit 1
RESOLV_CONF="/etc/resolv.conf"
[ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
[ -n "$subnet" ] && NETMASK="netmask $subnet"
# return 0 if root is mounted on a network filesystem
root_is_nfs() {
grep -qe '^/dev/root.*\(nfs\|smbfs\|ncp\|coda\) .*' /proc/mounts
}
have_bin_ip=0
if [ -x /bin/ip ]; then
have_bin_ip=1
fi
case "$1" in
deconfig)
if ! root_is_nfs ; then
if [ $have_bin_ip -eq 1 ]; then
ip addr flush dev $interface
ip link set dev $interface up
else
/sbin/ifconfig $interface 0.0.0.0
fi
fi
;;
renew|bound)
if [ $have_bin_ip -eq 1 ]; then
ip addr add dev $interface local $ip/$mask $BROADCAST
else
/sbin/ifconfig $interface $ip $BROADCAST $NETMASK
fi
if [ -n "$router" ] ; then
if ! root_is_nfs ; then
if [ $have_bin_ip -eq 1 ]; then
while ip route del default 2>/dev/null ; do
:
done
else
while route del default gw 0.0.0.0 dev $interface 2>/dev/null ; do
:
done
fi
fi
metric=0
for i in $router ; do
if [ $have_bin_ip -eq 1 ]; then
ip route add default via $i metric $((metric++))
else
route add default gw $i dev $interface metric $((metric++)) 2>/dev/null
fi
done
fi
echo -n > $RESOLV_CONF
[ -n "$domain" ] && echo search $domain >> $RESOLV_CONF
for i in $dns ; do
echo adding dns $i
echo nameserver $i >> $RESOLV_CONF
done
;;
esac
exit 0

View File

@ -0,0 +1,77 @@
#! /bin/sh
### BEGIN INIT INFO
# Provides: sysklogd
# Required-Start: $remote_fs $time
# Required-Stop: $remote_fs $time
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: System logger
### END INIT INFO
set -e
if [ -f /etc/syslog-startup.conf ]; then
. /etc/syslog-startup.conf
LOG_LOCAL=0
LOG_REMOTE=0
for D in $DESTINATION; do
if [ "$D" = "buffer" ]; then
SYSLOG_ARGS="$SYSLOG_ARGS -C$BUFFERSIZE"
LOG_LOCAL=1
elif [ "$D" = "file" ]; then
if [ -n "$LOGFILE" ]; then
SYSLOG_ARGS="$SYSLOG_ARGS -O $LOGFILE"
fi
if [ -n "$ROTATESIZE" ]; then
SYSLOG_ARGS="$SYSLOG_ARGS -s $ROTATESIZE"
fi
if [ -n "$ROTATEGENS" ]; then
SYSLOG_ARGS="$SYSLOG_ARGS -b $ROTATEGENS"
fi
LOCAL=0
elif [ "$D" = "remote" ]; then
SYSLOG_ARGS="$SYSLOG_ARGS -R $REMOTE"
LOG_REMOTE=1
fi
done
if [ "$LOG_LOCAL" = "1" -a "$LOG_REMOTE" = "1" ]; then
SYSLOG_ARGS="$SYSLOG_ARGS -L"
fi
if [ "$REDUCE" = "yes" ]; then
SYSLOG_ARGS="$SYSLOG_ARGS -S"
fi
if [ "$DROPDUPLICATES" = "yes" ]; then
SYSLOG_ARGS="$SYSLOG_ARGS -D"
fi
if [ -n "$LOGLEVEL" ]; then
SYSLOG_ARGS="$SYSLOG_ARGS -l $LOGLEVEL"
fi
else
# default: log to 16K shm circular buffer
SYSLOG_ARGS="-C"
fi
case "$1" in
start)
echo -n "Starting syslogd/klogd: "
start-stop-daemon -S -b -n syslogd -a /sbin/syslogd -- -n $SYSLOG_ARGS
start-stop-daemon -S -b -n klogd -a /sbin/klogd -- -n
echo "done"
;;
stop)
echo -n "Stopping syslogd/klogd: "
start-stop-daemon -K -n syslogd
start-stop-daemon -K -n klogd
echo "done"
;;
restart)
$0 stop
$0 start
;;
*)
echo "Usage: syslog { start | stop | restart }" >&2
exit 1
;;
esac
exit 0

View File

@ -0,0 +1,13 @@
# This configuration file is used by the busybox syslog init script,
# /etc/init.d/syslog[.busybox] to set syslog configuration at start time.
DESTINATION=file # log destinations (buffer file remote)
LOGFILE=/var/log/messages # where to log (file)
REMOTE=loghost:514 # where to log (syslog remote)
REDUCE=no # reduce-size logging
DROPDUPLICATES=no # whether to drop duplicate log entries
#ROTATESIZE=0 # rotate log if grown beyond X [kByte]
#ROTATEGENS=3 # keep X generations of rotated logs
BUFFERSIZE=64 # size of circular buffer [kByte]
FOREGROUND=no # run in foreground (don't use!)
#LOGLEVEL=5 # local log level (between 1 and 8)

View File

@ -0,0 +1,28 @@
require recipes-core/busybox/busybox.inc
DEPENDS += "libdigi"
PR = "r1"
SRC_URI = "http://www.busybox.net/downloads/busybox-${PV}.tar.bz2;name=tarball \
file://0001-del-baudrates.patch \
file://0002-del-mdev_regulatory.patch \
file://0003-del-flash_eraseall.patch \
file://0004-kernel_ver.patch \
file://defconfig \
file://syslog \
file://syslog-startup.conf \
file://busybox-cron \
file://busybox-httpd \
file://busybox-udhcpd \
file://hwclock.sh \
file://simple.script \
file://default.script \
file://busybox-udhcpc \
file://mdev \
file://mdev.conf \
"
SRC_URI[tarball.md5sum] = "e025414bc6cd79579cc7a32a45d3ae1c"
SRC_URI[tarball.sha256sum] = "eb13ff01dae5618ead2ef6f92ba879e9e0390f9583bd545d8789d27cf39b6882"
EXTRA_OEMAKE += "ARCH=${TARGET_ARCH} CROSS_COMPILE=${TARGET_PREFIX}"