Add apply_patches() function to automagically apply patches for a given util

Add updated busybox patches for 1.7.4 from robbat2
Change BUSYBOX_VER to 1.7.4

git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/genkernel/trunk@616 67a159dc-881f-0410-a524-ba9dfbe2cb84
cleanup-cruft
Andrew Gaffney 17 years ago
parent c7a57d7830
commit e86db7cf2c

@ -2,6 +2,15 @@
# Copyright 2006-2008 Gentoo Foundation; Distributed under the GPL v2 # Copyright 2006-2008 Gentoo Foundation; Distributed under the GPL v2
# $Header: $ # $Header: $
11 Mar 2008; Andrew Gaffney <agaffney@gentoo.org> gen_compile.sh,
genkernel.conf, +patches/busybox/1.7.4/1.7.4-ash-timeout.diff,
+patches/busybox/1.7.4/1.7.4-mdadm.diff,
+patches/busybox/1.7.4/1.7.4-mdstart.diff,
+patches/busybox/1.7.4/1.7.4-openvt.diff:
Add apply_patches() function to automagically apply patches for a given util
Add updated busybox patches for 1.7.4 from robbat2
Change BUSYBOX_VER to 1.7.4
11 Mar 2008; Chris Gianelloni <wolf31o2@gentoo.org> 11 Mar 2008; Chris Gianelloni <wolf31o2@gentoo.org>
generic/initrd.scripts: generic/initrd.scripts:
Rearrange checks so the return value is read correctly. Rearrange checks so the return value is read correctly.

@ -182,6 +182,32 @@ reset_args()
fi fi
} }
apply_patches() {
util=$1
version=$1
if [ -d "${GK_SHARE}/patches/${util}/${version}" ]
then
for i in "${GK_SHARE}/patches/${util}/${version}/*"
do
patch_success=0
for j in `seq 0 5`
do
patch -p${j} -f < "${i}"
if [ $? = 0 ]
then
patch_success=1
break
fi
done
if [ ${patch_success} != 1 ]
then
# return 1
gen_die "could not apply patch ${i} for ${util}-${version}"
fi
done
fi
}
compile_generic() { compile_generic() {
local RET local RET
@ -338,9 +364,10 @@ compile_busybox() {
cp "${BUSYBOX_CONFIG}" "${BUSYBOX_DIR}/.config" cp "${BUSYBOX_CONFIG}" "${BUSYBOX_DIR}/.config"
sed -i ${BUSYBOX_DIR}/.config -e 's/#\? \?CONFIG_FEATURE_INSTALLER[ =].*/CONFIG_FEATURE_INSTALLER=y/g' sed -i ${BUSYBOX_DIR}/.config -e 's/#\? \?CONFIG_FEATURE_INSTALLER[ =].*/CONFIG_FEATURE_INSTALLER=y/g'
cd "${BUSYBOX_DIR}" cd "${BUSYBOX_DIR}"
patch -p1 < "${GK_SHARE}/pkg/busybox-1.1.3+gentoo-mdadm.patch" # patch -p1 < "${GK_SHARE}/pkg/busybox-1.1.3+gentoo-mdadm.patch"
patch -p1 < "${GK_SHARE}/pkg/busybox-1.1.3+gentoo-mdadm2.patch" # patch -p1 < "${GK_SHARE}/pkg/busybox-1.1.3+gentoo-mdadm2.patch"
patch -p1 < "${GK_SHARE}/pkg/busybox-1.1.3+gentoo-mdadm3.patch" # patch -p1 < "${GK_SHARE}/pkg/busybox-1.1.3+gentoo-mdadm3.patch"
apply_patches busybox ${BUSYBOX_VER}
print_info 1 'busybox: >> Configuring...' print_info 1 'busybox: >> Configuring...'
yes '' 2>/dev/null | compile_generic oldconfig utils yes '' 2>/dev/null | compile_generic oldconfig utils

@ -138,7 +138,7 @@ DEFAULT_KERNEL_SOURCE="/usr/src/linux"
# Configuration file for busybox # Configuration file for busybox
BUSYBOX_CONFIG="${GK_SHARE}/%%ARCH%%/busy-config" BUSYBOX_CONFIG="${GK_SHARE}/%%ARCH%%/busy-config"
BUSYBOX_VER="1.1.3+gentoo" BUSYBOX_VER="1.7.4"
BUSYBOX_SRCTAR="${GK_SHARE}/pkg/busybox-${BUSYBOX_VER}.tar.bz2" BUSYBOX_SRCTAR="${GK_SHARE}/pkg/busybox-${BUSYBOX_VER}.tar.bz2"
BUSYBOX_DIR="busybox-${BUSYBOX_VER}" BUSYBOX_DIR="busybox-${BUSYBOX_VER}"
BUSYBOX_BINCACHE="%%CACHE%%/busybox-${BUSYBOX_VER}-%%ARCH%%.tar.bz2" BUSYBOX_BINCACHE="%%CACHE%%/busybox-${BUSYBOX_VER}-%%ARCH%%.tar.bz2"

@ -0,0 +1,123 @@
'read -t' support, forward-ported from Gentoo Busybox 1.1.3.
Used during the LiveCD boot when prompting for a keymap.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
diff -Nuar --exclude '*.orig' busybox-1.7.4/shell/ash.c busybox-1.7.4+gentoo/shell/ash.c
--- busybox-1.7.4/shell/ash.c 2007-11-03 16:06:35.000000000 -0700
+++ busybox-1.7.4+gentoo/shell/ash.c 2008-03-11 10:21:28.000000000 -0700
@@ -11485,11 +11485,13 @@
int startword;
int status;
int i;
+#if ENABLE_ASH_READ_NCHARS || ENABLE_ASH_READ_TIMEOUT
+ struct termios tty, old_tty;
+#endif
#if ENABLE_ASH_READ_NCHARS
int nch_flag = 0;
int nchars = 0;
int silent = 0;
- struct termios tty, old_tty;
#endif
#if ENABLE_ASH_READ_TIMEOUT
fd_set set;
@@ -11566,44 +11568,74 @@
ifs = bltinlookup("IFS");
if (ifs == NULL)
ifs = defifs;
-#if ENABLE_ASH_READ_NCHARS
+#if ENABLE_ASH_READ_NCHARS || ENABLE_ASH_READ_TIMEOUT
+#if ENABLE_ASH_READ_NCHARS && ENABLE_ASH_READ_TIMEOUT
+ if (nch_flag || silent || ts.tv_sec || ts.tv_usec) {
+#elif ENABLE_ASH_READ_TIMEOUT
+ if (ts.tv_sec || ts.tv_usec) {
+#elif ENABLE_ASH_READ_NCHARS
if (nch_flag || silent) {
+#endif
tcgetattr(0, &tty);
old_tty = tty;
- if (nch_flag) {
+#if ENABLE_ASH_READ_NCHARS && ENABLE_ASH_READ_TIMEOUT
+ if (nch_flag || ts.tv_sec || ts.tv_usec)
+#elif ENABLE_ASH_READ_TIMEOUT
+ if (ts.tv_sec || ts.tv_usec)
+#elif ENABLE_ASH_READ_NCHARS
+ if (nch_flag)
+#endif
tty.c_lflag &= ~ICANON;
- tty.c_cc[VMIN] = nchars;
- }
- if (silent) {
- tty.c_lflag &= ~(ECHO|ECHOK|ECHONL);
- }
+
+#if ENABLE_ASH_READ_NCHARS
+ if (silent)
+ tty.c_lflag &= ~(ECHO|ECHOK|ECHONL);
+#endif
tcsetattr(0, TCSANOW, &tty);
}
#endif
+ i = 1;
+ STARTSTACKSTR(p);
#if ENABLE_ASH_READ_TIMEOUT
if (ts.tv_sec || ts.tv_usec) {
FD_ZERO(&set);
FD_SET(0, &set);
i = select(FD_SETSIZE, &set, NULL, NULL, &ts);
- if (!i) {
+ if (i == 1)
+ {
+ read(0, &c, 1);
+ if(c == '\n' || c == 4) /* Handle newlines and EOF */
+ i = 0; /* Don't read further... */
+ else
+ STPUTC(c, p); /* Ok, keep reading... */
+ }
#if ENABLE_ASH_READ_NCHARS
- if (nch_flag)
- tcsetattr(0, TCSANOW, &old_tty);
+ if (!silent && !nch_flag)
#endif
- return 1;
+ tcsetattr(0, TCSANOW, &old_tty);
+
+#if ENABLE_ASH_READ_NCHARS
+ if(i == 0)
+ {
+ nchars = 0;
+ nch_flag = 1;
+ } else
+ {
+ if (nch_flag)
+ nchars--;
}
+#endif
}
#endif
status = 0;
startword = 1;
backslash = 0;
- STARTSTACKSTR(p);
#if ENABLE_ASH_READ_NCHARS
while (!nch_flag || nchars--)
#else
- for (;;)
+ for (;i > 0;)
#endif
{
if (read(0, &c, 1) != 1) {
@@ -11640,8 +11672,10 @@
}
}
#if ENABLE_ASH_READ_NCHARS
- if (nch_flag || silent)
+ if (silent || nch_flag)
tcsetattr(0, TCSANOW, &old_tty);
+ if (!silent && nch_flag)
+ printf("\n");
#endif
STACKSTRNUL(p);

File diff suppressed because it is too large Load Diff

@ -0,0 +1,120 @@
Forward-port the old mdstart tool from the Gentoo Busybox-1.1.3.
Only fires the RAID_AUTORUN ioctl on existing /dev/md nodes.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
diff -Nuar --exclude '*.orig' busybox-1.7.4/include/applets.h busybox-1.7.4+gentoo/include/applets.h
--- busybox-1.7.4/include/applets.h 2007-09-03 04:48:46.000000000 -0700
+++ busybox-1.7.4+gentoo/include/applets.h 2008-03-11 10:25:43.000000000 -0700
@@ -222,6 +222,7 @@
USE_MATCHPATHCON(APPLET(matchpathcon, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
USE_MD5SUM(APPLET_ODDNAME(md5sum, md5_sha1_sum, _BB_DIR_USR_BIN, _BB_SUID_NEVER, md5sum))
USE_MDEV(APPLET(mdev, _BB_DIR_SBIN, _BB_SUID_NEVER))
+USE_MDSTART(APPLET(mdstart, _BB_DIR_SBIN, _BB_SUID_NEVER))
USE_MESG(APPLET(mesg, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_MKDIR(APPLET_NOFORK(mkdir, mkdir, _BB_DIR_BIN, _BB_SUID_NEVER, mkdir))
//USE_MKE2FS(APPLET(mke2fs, _BB_DIR_SBIN, _BB_SUID_NEVER))
diff -Nuar --exclude '*.orig' busybox-1.7.4/include/usage.h busybox-1.7.4+gentoo/include/usage.h
--- busybox-1.7.4/include/usage.h 2007-09-03 04:48:46.000000000 -0700
+++ busybox-1.7.4+gentoo/include/usage.h 2008-03-11 10:19:04.000000000 -0700
@@ -2072,6 +2072,9 @@
"the last line match .* to override this.)\n\n" \
)
+#define mdstart_trivial_usage \
+ "{[PARTITION] MD-NODE}..."
+
#define mesg_trivial_usage \
"[y|n]"
#define mesg_full_usage \
diff -Nuar --exclude '*.orig' busybox-1.7.4/util-linux/Config.in busybox-1.7.4+gentoo/util-linux/Config.in
--- busybox-1.7.4/util-linux/Config.in 2007-09-03 04:48:56.000000000 -0700
+++ busybox-1.7.4+gentoo/util-linux/Config.in 2008-03-11 10:26:20.000000000 -0700
@@ -305,6 +305,13 @@
/lib/firmware/ and if it exists, send it to the kernel for
loading into the hardware.
+config CONFIG_MDSTART
+ bool "mdstart"
+ default n
+ help
+ Allows you to autostart /dev/md devices if using an initramfs to
+ boot.
+
config MKSWAP
bool "mkswap"
default n
diff -Nuar --exclude '*.orig' busybox-1.7.4/util-linux/Kbuild busybox-1.7.4+gentoo/util-linux/Kbuild
--- busybox-1.7.4/util-linux/Kbuild 2007-09-03 04:48:56.000000000 -0700
+++ busybox-1.7.4+gentoo/util-linux/Kbuild 2008-03-11 10:28:47.000000000 -0700
@@ -18,6 +18,7 @@
lib-$(CONFIG_IPCRM) +=ipcrm.o
lib-$(CONFIG_IPCS) +=ipcs.o
lib-$(CONFIG_LOSETUP) +=losetup.o
+lib-$(CONFIG_MDSTART) +=mdStart.o
lib-$(CONFIG_MDEV) +=mdev.o
lib-$(CONFIG_MKFS_MINIX) +=mkfs_minix.o
lib-$(CONFIG_MKSWAP) +=mkswap.o
diff -Nuar --exclude '*.orig' busybox-1.7.4/util-linux/mdStart.c busybox-1.7.4+gentoo/util-linux/mdStart.c
--- busybox-1.7.4/util-linux/mdStart.c 1969-12-31 16:00:00.000000000 -0800
+++ busybox-1.7.4+gentoo/util-linux/mdStart.c 2008-03-11 10:19:04.000000000 -0700
@@ -0,0 +1,59 @@
+/*
+ * Linux 2.6(+) RAID Autostarter
+ *
+ * Copyright (C) 2005 by Tim Yamin <plasmaroo@gentoo.org> <plasm@roo.me.uk>
+ *
+ * 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 <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <linux/major.h>
+#include <linux/raid/md_u.h>
+
+extern int
+mdstart_main(int argc, char *argv[])
+{
+ int i, fd, part = 0, retval = 0;
+
+ if(argc < 2)
+ {
+ bb_show_usage();
+ }
+
+ for(i = 1; i < argc; i++)
+ {
+ if(sscanf(argv[i], "%d", &part) == 1)
+ continue;
+
+ fd = open(argv[i], 0, 0);
+ if (fd >= 0)
+ {
+ ioctl(fd, RAID_AUTORUN, part);
+ close(fd);
+ } else
+ {
+ printf("Error: Failed to open %s!\n", argv[i]);
+ retval=1;
+ }
+
+ part = 0;
+ }
+
+ return retval;
+}

@ -0,0 +1,20 @@
Allow a slightly wider range of valid vt numbers. Forward-ported from Gentoo
Busybox 1.1.3.
The previous spin of this patch on 1.1.3 had a 'wait(NULL);' right before
return EXIT_SUCCESS. I don't think it's needed anymore, so I left it out.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
diff -Nuar --exclude '*.orig' busybox-1.7.4/console-tools/openvt.c busybox-1.7.4+gentoo/console-tools/openvt.c
--- busybox-1.7.4/console-tools/openvt.c 2007-09-03 04:48:35.000000000 -0700
+++ busybox-1.7.4+gentoo/console-tools/openvt.c 2008-03-10 10:00:55.000000000 -0700
@@ -21,7 +21,7 @@
bb_show_usage();
/* check for illegal vt number: < 1 or > 63 */
- sprintf(vtname, VC_FORMAT, (int)xatou_range(argv[1], 1, 63));
+ sprintf(vtname, VC_FORMAT, (int)xatou_range(argv[1], 0, 63));
bb_daemonize_or_rexec(DAEMON_CLOSE_EXTRA_FDS, argv);
/* grab new one */
Loading…
Cancel
Save