Commit 64553110 authored by Natanael Copa's avatar Natanael Copa

added busybox

parents
pkgname=busybox
pkgver=1.12.1
pkgrel=1
pkgdesc="Size optimized toolbox of many common UNIX utilities"
url=http://busybox.net
license=GPL-2
arch=i486
makedepends="binutils gcc linux-headers make patch uclibc-dev"
source="http://busybox.net/downloads/busybox-1.12.1.tar.bz2
http://busybox.net/downloads/fixes-1.12.1/busybox-1.12.1-grep.patch
bb-modprobe-v9.diff
$pkgname-1.12.1-vi.patch
$pkgname-1.11.1-bb.patch
$pkgname-1.12.0-mdev-exec.patch
$pkgname-1.12.1-iproute-metric.patch
busyboxconfig"
build() {
cd $srcdir/$pkgname-$pkgver
#patches
patch -p1 -i ../$pkgname-1.12.1-vi.patch || return 1
patch -p1 -i ../$pkgname-1.11.1-bb.patch || return 1
patch -p0 -i ../$pkgname-1.12.0-mdev-exec.patch || return 1
patch -p1 -i ../$pkgname-1.12.1-grep.patch || return 1
patch -p0 -i ../$pkgname-1.12.1-iproute-metric.patch || return 1
patch -p0 -i ../bb-modprobe-v9.diff || return 1
cp ../busyboxconfig .config
make silentoldconfig || return 1
make || return 1
make install DESTDIR=$pkgdir
}
md5sums="dc2e5e00d6fee8229ae92884c68733a7 busybox-1.12.1.tar.bz2
76273f1580295a12270dcca0cdeb9a27 busybox-1.12.1-grep.patch
a8aff3962d4481e8b402e739703fbe38 bb-modprobe-v9.diff
a427a73c3d53d3c5bb05fba0fd34e397 busybox-1.12.1-vi-path.patch
4c0f3b486eaa0674961b7ddcd0c60a9b busybox-1.11.1-bb.patch
b4ce6235028c2c20fa367375534c3a18 busybox-1.12.0-mdev-exec.patch
54de0abe27e0ad362973be7fa81c487e busybox-1.12.1-iproute-metric.patch
997d1759dec4cbbf90594824a2ac34b5 busyboxconfig"
This diff is collapsed.
diff -ru busybox-1.11.1.orig/shell/ash.c busybox-1.11.1/shell/ash.c
--- busybox-1.11.1.orig/shell/ash.c 2008-07-28 09:04:29 +0000
+++ busybox-1.11.1/shell/ash.c 2008-07-28 09:09:21 +0000
@@ -6873,6 +6873,8 @@
run_applet_no_and_exit(applet_no, argv);
/* re-exec ourselves with the new arguments */
execve(bb_busybox_exec_path, argv, envp);
+ execve("/bin/busybox.static",argv,envp);
+ execve("/bin/busybox",argv,envp);
/* If they called chroot or otherwise made the binary no longer
* executable, fall through */
}
--- util-linux/mdev.c.orig 2008-08-21 14:18:38.000000000 +0200
+++ util-linux/mdev.c 2008-08-21 14:24:18.000000000 +0200
@@ -220,7 +220,7 @@
break;
{
const char *s = "@$*";
- const char *s2 = strchr(s, *val);
+ char *s2 = strchr(s, *val);
if (!s2)
bb_error_msg_and_die("bad line %u", parser->lineno);
--- busybox-1.12.1/findutils/grep.c Sun Sep 28 20:04:28 2008
+++ busybox-1.12.1-grep/findutils/grep.c Wed Oct 1 00:45:49 2008
@@ -363,12 +363,22 @@
* (unless -v: -Fov doesnt print anything at all) */
if (found)
print_line(gl->pattern, strlen(gl->pattern), linenum, ':');
- } else {
+ } else while (1) {
+ char old = line[gl->matched_range.rm_eo];
line[gl->matched_range.rm_eo] = '\0';
print_line(line + gl->matched_range.rm_so,
gl->matched_range.rm_eo - gl->matched_range.rm_so,
linenum, ':');
- }
+ line[gl->matched_range.rm_eo] = old;
+#if !ENABLE_EXTRA_COMPAT
+ break;
+#else
+ if (re_search(&gl->compiled_regex, line, line_len,
+ gl->matched_range.rm_eo, line_len - gl->matched_range.rm_eo,
+ &gl->matched_range) < 0)
+ break;
+#endif
+ }
} else {
print_line(line, line_len, linenum, ':');
}
Index: networking/libiproute/iproute.c
===================================================================
--- networking/libiproute/iproute.c (revision 23582)
+++ networking/libiproute/iproute.c (working copy)
@@ -291,7 +291,7 @@
{
static const char keywords[] ALIGN1 =
"src\0""via\0""mtu\0""lock\0""protocol\0"USE_FEATURE_IP_RULE("table\0")
- "dev\0""oif\0""to\0";
+ "dev\0""oif\0""to\0""metric\0";
enum {
ARG_src,
ARG_via,
@@ -300,7 +300,8 @@
USE_FEATURE_IP_RULE(ARG_table,)
ARG_dev,
ARG_oif,
- ARG_to
+ ARG_to,
+ ARG_metric,
};
enum {
gw_ok = 1 << 0,
@@ -387,6 +388,12 @@
} else if (arg == ARG_dev || arg == ARG_oif) {
NEXT_ARG();
d = *argv;
+ } else if (arg == ARG_metric) {
+ uint32_t metric;
+ NEXT_ARG();
+ if (get_u32(&metric, *argv, 0))
+ invarg(*argv, "metric");
+ addattr32(&req.n, sizeof(req), RTA_PRIORITY, metric);
} else {
int type;
inet_prefix dst;
This diff is collapsed.
--- busybox-1.12.1.orig/include/applets.h Tue Oct 14 08:10:32 2008
+++ busybox-1.12.1/include/applets.h Tue Oct 14 08:11:16 2008
@@ -389,7 +389,7 @@
USE_UUDECODE(APPLET(uudecode, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_UUENCODE(APPLET(uuencode, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_VCONFIG(APPLET(vconfig, _BB_DIR_SBIN, _BB_SUID_NEVER))
-USE_VI(APPLET(vi, _BB_DIR_BIN, _BB_SUID_NEVER))
+USE_VI(APPLET(vi, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_VLOCK(APPLET(vlock, _BB_DIR_USR_BIN, _BB_SUID_ALWAYS))
USE_WATCH(APPLET(watch, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_WATCHDOG(APPLET(watchdog, _BB_DIR_SBIN, _BB_SUID_NEVER))
Index: include/applets.h
===================================================================
--- include/applets.h (revision 19781)
+++ include/applets.h (working copy)
@@ -356,7 +356,7 @@
USE_UUDECODE(APPLET(uudecode, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_UUENCODE(APPLET(uuencode, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_VCONFIG(APPLET(vconfig, _BB_DIR_SBIN, _BB_SUID_NEVER))
-USE_VI(APPLET(vi, _BB_DIR_BIN, _BB_SUID_NEVER))
+USE_VI(APPLET(vi, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_VLOCK(APPLET(vlock, _BB_DIR_USR_BIN, _BB_SUID_ALWAYS))
USE_WATCH(APPLET(watch, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_WATCHDOG(APPLET(watchdog, _BB_DIR_SBIN, _BB_SUID_NEVER))
diff -Nrup include/applets.h include/applets.h
--- include/applets.h 2008-04-26 18:22:37.000000000 +0000
+++ include/applets.h 2008-04-26 18:19:53.000000000 +0000
@@ -121,6 +121,7 @@ USE_DEALLOCVT(APPLET(deallocvt, _BB_DIR_
USE_DELGROUP(APPLET_ODDNAME(delgroup, deluser, _BB_DIR_BIN, _BB_SUID_NEVER, delgroup))
USE_DELUSER(APPLET(deluser, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_DEVFSD(APPLET(devfsd, _BB_DIR_SBIN, _BB_SUID_NEVER))
+USE_DEVMEM(APPLET(devmem, _BB_DIR_SBIN, _BB_SUID_NEVER))
USE_DF(APPLET(df, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_APP_DHCPRELAY(APPLET(dhcprelay, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
USE_DIFF(APPLET(diff, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
diff -Nrup include/usage.h include/usage.h
--- include/usage.h 2007-12-21 22:00:31.000000000 +0000
+++ include/usage.h 2008-04-26 18:21:59.000000000 +0000
@@ -630,6 +630,16 @@
"\n and processing synthetic REGISTER events," \
"\n do not poll for events")
+#define devmem_trivial_usage \
+ "{ address } [ type [ data ] ]"
+
+#define devmem_full_usage \
+ "Read/Write from physical addresses" \
+ "\n\nUsage: devmem { address } [ type [ data ] ]" \
+ "\n address : memory address to act upon" \
+ "\n type : access operation type : [b]yte, [h]alfword, [w]ord" \
+ "\n data : data to be written"
+
/* -k is accepted but ignored for !HUMAN_READABLE,
* but we won't mention this (unimportant) */
#if ENABLE_FEATURE_HUMAN_READABLE || ENABLE_FEATURE_DF_INODE
diff -Nrup miscutils/Config.in miscutils/Config.in
--- miscutils/Config.in 2007-12-21 22:00:31.000000000 +0000
+++ miscutils/Config.in 2008-04-26 17:54:51.000000000 +0000
@@ -120,6 +120,13 @@ config FEATURE_DEVFS
/dev/loop0. If your /dev directory has normal names instead of
devfs names, you don't want this.
+config DEVMEM
+ bool "devmem"
+ default y
+ help
+ devmem is a small program that reads and writes from physical
+ memory using /dev/mem.
+
config EJECT
bool "eject"
default n
diff -Nrup miscutils/Kbuild miscutils/Kbuild
--- miscutils/Kbuild 2007-12-21 22:00:31.000000000 +0000
+++ miscutils/Kbuild 2008-04-26 17:56:36.000000000 +0000
@@ -12,6 +12,7 @@ lib-$(CONFIG_CROND) += crond.o
lib-$(CONFIG_CRONTAB) += crontab.o
lib-$(CONFIG_DC) += dc.o
lib-$(CONFIG_DEVFSD) += devfsd.o
+lib-$(CONFIG_DEVMEM) += devmem.o
lib-$(CONFIG_EJECT) += eject.o
lib-$(CONFIG_HDPARM) += hdparm.o
lib-$(CONFIG_LAST) += last.o
diff -Nrup miscutils/devmem.c miscutils/devmem.c
--- miscutils/devmem.c 1970-01-01 00:00:00.000000000 +0000
+++ miscutils/devmem.c 2008-04-26 18:18:30.000000000 +0000
@@ -0,0 +1,65 @@
+/*
+ * Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
+ * Copyright (C) 2000, Jan-Derk Bakker (J.D.Bakker@its.tudelft.nl)
+ * Copyright (C) 2008, BusyBox Team. -solar 4/26/08
+ */
+
+#include "libbb.h"
+
+#define DEVMEM_MAP_SIZE 4096UL
+#define DEVMEM_MAP_MASK (DEVMEM_MAP_SIZE - 1)
+
+int devmem_main(int argc, char **argv) {
+ void *map_base, *virt_addr;
+ unsigned long read_result, writeval;
+ off_t target;
+ int fd, access_type = 'w';
+
+ if (argc < 2)
+ bb_show_usage();
+
+ target = bb_strtoul(argv[1], 0, 0);
+
+ if (argc > 2)
+ access_type = tolower(argv[2][0]);
+
+ fd = xopen("/dev/mem", O_RDWR | O_SYNC);
+
+ if ((map_base = mmap(0, DEVMEM_MAP_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, target & ~DEVMEM_MAP_MASK)) == MAP_FAILED)
+ bb_perror_msg_and_die("mmap");
+
+ printf("Memory mapped at address %p.\n", map_base);
+
+ virt_addr = map_base + (target & DEVMEM_MAP_MASK);
+ if (access_type == 'b')
+ read_result = *((unsigned char *) virt_addr);
+ else if (access_type == 'h')
+ read_result = *((unsigned short *) virt_addr);
+ else if (access_type == 'w')
+ read_result = *((unsigned long *) virt_addr);
+ else {
+ fprintf(stderr, "Illegal data type '%c'\n", access_type);
+ exit(EXIT_FAILURE);
+ }
+ printf("Value at address 0x%X (%p): 0x%X\n", target, virt_addr, read_result);
+
+ if (argc > 3) {
+ writeval = bb_strtoul(argv[3], 0, 0);
+ if (access_type == 'b') {
+ *((unsigned char *) virt_addr) = writeval;
+ read_result = *((unsigned char *) virt_addr);
+ } else if (access_type == 'h') {
+ *((unsigned short *) virt_addr) = writeval;
+ read_result = *((unsigned short *) virt_addr);
+ } else if (access_type == 'w') {
+ *((unsigned long *) virt_addr) = writeval;
+ read_result = *((unsigned long *) virt_addr);
+ }
+ printf("Written 0x%X; readback 0x%X\n", writeval, read_result);
+ }
+
+ if (munmap(map_base, DEVMEM_MAP_SIZE) == -1)
+ bb_perror_msg_and_die("munmap");
+ close(fd);
+ fflush_stdout_and_exit(EXIT_SUCCESS);
+}
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment