diff options
Diffstat (limited to 'tools')
211 files changed, 1905 insertions, 5870 deletions
diff --git a/tools/.cvsignore b/tools/.cvsignore deleted file mode 100644 index 88754bc8b..000000000 --- a/tools/.cvsignore +++ /dev/null @@ -1,4 +0,0 @@ -rpm2header -gendepslist -xhost+ -rpcinfo-flushed diff --git a/tools/2adsldb.pm b/tools/2adsldb.pm deleted file mode 100644 index 23328aafc..000000000 --- a/tools/2adsldb.pm +++ /dev/null @@ -1,17 +0,0 @@ -open F, "isplist.txt" or die "file $file not found"; -open G, ">tutu" or die "file $file not found"; -foreach (<F>) { - s/\#.*//; - /.*ADSL.*/ or next; -#| NOM | PAYS | CONNECTION | MAILTYPE | SMTP | MAILSERVER | NEWS | MY1DNS | MY2DNS | PROXY | PROXYSERVER | DHCP | EMAIL - s/(.*)france(.*)/$1France$2/; - s/(.*)FRANCE(.*)/$1France$2/; - s/(.*)USA(.*)/$1United States$2/; - s/(.*)U.S.A(.*)/$1United States$2/; - s/(.*)US(.*)/$1United States$2/; - s/(.*)usa(.*)/$1United States$2/; - s/(.*)club-internet(.*)/$1club internet$2/; - my ($name, $country, $connexion, $mailtype, $smtp, $popserver, $mailserver, $news, $dns1, $dns2, $proxy, $proxyserver, $dhcp, $email) = split /\|/; - print G join("|", $country, join("=>", $name, $dns1, $dns2)), "\n"; #$domain, -} - diff --git a/tools/2isdndb.pm b/tools/2isdndb.pm deleted file mode 100644 index 536808706..000000000 --- a/tools/2isdndb.pm +++ /dev/null @@ -1,25 +0,0 @@ -open F, "isdndb.txt" or die "file $file not found"; -open G, ">tutu" or die "file $file not found"; -foreach (<F>) { - s/\#.*//; -# s/\[City\]\s+National//; - /\[Country\]\s*(.*)/ and $country = $1; - /\[City\]\s*(.*)/ and $city = $1; - /\[Name\]\s*(.*)/ and $name = $1; - /\[Prefix\]\s*(.*)/ and $prefix = $1; - /\[ISDN\]\s*(.*)/ and $isdn = $1; - /\[Encaps\]\s*.*/ and do { defined $dns1 and $dns2=""; }; - /\[Domain\]\s*(.*)/ and $domain = $1; - /\[DNS\]\s*(.*)/ and ($dns1 ? $dns2 : $dns1) = $1; - /\[End\]\s*(.*)/ and do { undef $name; undef $prefix; undef $isdn; undef $domain; undef $dns1; undef $dns2; }; - if ($isdn && !$prefix) { $prefix = "" } - if (defined $name && defined $isdn && defined $domain && defined $dns1 && defined $dns2) { - print G join("|", $country, $city, join("=>", $name, $prefix . $isdn, $domain, $dns1, $dns2)), "\n"; - undef $name; - undef $prefix; - undef $isdn; - undef $domain; - undef $dns1; - undef $dns2; - } -} diff --git a/tools/Makefile b/tools/Makefile index 244b23bd9..40194245d 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -1,11 +1,8 @@ -ROOTDEST = /export -DEST = $(ROOTDEST)/Mandrake/mdkinst -RPMS = $(wildcard $(ROOTDEST)/Mandrake/RPMS/*.rpm) -DIRS = ddcprobe serial_probe aewm-drakx -BASE = $(ROOTDEST)/Mandrake/base -CFLAGS = -Wall +DIRS = serial_probe +LDFLAGS = $(shell pkg-config libtirpc --libs) +CFLAGS = -Wall $(shell pkg-config libtirpc --cflags) -ARCH := $(shell arch | egrep "(x86_64|sparc64|s390x)") +ARCH := $(shell arch | grep -E "x86_64") ifneq ("x$(ARCH)", "x") LIB_NAME = lib64 else @@ -14,27 +11,18 @@ endif .PHONY: clean install $(DIRS) -all: $(DIRS) xhost+ rpcinfo-flushed install +all: $(DIRS) rpcinfo-flushed $(DIRS): make -C $@ install: - @install -d $(ROOTDEST)/misc/auto - @install make_mdkinst_stage2 $(ROOTDEST)/misc - @cd /usr/bin ; install packdrake $(ROOTDEST)/misc || { echo "packdrake is missing"; exit 1; } - @cd /usr/bin ; install gendistrib rpm2header $(ROOTDEST)/misc || { echo "install rpmtools first!" ; exit 1; } - @eval `perl -V:installvendorlib`; cd $$installvendorlib ; cp -rf packdrake.pm $(ROOTDEST)/misc || { echo "install rpmtools first!" ; exit 1; } - @eval `perl -V:installvendorarch`; cd $$installvendorarch ; cp -rf URPM* $(ROOTDEST)/misc || { echo "install perl-URPM first!" ; exit 1; } - @eval `perl -V:installvendorarch`; cd $$installvendorarch/auto ; cp -rf URPM $(ROOTDEST)/misc/auto || { echo "install perl-URPM first!" ; exit 1; } - @mkdir -p $(DEST)/usr/bin + install -d $(ROOTDEST)/misc + install mdkinst_stage2_tool drakx-in-chroot $(ROOTDEST)/misc xhost+: %: %.c $(CC) $(CFLAGS) $< -L/usr/X11R6/$(LIB_NAME) -lX11 -o $@ -ddcprobe/ddcxinfos: - $(MAKE) -C ddcprobe ddcxinfos - clean: for i in $(DIRS); do $(MAKE) -C $$i clean; done - rm -rf *~ xhost+ rpcinfo-flushed ddcprobe/ddcxinfos */*.o + rm -rf *~ xhost+ rpcinfo-flushed */*.o diff --git a/tools/addchangelog.pl b/tools/addchangelog.pl deleted file mode 100755 index 8e39802a6..000000000 --- a/tools/addchangelog.pl +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/perl - -@ARGV == 1 or die "usage $0: <cvslog2changelog script>\n"; - -($script) = @ARGV; - -$date = (split('/', `grep ChangeLog perl-install/CVS/Entries`))[3]; - -@changelog = `(cvs log -d ">$date" docs mdk-stage1 rescue tools ; cd perl-install; cvs log -d ">$date") | $script`; -@before = `cat perl-install/ChangeLog`; - -open F, ">perl-install/ChangeLog"; -print F foreach @changelog, @before; - -`cvs commit -m '' perl-install/ChangeLog` =~ /new revision: (.*?);/; - -print "$1\n"; -print foreach @changelog; diff --git a/tools/aewm-drakx/.cvsignore b/tools/aewm-drakx/.cvsignore deleted file mode 100644 index 2c9522444..000000000 --- a/tools/aewm-drakx/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -aewm-drakx diff --git a/tools/aewm-drakx/Makefile b/tools/aewm-drakx/Makefile deleted file mode 100644 index ec5bbf977..000000000 --- a/tools/aewm-drakx/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -ARCH := $(shell arch | egrep "(x86_64|sparc64|s390x)") -ifneq ("x$(ARCH)", "x") -LIB_NAME = lib64 -else -LIB_NAME = lib -endif - -CFLAGS = -Wall -Os -LDFLAGS = -L/usr/X11R6/$(LIB_NAME) -lX11 -CFILES = $(wildcard *.c) -OFILES = $(CFILES:%.c=%.o) -GOAL = aewm-drakx - -$(GOAL): $(OFILES) - -clean: - rm -f $(GOAL) $(OFILES) TAGS *~ diff --git a/tools/aewm-drakx/README b/tools/aewm-drakx/README deleted file mode 100644 index 160ffb4d2..000000000 --- a/tools/aewm-drakx/README +++ /dev/null @@ -1,53 +0,0 @@ -aewm-drakx - A DrakX-aware X11 Window Manager -====================================================================== -aewm-drakx is a stripped down version of aewm with keyboard focus added. -The main and only purpose of aewm-drakx is to provide keyboard focus. - -Thanks to aewm author for his job. The already small aewm, gives a tiny WM -(source < 4Kl, binary < 8KB) when stripped down of nearly everything. - -Pixel. - - -aewm -====================================================================== -http://www.red-bean.com/~decklin/aewm/. - -Author -====================================================================== - -aewm is maintained by Decklin Foster <decklin@red-bean.com>. If you -have bug reports, comments, flames, want permission to change the -license, or are just bored, send me email. Your messages are -appreciated (but do read the thing above about virtual desktops ;-). - -License -====================================================================== - -Copyright (c) 1998-2001 Decklin Foster. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS", WITHOUT ANY EXPRESS -OR IMPLIED WARRANTIES OF ANY KIND. IN NO EVENT SHALL THE AUTHOR BE -HELD LIABLE FOR ANY DAMAGES CONNECTED WITH THE USE OF THIS PROGRAM. - -You are granted permission to copy, publish, distribute, and/or sell -copies of this program and any modified versions or derived works, -provided that this copyright and notice are not removed or altered. - -Portions of the code were based on 9wm, which contains this license: - -> 9wm is free software, and is Copyright (c) 1994 by David Hogan. -> Permission is granted to all sentient beings to use this software, -> to make copies of it, and to distribute those copies, provided -> that: -> -> (1) the copyright and licence notices are left intact -> (2) the recipients are aware that it is free software -> (3) any unapproved changes in functionality are either -> (i) only distributed as patches -> or (ii) distributed as a new program which is not called 9wm -> and whose documentation gives credit where it is due -> (4) the author is not held responsible for any defects -> or shortcomings in the software, or damages caused by it. -> -> There is no warranty for this software. Have a nice day. diff --git a/tools/aewm-drakx/aewm-drakx.c b/tools/aewm-drakx/aewm-drakx.c deleted file mode 100644 index 4df2544af..000000000 --- a/tools/aewm-drakx/aewm-drakx.c +++ /dev/null @@ -1,50 +0,0 @@ -/* aewm - a minimalistic X11 window manager. ------- vim:sw=4:et - * Copyright (c) 1998-2001 Decklin Foster <decklin@red-bean.com> - * Free software! Please see README for details and license. */ - -#include "aewm.h" - - -Display *dpy; -Window root; - -static void scan_wins(void) -{ - unsigned int nwins, i; - Window dummyw1, dummyw2, *wins; - XWindowAttributes attr; - - XQueryTree(dpy, root, &dummyw1, &dummyw2, &wins, &nwins); - for (i = 0; i < nwins; i++) { - XGetWindowAttributes(dpy, wins[i], &attr); - if (!attr.override_redirect && attr.map_state == IsViewable) - make_new_client(wins[i]); - } - XFree(wins); -} - -static void setup_display(void) -{ - XSetWindowAttributes sattr; - - dpy = XOpenDisplay(NULL); - - if (!dpy) { - err("can't open display! check your DISPLAY variable."); - exit(1); - } - - XSetErrorHandler(handle_xerror); - root = RootWindow(dpy, DefaultScreen(dpy)); - - sattr.event_mask = SubstructureRedirectMask|SubstructureNotifyMask; - XChangeWindowAttributes(dpy, root, CWEventMask, &sattr); -} - - -int main() -{ - setup_display(); - scan_wins(); - do_event_loop(); -} diff --git a/tools/aewm-drakx/aewm.h b/tools/aewm-drakx/aewm.h deleted file mode 100644 index 1f2f11f1f..000000000 --- a/tools/aewm-drakx/aewm.h +++ /dev/null @@ -1,34 +0,0 @@ -/* aewm - a minimalistic X11 window manager. ------- vim:sw=4:et - * Copyright (c) 1998-2001 Decklin Foster <decklin@red-bean.com> - * Free software! Please see README for details and license. */ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <X11/Xutil.h> - -typedef struct _Client Client; - -struct _Client { - Client *next; - Window window; -}; - -extern Display *dpy; - -/* events.c */ -extern void do_event_loop(void); - -/* client.c */ -extern Client *find_client(Window); -extern void set_focus_on(Window w); -extern void set_wm_state(Client *, int); -extern void remove_client(Client *); -extern void make_new_client(Window); - -/* misc.c */ -void err(const char *, ...); -int handle_xerror(Display *, XErrorEvent *); - - -#define wm_state XInternAtom(dpy, "WM_STATE", False) diff --git a/tools/aewm-drakx/client.c b/tools/aewm-drakx/client.c deleted file mode 100644 index 8db6b2151..000000000 --- a/tools/aewm-drakx/client.c +++ /dev/null @@ -1,122 +0,0 @@ -/* aewm - a minimalistic X11 window manager. ------- vim:sw=4:et - * Copyright (c) 1998-2001 Decklin Foster <decklin@red-bean.com> - * Free software! Please see README for details and license. */ - -#include "aewm.h" -#include <X11/Xmd.h> - - -Client *head_client = NULL; - -Client *find_client(Window w) -{ - Client *c; - - for (c = head_client; c; c = c->next) - if (c->window == w) return c; - - return NULL; -} - -void set_focus_on(Window w) -{ - char *name; - XFetchName(dpy, w, &name); - if (name && strcmp(name, "skip")) { - XSetInputFocus(dpy, w, RevertToPointerRoot, CurrentTime); -#ifdef DEBUG - printf("aewm-drakx: adding %lx %s\n", w, name); -#endif - } -} - -/* Attempt to follow the ICCCM by explicity specifying 32 bits for - * this property. Does this goof up on 64 bit systems? */ -void set_wm_state(Client *c, int state) -{ - CARD32 data[2]; - - data[0] = state; - data[1] = None; /* Icon? We don't need no steenking icon. */ - - XChangeProperty(dpy, c->window, wm_state, wm_state, - 32, PropModeReplace, (unsigned char *)data, 2); -} - -/* If we can't find a WM_STATE we're going to have to assume - * Withdrawn. This is not exactly optimal, since we can't really - * distinguish between the case where no WM has run yet and when the - * state was explicitly removed (Clients are allowed to either set the - * atom to Withdrawn or just remove it... yuck.) */ -long get_wm_state(Client *c) -{ - Atom real_type; int real_format; - unsigned long items_read, items_left; - long *data, state = WithdrawnState; - - if (XGetWindowProperty(dpy, c->window, wm_state, 0L, 2L, False, - wm_state, &real_type, &real_format, &items_read, &items_left, - (unsigned char **) &data) == Success && items_read) { - state = *data; - XFree(data); - } - return state; -} - -void remove_client(Client *c) -{ - int ignore_xerror(Display *dpy, XErrorEvent *e) { return 0; } - - Client *p; - - XGrabServer(dpy); - XSetErrorHandler(ignore_xerror); - - set_wm_state(c, WithdrawnState); - - if (head_client == c) head_client = c->next; - else for (p = head_client; p && p->next; p = p->next) - if (p->next == c) p->next = c->next; - - free(c); - - if (head_client) set_focus_on(head_client->window); - - XSync(dpy, False); - XSetErrorHandler(handle_xerror); - XUngrabServer(dpy); -} - -void make_new_client(Window w) -{ - Client *c; - XWindowAttributes attr; - - c = malloc(sizeof *c); - c->next = head_client; - c->window = w; - head_client = c; - - XGrabServer(dpy); - XGetWindowAttributes(dpy, w, &attr); - - - if (attr.map_state != IsViewable) { - XWMHints *hints; - set_wm_state(c, NormalState); - if ((hints = XGetWMHints(dpy, w))) { - if (hints->flags & StateHint) set_wm_state(c, hints->initial_state); - XFree(hints); - } - } - if (attr.map_state == IsViewable) { - XMapWindow(dpy, c->window); - set_wm_state(c, NormalState); - } else if (get_wm_state(c) == NormalState) { - XMapWindow(dpy, c->window); - } - set_focus_on(w); - - XSync(dpy, False); - XUngrabServer(dpy); -} diff --git a/tools/aewm-drakx/events.c b/tools/aewm-drakx/events.c deleted file mode 100644 index f9a387e1e..000000000 --- a/tools/aewm-drakx/events.c +++ /dev/null @@ -1,106 +0,0 @@ -/* aewm - a minimalistic X11 window manager. ------- vim:sw=4:et - * Copyright (c) 1998-2001 Decklin Foster <decklin@red-bean.com> - * Free software! Please see README for details and license. */ - -#include "aewm.h" - - -static void handle_configure_request(XConfigureRequestEvent *e) -{ - XWindowChanges wc; - - wc.x = e->x; - wc.y = e->y; - wc.width = e->width; - wc.height = e->height; - wc.sibling = e->above; - wc.stack_mode = e->detail; - XConfigureWindow(dpy, e->window, e->value_mask, &wc); -} - -static void handle_map_request(XMapRequestEvent *e) -{ - Client *c = find_client(e->window); - - if (c) { - XMapWindow(dpy, c->window); - set_wm_state(c, NormalState); - set_focus_on(c->window); - } else { - make_new_client(e->window); - } -} - -static void handle_destroy_event(XDestroyWindowEvent *e) -{ - Client *c = find_client(e->window); - - if (c) remove_client(c); -} - - -#ifdef DEBUG -#define SHOW_EV(name, memb) \ - case name: s = #name; w = e.memb.window; break; -#define SHOW(name) \ - case name: return #name; - -void show_event(XEvent e) -{ - char *s = 0, buf[20]; - char *dd = 0; - Window w = 0; - Client *c; - - switch (e.type) { - SHOW_EV(ButtonPress, xbutton) - SHOW_EV(ButtonRelease, xbutton) - SHOW_EV(ClientMessage, xclient) - SHOW_EV(ColormapNotify, xcolormap) - SHOW_EV(ConfigureNotify, xconfigure) - SHOW_EV(ConfigureRequest, xconfigurerequest) - SHOW_EV(CreateNotify, xcreatewindow) - SHOW_EV(DestroyNotify, xdestroywindow) - SHOW_EV(EnterNotify, xcrossing) - SHOW_EV(Expose, xexpose) - SHOW_EV(MapNotify, xmap) - SHOW_EV(MapRequest, xmaprequest) - SHOW_EV(MappingNotify, xmapping) - SHOW_EV(MotionNotify, xmotion) - SHOW_EV(PropertyNotify, xproperty) - SHOW_EV(ReparentNotify, xreparent) - SHOW_EV(ResizeRequest, xresizerequest) - SHOW_EV(UnmapNotify, xunmap) - default: - break; - } - - c = find_client(w); - - if (c) XFetchName(dpy, c->window, &dd); - - snprintf(buf, sizeof buf, dd ? dd : ""); - err("%#-10lx: %-20s: %s", w, buf, s); -} -#endif - - -void do_event_loop(void) -{ - XEvent ev; - - for (;;) { - XNextEvent(dpy, &ev); -#ifdef DEBUG - show_event(ev); -#endif - switch (ev.type) { - case ConfigureRequest: - handle_configure_request(&ev.xconfigurerequest); break; - case MapRequest: - handle_map_request(&ev.xmaprequest); break; - case DestroyNotify: - handle_destroy_event(&ev.xdestroywindow); break; - } - } -} diff --git a/tools/aewm-drakx/misc.c b/tools/aewm-drakx/misc.c deleted file mode 100644 index fa0523534..000000000 --- a/tools/aewm-drakx/misc.c +++ /dev/null @@ -1,29 +0,0 @@ -/* aewm - a minimalistic X11 window manager. ------- vim:sw=4:et - * Copyright (c) 1998-2001 Decklin Foster <decklin@red-bean.com> - * Free software! Please see README for details and license. */ - -#include "aewm.h" -#include <stdarg.h> - - -void err(const char *fmt, ...) -{ - va_list argp; - - fprintf(stderr, "aewm: "); - va_start(argp, fmt); - vfprintf(stderr, fmt, argp); - va_end(argp); - fprintf(stderr, "\n"); -} - -int handle_xerror(Display *dpy, XErrorEvent *e) -{ - Client *c = find_client(e->resourceid); - - char msg[255]; - XGetErrorText(dpy, e->error_code, msg, sizeof msg); - err("X error (%#lx): %s", e->resourceid, msg); - - return 0; -} diff --git a/tools/alpha/cd/Makefile b/tools/alpha/cd/Makefile deleted file mode 100644 index 67af70f2f..000000000 --- a/tools/alpha/cd/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -install: - cp -f README README.milo $(ROOTDEST) - install -d $(ROOTDEST)/etc - cp -f aboot.cnf $(ROOTDEST)/etc - - install -d $(ROOTDEST)/boot - cp -a up1000 $(ROOTDEST)/boot - mv -f $(ROOTDEST)/boot/up1000/apb.* $(ROOTDEST) diff --git a/tools/alpha/cd/README b/tools/alpha/cd/README deleted file mode 100644 index 78eb94bd5..000000000 --- a/tools/alpha/cd/README +++ /dev/null @@ -1,40 +0,0 @@ -!! beta version !! - -Mandrake Alpha short Howto-Install - -this doc is for SRM, if you have alphabios, see README.milo - - -* to install from the cdrom: - -- either boot on the cdrom: - - in SRM, find the device name corresponding to the cdrom (`show device' can help) - - enter `boot dqa0 -fl 0' (replacing dqa0 by the cdrom device) - -- or you can boot on a floppy: - - first create a boot floppy from images/cdrom.img - - in SRM, find the device name corresponding to the floppy (`show device' can help) - - enter `boot dva0 -fl 0' (replacing dva0 by the floppy device) - - fulfill the install. - -* on reboot: - -- either enter `boot XXXX -fl 0' where XXXX is the device where you installed -the system - -- if the device is not available via SRM, use the -cdrom: `boot dqa0 -file boot/v.gz -fl root=/dev/sda1' (replace sda1 by the -root you installed on, and dqa0 by the cdrom device) - - -* to install from the network: - -Same as for the cdrom install, except give `boot dqa0 -fl 1' or boot on -images/network.img floppy (with `boot dva0 -fl 0') - - - - Alpha Team. - -Reports problems to Chmouel Boudjnah <chmouel@mandrakesoft.com> or Pixel -<pixel@mandrakesoft.com>. diff --git a/tools/alpha/cd/README.milo b/tools/alpha/cd/README.milo deleted file mode 100644 index d2a52abe9..000000000 --- a/tools/alpha/cd/README.milo +++ /dev/null @@ -1,13 +0,0 @@ -* to install from the cdrom: - -- put boot/cdrom.rdz on a floppy - -- put that floppy in drive fd0 - -- configure alphabios with (example for miata): - -Boot File: CD: \milo\miata\linload.exe -OS path: CD: \milo\miata\milo -OS options: boot scd0:/boot/instboot.gz root=/dev/fd0 load_ramdisk=1 mdkinst rw ramdisk_size=32000 - -if you want text install, just add "text" to the options above diff --git a/tools/alpha/cd/aboot.cnf b/tools/alpha/cd/aboot.cnf deleted file mode 100644 index 42c7a4382..000000000 --- a/tools/alpha/cd/aboot.cnf +++ /dev/null @@ -1,3 +0,0 @@ -0:boot/instboot.gz initrd=boot/cdrom.rdz mdkinst rw ramdisk=32000 cdrom -1:boot/instboot.gz initrd=boot/network.rdz mdkinst rw ramdisk=32000 network -2:boot/instboot.gz initrd=boot/hd.rdz mdkinst rw ramdisk=32000 hd diff --git a/tools/alpha/cd/up1000/5100440A.txt b/tools/alpha/cd/up1000/5100440A.txt deleted file mode 100644 index ba6c5a9f1..000000000 --- a/tools/alpha/cd/up1000/5100440A.txt +++ /dev/null @@ -1,25 +0,0 @@ -The source code for the object code and executable programs licensed - -under GNU General Public License Version 2, June 1991 are available - -from Alpha Processor, Inc. at the API web site - - - - http://www.Alpha-Processor.COM - - - -For each distributed object or executable form of the programs, you - -will find an identifying API part number. You may use that part - -number to find the corresponding machine-readable source code. - - - -If you have any questions, contact Customer Support at API. - - - -51-0044-0A
\ No newline at end of file diff --git a/tools/alpha/cd/up1000/README.txt b/tools/alpha/cd/up1000/README.txt deleted file mode 100644 index 88f8855d3..000000000 --- a/tools/alpha/cd/up1000/README.txt +++ /dev/null @@ -1,16 +0,0 @@ -Known issues with the UP1000 system: - -1. Linux boot via floppy disk drive: - When booting Linux via APB, it takes about 5 minutes for APB to load the kernel image from a floppy device. Booting from a hard disk takes a matter of seconds. - -2. 2x AGP card: - a. At the present time, 2x AGP driver for Linux is not available so 2x mode has not been tested. - b. The following cards have been used in 1x AGP mode: cards with Permedia-2 controller: Fire - GL1000, ELSA Synergy, E&S, Matrox Millenium G200 and Stealth 2000. - c. 3Dfx Rage Pro Turbo card does not work because the option ROM on the AGP card is - not properly emulated by Alpha BIOS. - -3. Linux installation: - a. To install Linux, please click the "Utilities" menu in the Alpha BIOS setup mode and the - "Run Maintenance Program". And follow the Linux installation procedure that API provides. - b. Please do not use the "Install Linux" menu in the "Operating System" menu.
\ No newline at end of file diff --git a/tools/alpha/cd/up1000/apb.cfg b/tools/alpha/cd/up1000/apb.cfg deleted file mode 100755 index 06614adcb..000000000 --- a/tools/alpha/cd/up1000/apb.cfg +++ /dev/null @@ -1,2 +0,0 @@ -floppy|bootl boot\up1000\up1000.pal boot\instboot.gz root=/dev/fd0 load_ramdisk=1 mdkinst rw ramdisk_size=32000 -floppy_text|bootl boot\up1000\up1000.pal boot\instboot.gz root=/dev/fd0 load_ramdisk=1 mdkinst rw ramdisk_size=32000 text diff --git a/tools/alpha/cd/up1000/apb.exe b/tools/alpha/cd/up1000/apb.exe Binary files differdeleted file mode 100755 index 4b3aa6099..000000000 --- a/tools/alpha/cd/up1000/apb.exe +++ /dev/null diff --git a/tools/alpha/cd/up1000/install.txt b/tools/alpha/cd/up1000/install.txt deleted file mode 100644 index 61dff54f9..000000000 --- a/tools/alpha/cd/up1000/install.txt +++ /dev/null @@ -1,356 +0,0 @@ - -- Contents of floppy - -apb.exe Alpha Processor bootloader v. 1.0.1. -apb.cfg Sample apb configuration file. -up1000.pal PAL code for Linux on UP1000. -vmlinux.gz Linux kernel v. 2.2.12 with UP1000 patch. -System.gz Kernel Symbol table. -INSTALL This file. - - -- Installation of RedHat Linux from CD ROM - -1. Copy this directory to a floppy disk. - -2. Insert floppy disk and RedHat Linux CD ROM. - This installation guide assumes - - hard disk is connected to primary channel as a master - - CD ROM drive is connected to primary channel as a slave - -3. From AlphaBIOS run apb.exe as a utility program. - [F2]->Utility->Run maintanace program - -4. At the apb command prompt, type - apb> cd floppy - apb> bootl up1000.pal vmlinux.gz root=/dev/hdb - This assumes you have an ATAPI CD ROM drive which Linux recognizes - as /dev/hdb (you may have to try /dev/hda, /dev/hdc, etc. depending - on your configuration. For a SCSI CD ROM drive, /dev/scd or - /dev/scd0. - -5. This should get you into the RedHat installation program. During the - disk partitioning phase of the installation be sure to allocate a small - FAT partition to be used as the "boot" partition. 10 MB should be ample. - If you choose 'Workstation' or 'Server' package then you don't need to - partition the disk by yourself. - * Follow the common redhat installation procedure. - * During install, Don't configure X server, - * Select 'Startup through ARC console' on timezone setup menu. - -6. Due to bugs in redhat 6.0, FAT partition is not formatted during installation - depends on package selection. - So, After installation, run apb.exe from flopy again and at the - apb command prompt, type - apb> cd floppy - apb> bootl up1000.pal vmlinux.gz root=/dev/hda5 single - You'll get shell prompt then type following commands. - # mkfs -t msdos /dev/hda1 - # mount /dev/hda1 /dos - # mcopy a:*.* /dos - # gzip -dc /dos/system.gz > /boot/System.map - # ln -s Tsunami /etc/alpha_systype - # init 6 - -8. Configure the OS selection menu of AlphaBIOS to start apb.exe - from the boot partition. - In 'OS Selection' menu([F2]->Operating system->OS selection setup), - Make an entry like this. - - Boot name: Linux - Boot file: Disk 0 Partition 1 \apb.exe - OS Path : Disk 0 Partition 2 \winnt - OS Options: - - OS Path doesn't have any meaning, just leave it intact. - -9. You can run apb from hard disk by selecting what you configured on step 8. - -10. Set the environment variable APB_DEVICE to be the AlphaBIOS name - of the boot partition. - For example, - apb> setenv APB_DEVICE scsi(0)disk(0)rdisk(0)partition(1) - type 'cd' once to make above environment variable change to be applied. - apb> cd - -11. Now, You can boot linux by selecting 'Linux' on BIOS' OS boot menu - and then type this on apb prompt - - apb> bootl up1000.pal vmlinux.gz root=/dev/hda5 - - If you don't want to type above long line everytime. You have two options - 1. Create apb.cfg file under /dos directory, Its contents look like - - linux|bootl up1000.pal vmlinux.gz root=/dev/hda5 - - then you can boot linux by typying - - apb> boot linux - - 2. Put option string in OS Selection setup menu of BIOS setup. - - Boot name: Linux - Boot file: Disk 0 Partition 1 \apb.exe - OS Path : Disk 0 Partition 2 \winnt - OS Options: bootl up1000.pal vmlinux.gz root=/dev/hda5 - - Then this setup will boot linux without apb prompt. - - -------------------------------------------------------------------------------- - - - APB -- Alpha Processor Bootstrap Loader for AlphaBIOS - - Alpha Processor, Inc. - 130C Baker Ave. Ext. - Concord, MA 01742, USA - - David Daniel, Soohoon Lee, Stig Telfer - customer.support@alpha-processor.com - -======================================================================== - - Copyright (c) 1999, Alpha Processor, Inc. - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the copyright notice and this permission notice appear -in all copies of software and supporting documentation, and that the -name of Alpha Processor not be used in advertising or publicity -pertaining to distribution of the software without specific, written -prior permission. Alpha Processor grants this permission provided -that you prominently mark, as not part of the original, any -modifications made to this software or documentation. - -Alpha Processor disclaims all warranties and/or guarantees with regard -to this software, including all implied warranties of fitness for a -particular purpose and merchantability, and makes no representations -regarding the use of, or the results of the use of, the software and -documentation in terms of correctness, accuracy, reliability, -currentness or otherwise; and you rely on the software, documentation -and results solely at your own risk. - -======================================================================== - - -0. Introduction - -APB is a bootstrap loader for Alpha processor based systems with -AlphaBIOS firmware. It is primarily intended to be used for booting -Linux, though it may also be useful for free BSD derived systems. - -APB borrows ideas and some code from many places, notably Linux and -other Linux loaders for Alpha systems (aboot and MILO), and the ARCDos -example in the ARC Application Development Kit. APB can also be -linked against zlib to support reading compressed kernel and PALcode -images. See the file CREDITS for details. - - -1. Using APB - -+ Overview - -APB presents a simple command line interface with the following -commands - - boot TARGET boot a target in the configuration file - bootl PALCODE KERNEL ARG1 ... boot Unix - cd DEVICE set the current device - cp | copy FILE1 FILE2 copy files - exit | quit exit to AlphaBIOS - halt | reset system shutdown options - ls | dir list files on the current device - mkdir DIR make a directory - more FILE list a file - mv | rename FILE1 FILE2 rename a file - pwd print the current device - rm | delete FILE delete a file - printenv [NAME] print environment variable(s) - setenv [NAME [VAL]] (un)set environment variable - show targets | devices show information - -At any time an AlphaBIOS is device is selected as the default or -current device. On initialization this is set to the value of the -APB_DEVICE firmware environment variable, or "multi(0)disk(0)fdisk(0)" -(usually the floppy device) if this is not set. - -To change the default device, use the "cd" command. For example - - cd scsi(0)disk(0)rdisk(0)partition(2)\os\linux - -sets the default device to be the second partition of the disk 0 on -the 0th SCSI controller. To save this for future invocations, set the -APB_DEVICE firmware environment variable using the "setenv" command: - - setenv APB_DEVICE scsi(0)disk(0)rdisk(0)partition(2)\os\linux - -After this you can return to this device using "cd". - -Also the special targets - - cd floppy - cd cdrom - -will take you to the (first) floppy and CD-ROM drives respectively. - -If there is a file system supported by AlphaBIOS on the device -- FAT, -ISO 9660 (CD-ROM) -- then a directory listing can be obtained using -the "dir" or "ls" command: - - apb> ls - Directory listing of scsi(0)disk(0)rdisk(0)partition(2): - APB.CFG - APB.EXE - LINUX.PAL - VMLINUX - - -+ Booting from disk - -The recommended way to boot a system using APB is set aside a small -(10 - 30 MB) FAT partition on one disk to be used as a boot partition. -The following files should be placed on the boot partition: - - The APB image (APB.EXE) - The PALcode image - The kernel image - An optional configuration file "APB.CFG" (see below) - -Run APB (either from floppy or from the boot partition and use it to -set the environment variable APB_DEVICE to the name of the boot -partition. For example if the boot partition is the first partition -on a SCSI disk with SCSI ID 3 on the first SCSI controller, and the files are in directory \os\linux set APB_DEVICE using - - apb> setenv APB_DEVICE scsi(0)disk(3)rdisk(0)partition(1)\os\linux - -To enable autoboot - - apb> setenv APB_AUTOBOOT 1 - -This performs the first boot command it finds in the APB configuration -file, unless interrupted. - -Otherwise boot manually using a command such as - - apb> bootl palcode kernel [kernel_arg1 [kernel_arg1 ...]] - -or use one of the labels defined in the APB configuration file, for -example - - apb> boot linux - -See below for the configuration file format. - -+ Environment variables - -APB uses the following firmware environment variables to set default -noptions: - - APB_DEVICE Default device for all operations - APB_AUTOBOOT Determines whether an autoboot should be attempted - -If these are not set on invocation, then they are set to reasonable -values, namely - - APB_DEVICE=multi(0)disk(0)fdisk(0) - APB_AUTOBOOT=0 - -+ Configuration file - -APB consults a configuration file "APB.CFG" that is assumed to be -located at the current device path (initially given by environment -variable APB_DEVICE). The file consists of lines that are either -comments, or boot commands prefixed with a mnemonic label. For example - - # This is comment - linux-2.2|bootl linux.pal vmlinux.gz root=/dev/sda3 - linux-2.0|bootl linux.pal vml20.gz root=/dev/sda3 - -In this case, to boot linux-2.2, type - - apb> boot linux-2.2 - -which is equivalent to - - apb> bootl linux.pal vmlinux.gz root=/dev/sda3 - -If the AUTO_BOOT environment variable is set TRUE, then the default -configuration will be booted after 10 seconds, unless a key is -pressed. - -+ Boot devices - -APB can boot from any filesystem supported by AlphaBIOS. At present -these are limited to FAT, NTFS and ISO 9660 (CD-ROM). - -+ Booting from a network device - -Not yet implemented. - - -2. Building APB - -APB is an AlphaBIOS/ARC application. Currently it must be built on an -Microsoft Windows NT 4.0 Alpha processor system, with Microsoft Visual -C++ 5.0 (or higher), the Microsoft Software Development Kit (SDK) and -Device Driver Development Kit (DDK) for NT 4.0, and Compaq ARC -Application Development Kit (ADK) 1.3. - -Optionally, APB can be linked against zlib (a free compression -library) to support reading compressed kernel and PALcode images. - -To build, open a command window, set up the environment: - - VC++ (e.g "C:Program Files\DevStudio\VC\bin\vcvars32.bat") - DDK (e.g. "C:\DDK\bin\setenv.bat C:\DDK") - ADK (e.g. "set ADK=C:\adkv13\adk") - -and then and make using nmake. For example: - - C:\apb-1.0> nmake - -where the DDK has been installed on the C: drive. - -If building with compressed file support, obtain and unpack zlib -(http://www.cdrom.com/pub/infozip/zlib/), set the variable ZLIB to -the zlib directory, and then make. For example - - C:\apb-1.0> set ZLIB=C:\zlib-1.1.3 - C:\apb-1.0> nmake - -In either case, the executable is placed in the "obj\alpha" -subdirectory. - - -3. What APB does - -Booting Linux with APB involves the following steps: - - AlphaBIOS loads and transfers control to APB. - - APB is called with an argument specifying the device (as known to - AlphaBIOS) from which to read the Linux kernel, and additional - arguments to be passed on to the kernel. - - APB sets up the environment for Linux, including loading and - switching to the correct PAL code, setting up the HWRPB, copying - kernel arguments to the right location in memory etc. - - APB reads the Linux kernel image into memory from the specified - device (raw disk initially, and eventually filesystems or network - devices via bootp) and transfers control. - - -4. Modifying APB - -APB has been written with the aim of maintaining platform independence -across all AlphaBIOS (and ARC) systems. Furthermore, all dependence -on the ARC API has been isolated in the file "arc.c", so that porting -to another firmware environment should not be too difficult as long as -it provides a sufficiently complete API. - -Additional user commands can be incorporated through the command -dispatch table in "cmd.c". - diff --git a/tools/alpha/cd/up1000/up1000.pal b/tools/alpha/cd/up1000/up1000.pal Binary files differdeleted file mode 100644 index a47b359f3..000000000 --- a/tools/alpha/cd/up1000/up1000.pal +++ /dev/null diff --git a/tools/alpha/e2fsck.shared b/tools/alpha/e2fsck.shared Binary files differdeleted file mode 100755 index 765e664a1..000000000 --- a/tools/alpha/e2fsck.shared +++ /dev/null diff --git a/tools/checkusedmodules b/tools/checkusedmodules new file mode 100755 index 000000000..433ed54d9 --- /dev/null +++ b/tools/checkusedmodules @@ -0,0 +1,22 @@ +#!/bin/sh + +# This script compares the perl modules used by the .pm files in perl-install +# against the ones listed in share/list, to detect potential missing modules +# (and potential run-time problems during the stage 2) + +cd ../perl-install || exit 1; + +# list of used .pm files +find . -name '*.pm' -not -name b_dump_strings.pm -not -path ./interactive/http.pm | \ + xargs perl -lne '/^\s*(use|require)\s+([\w:]+)/ && print $2' | sort -u > /tmp/gi-used-pm + +# list of .pm files included in install +perl -lne 'm{/(?:PERL_VERSION|ARCH-linux|vendor_perl/\*)/([\w/]+)\.pm$} and $_=$1, s,/,::,g, print' share/list > /tmp/gi-found-pm0 +find . -name blib -prune -o -name '*.pm' | perl -ne 's,^\./,,; s/\.pm$// or next; s,/,::,g; print' >> /tmp/gi-found-pm0 + +# compute difference +sort -u /tmp/gi-found-pm0 > /tmp/gi-found-pm +diff -u /tmp/gi-{used,found}-pm | perl -lne 'BEGIN{print"Unpackaged modules:"} s/^-(?!-)/ / && print' + +# cleanup +rm -f /tmp/gi-used-pm /tmp/gi-found-pm{,0} diff --git a/tools/closurepkgs b/tools/closurepkgs deleted file mode 100755 index 2ef479486..000000000 --- a/tools/closurepkgs +++ /dev/null @@ -1,108 +0,0 @@ -#!/usr/bin/perl - -use rpmtools; - -sub chop_version($) { - ($_[0] =~ /(.*)-[^-]+-[^-]+/)[0] || $_[0]; -} - -sub read_compsslist { - my ($file) = @_; - my %compsslist; - - local *F; - open F, $file or die "closurepkgs: unable to open compsslist file $file\n"; - foreach (<F>) { - my ($name, $level) = /^\s*(\S+)\s+(\d+)/; - $compsslist{$name} = $level; - } - close F; - - \%compsslist; -} - -sub main { - my ($dir, $lang) = @_; - - #- compute depslist on line directly. - my $params = new rpmtools; - foreach (glob("$dir/*.cz*")) { $params->read_hdlists($_) } - $params->keep_only_cleaned_provides_files(); - foreach (glob("$dir/*.cz*")) { $params->read_hdlists($_) } - $params->compute_depslist(); - - my $compsslist = read_compsslist("$dir/compssList"); - - #- DO NOT FORGET TO UPDATE HERE ACCORDING TO gi/perl-install/install_any.pm - my @pkgs = qw(XFree86 XFree86-glide-module Device3Dfx Glide_V3-DRI Glide_V5 Mesa - dhcpcd pump dhcpxd dhcp-client isdn4net isdn4k-utils dev pptp-adsl-fr rp-pppoe ppp ypbind - rhs-printfilters lpr cups cups-drivers samba ncpfs ghostscript-utils - kernel-pcmcia-cs apmd cdrecord - ); - push @pkgs, "XFree86-$_" foreach qw(3DLabs 3dfx 8514 AGX FBDev I128 Mach8 Mach32 Mach64 Mono P9000 Rage128 S3 S3V SVGA VGA16 W32); - - #- closure the list of package to be kept for oem. - my %closure; - foreach (@pkgs) { - $closure{$_} = 1; - map { $closure{chop_version($_->{name})} = 1 } map { $params->{depslist}[$_] } map { split /\|/ } split ' ', $params->{info}{$_}{deps}; - } - #- only if dependancy is ok. - $closure{$_} = 1 foreach qw(xpp kups kisdn); - - #- closure the list of package to always install for oem. (level >= 50)... - my %install; - my @force_install; - if ($params->{info}{"locales-$lang"}) { - foreach (keys %{$params->{info}}) { - push @force_install, $_ if grep { $_ == $params->{info}{"locales-$lang"}{id} } split ' ', $params->{info}{$_}{deps}; - } - } else { - foreach (keys %{$params->{info}}) { - push @force_install, $_ if grep { $params->{depslist}[$_]{name} =~ /locales-/ } split ' ', $params->{info}{$_}{deps}; - } - } - push @force_install, qw(cups cups-drivers drakprofile draksync irda-utils numlock raidtools reiserfs-utils - Mesa Mesa-demos alsa alsa-utils); - foreach (qw( - Aurora xawtv kwintv xscreensaver-gl Mesa-demos xmms-mesa bzflag csmash gltron spacecup chromium tuxracer - ), @force_install, grep { $compsslist->{$_} >= 50 } keys %{$params->{info}}) { - $install{$_} = 1; - map { $install{chop_version($_->{name})} = 1 } map { $params->{depslist}[$_] } map { split /\|/ } split ' ', $params->{info}{$_}{deps}; - } - - #- remove base packages, which have to be installed, according to basesystem. - delete $closure{'basesystem'}; - $install{'basesystem'} = 1; - map { delete $closure{chop_version($_->{name})}; - $install{chop_version($_->{name})} = 1 } map { $params->{depslist}[$_] } map { split /\|/ } split ' ', $params->{info}{'basesystem'}{deps}; - - #- special packages that are to be move to closure always ... - foreach (qw(kernel-smp kernel-linus kernel-secure hackkernel-smp hackkernel-linus hackkernel-secure - Aurora xawtv kwintv xscreensaver-gl xmms-mesa bzflag csmash gltron spacecup chromium tuxracer - )) { - $params->{info}{$_} or next; - $closure{$_} = 1; - delete $install{$_}; - } - - #- dump out the list of package according to the 2 lists defined above. - my $total_install = 0; - my $total_closure = 0; - foreach (@{$params->{depslist}}) { - my $tiny_name = chop_version($_->{name}); - if (exists $install{$tiny_name}) { - my $p = $params->{info}{$tiny_name}; - $total_install += $p->{size}; - print "I:$p->{name}-$p->{version}-$p->{release}\n"; - } elsif (exists $closure{$tiny_name}) { - my $p = $params->{info}{$tiny_name}; - $total_closure += $p->{size}; - print "C:$p->{name}-$p->{version}-$p->{release}\n"; - } - } - print "\n\ntotal_install=$total_install\n"; - print "total_closure=$total_closure\n"; -} - -main(@ARGV); diff --git a/tools/cvslog2changelog.pl b/tools/cvslog2changelog.pl deleted file mode 100755 index 7109ad306..000000000 --- a/tools/cvslog2changelog.pl +++ /dev/null @@ -1,84 +0,0 @@ -#!/usr/bin/perl - -while (<>) { - if ($e = /^description:/ .. /^={77}/) { - next if $e == 1 || $e =~ /E0/; - if (/^-{28}/ .. /^date: /) { - if (/^date: (\S+)\s.*author: (\S+);/) { - ($date, $user) = ($1, $2); - } - } elsif (!/^branches: / && !/file .* was initially added on branch/ && !/empty log message/ && !/no_comment/) { - $l{$date}{$user}{$file} .= $_; - } - } elsif (/Working file: (.*)/) { - $file = $1; - } -} - -foreach $date (reverse sort keys %l) { - foreach $user (sort keys %{$l{$date}}) { - $fuser = $users{$user} || $user; - print "$date $fuser\n\n"; - my %inv; - while (($file, $log) = each %{$l{$date}{$user}}) { - $log =~ s/^\s+( \*)?//ms; - $log =~ s/\s+$//ms; - $log = "\n$log" if $log =~ /^-/; - push @{$inv{$log}}, $file; - } - foreach $log (keys %inv) { - $line = join(', ', @{$inv{$log}}) . ($log !~ /^\(/ && ':') . " $log"; - print "\t* ", join("\n\t", auto_fill($line, 72)), "\n\n"; - } - } -} - -1; - -sub auto_fill { - my ($line, $col) = @_; - map { - my @l; - my $l = ''; - $_ = " $_" if /^-/; - while ($_) { - s/^(\s*)(\S*)//; - my $m = "$l$1$2"; - if (length $m > $col) { - push @l, $l; - $l = $2; - } else { - $l = $m - } - } - @l, $l; - } split("\n", $line); -} - -BEGIN { - %users = ( - 'gc' => 'Guillaume Cottenceau <gc@mandrakesoft.com>', - 'fpons' => 'François Pons <fpons@mandrakesoft.com>', - 'pablo' => 'Pablo Saratxaga <pablo@mandrakesoft.com>', - 'damien' => 'dam\'s <dams@idm.fr>', - 'install' => 'DrakX <install@mandrakesoft.com>', - 'prigaux' => 'Pixel <pixel@mandrakesoft.com>', - 'flepied' => 'Frederic Lepied <flepied@mandrakesoft.com>', - 'chmouel' => 'Chmouel Boudjnah <chmouel@mandrakesoft.com>', - 'uid526' => 'dam\'s <damien@mandrakesoft.com>', - 'uid533' => 'François Pons <fpons@mandrakesoft.com>', - 'uid535' => 'Guillaume Cottenceau <gc@mandrakesoft.com>', - 'uid553' => 'Pixel <pixel@mandrakesoft.com>', - 'tvignaud' => 'Thierry Vignaud <tvignaud@mandrakesoft.com>', - 'sbenedict'=>'Stew Benedict <sbenedict@mandrakesoft.com>', - 'tkamppeter' => 'Till Kamppeter <till@mandrakesoft.com>', - 'yduret' => 'Yves Duret <yduret@mandrakesoft.com>', - 'daouda' => 'Daouda Lo <daouda@mandrakesoft.com>', - 'dchaumette' => 'Damien Chaumette <dchaumette@mandrakesoft.com>', - 'cbelisle' => 'Christian Belisle <cbelisle@mandrakesoft.com>', - 'warly' => 'Warly <warly@mandrakesoft.com>', - 'jgotti' => 'Jonathan Gotti <jgotti@mandrakesoft.com>', - 'fcrozat' => 'Frederic Crozat <fcrozat@mandrakesoft.com>', - 'baudens' => 'David Baudens <baudens@mandrakesoft.com>', - ); -} diff --git a/tools/ddcprobe/.cvsignore b/tools/ddcprobe/.cvsignore deleted file mode 100644 index c3c3641f3..000000000 --- a/tools/ddcprobe/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -ddcxinfos diff --git a/tools/ddcprobe/COPYING b/tools/ddcprobe/COPYING deleted file mode 100644 index 0b643ac83..000000000 --- a/tools/ddcprobe/COPYING +++ /dev/null @@ -1,483 +0,0 @@ - - GNU LIBRARY GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1991 Free Software Foundation, Inc. - 675 Mass Ave, Cambridge, MA 02139, USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the library GPL. It is - numbered 2 because it goes with version 2 of the ordinary GPL.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Library General Public License, applies to some -specially designated Free Software Foundation software, and to any -other libraries whose authors decide to use it. You can use it for -your libraries, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if -you distribute copies of the library, or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link a program with the library, you must provide -complete object files to the recipients so that they can relink them -with the library, after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - Our method of protecting your rights has two steps: (1) copyright -the library, and (2) offer you this license which gives you legal -permission to copy, distribute and/or modify the library. - - Also, for each distributor's protection, we want to make certain -that everyone understands that there is no warranty for this free -library. If the library is modified by someone else and passed on, we -want its recipients to know that what they have is not the original -version, so that any problems introduced by others will not reflect on -the original authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that companies distributing free -software will individually obtain patent licenses, thus in effect -transforming the program into proprietary software. To prevent this, -we have made it clear that any patent must be licensed for everyone's -free use or not licensed at all. - - Most GNU software, including some libraries, is covered by the ordinary -GNU General Public License, which was designed for utility programs. This -license, the GNU Library General Public License, applies to certain -designated libraries. This license is quite different from the ordinary -one; be sure to read it in full, and don't assume that anything in it is -the same as in the ordinary license. - - The reason we have a separate public license for some libraries is that -they blur the distinction we usually make between modifying or adding to a -program and simply using it. Linking a program with a library, without -changing the library, is in some sense simply using the library, and is -analogous to running a utility program or application program. However, in -a textual and legal sense, the linked executable is a combined work, a -derivative of the original library, and the ordinary General Public License -treats it as such. - - Because of this blurred distinction, using the ordinary General -Public License for libraries did not effectively promote software -sharing, because most developers did not use the libraries. We -concluded that weaker conditions might promote sharing better. - - However, unrestricted linking of non-free programs would deprive the -users of those programs of all benefit from the free status of the -libraries themselves. This Library General Public License is intended to -permit developers of non-free programs to use free libraries, while -preserving your freedom as a user of such programs to change the free -libraries that are incorporated in them. (We have not seen how to achieve -this as regards changes in header files, but we have achieved it as regards -changes in the actual functions of the Library.) The hope is that this -will lead to faster development of free libraries. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, while the latter only -works together with the library. - - Note that it is possible for a library to be covered by the ordinary -General Public License rather than by this special one. - - GNU LIBRARY GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library which -contains a notice placed by the copyright holder or other authorized -party saying it may be distributed under the terms of this Library -General Public License (also called "this License"). Each licensee is -addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also compile or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - c) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - d) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the source code distributed need not include anything that is normally -distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Library General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - Appendix: How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - <one line to give the library's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - <signature of Ty Coon>, 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! - diff --git a/tools/ddcprobe/Makefile b/tools/ddcprobe/Makefile deleted file mode 100644 index 07ba43786..000000000 --- a/tools/ddcprobe/Makefile +++ /dev/null @@ -1,28 +0,0 @@ -CFLAGS=-Wall -O # -g -DDEBUG -TARGETS=ddcxinfos - -ARCH := $(patsubst i%86,i386,$(shell uname -m)) -ARCH := $(patsubst sparc%,sparc,$(ARCH)) - -ifeq (i386,$(ARCH)) - -ddcxinfos: lrmi.o vesamode.o vbe.o ddcxinfos.o - -libvbe.a: lrmi.o vesamode.o vbe.o - $(AR) cru $@ $^ - -#install: $(DESTDIR)/usr/include/vbe.h $(DESTDIR)/usr/lib/libvbe.a - -$(DESTDIR)/usr/include/vbe.h: - install -m 644 vbe.h $(DESTDIR)/usr/include/vbe.h - -$(DESTDIR)/usr/lib/libvbe.a: - install -m 644 libvbe.a $(DESTDIR)/usr/lib/libvbe.a - -else -ddcxinfos: not_handled.c - gcc -o $@ $< -endif - -clean: - $(RM) $(TARGETS) *.o core diff --git a/tools/ddcprobe/README b/tools/ddcprobe/README deleted file mode 100644 index bdba8f378..000000000 --- a/tools/ddcprobe/README +++ /dev/null @@ -1,8 +0,0 @@ -This is some VBE/DDC stuff. It makes calls to the VESA extensions in the BIOS -using a slightly modified version of Josh Vanderhoof's LRMI 0.6, and generally -requires a 2.2 or newer kernel. The idea for reading EDID data from the BIOS -came from Matt Wilson <msw@gimp.org>, as well as several ideas about better ways -to lay out data structure declarations. - -Nalin Dahyabhai -bigfun@pobox.com diff --git a/tools/ddcprobe/ddcxinfos.c b/tools/ddcprobe/ddcxinfos.c deleted file mode 100644 index 9888d5896..000000000 --- a/tools/ddcprobe/ddcxinfos.c +++ /dev/null @@ -1,71 +0,0 @@ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <math.h> -#include "vbe.h" -#include "vesamode.h" -#ident "$Id$" - -#define SQR(x) ((x) * (x)) - -int main(int argc, char **argv) -{ - int i, j; - u_int16_t *mode_list; - unsigned char hmin, hmax, vmin, vmax; - struct vbe_info *vbe_info; - struct vbe_edid1_info *edid; - struct vbe_modeline *modelines; - - - if ((vbe_info = vbe_get_vbe_info()) == NULL) return 1; - - printf("%dKB of video ram\n", vbe_info->memory_size * 64); - - /* List supported standard modes. */ - for (mode_list = vbe_info->mode_list.list; *mode_list != 0xffff; mode_list++) - for (i = 0; known_vesa_modes[i].x; i++) - if (known_vesa_modes[i].number == *mode_list) - printf("%d %d %d\n", - known_vesa_modes[i].colors, - known_vesa_modes[i].x, - known_vesa_modes[i].y - ); - printf("\n"); - - if ((edid = vbe_get_edid_info()) == NULL) return 0; - if (edid->version == 255 && edid->revision == 255) return 0; - - vbe_get_edid_ranges(edid, &hmin, &hmax, &vmin, &vmax); - modelines = vbe_get_edid_modelines(edid); - - printf(hmin ? "%d-%d kHz HorizSync\n" : "\n", hmin, hmax); - printf(vmin ? "%d-%d Hz VertRefresh\n" : "\n", vmin, vmax); - - if (edid->max_size_horizontal != 127 && edid->max_size_vertical != 127) { - char manufacturer[4]; - double size = sqrt(SQR(edid->max_size_horizontal) + - SQR(edid->max_size_vertical)) / 2.54; - manufacturer[0] = edid->manufacturer_name.char1 + 'A' - 1; - manufacturer[1] = edid->manufacturer_name.char2 + 'A' - 1; - manufacturer[2] = edid->manufacturer_name.char3 + 'A' - 1; - manufacturer[3] = '\0'; - printf(size ? "%3.2f inches monitor (truly %3.2f') EISA ID=%s%04x\n" : "\n", size * 1.08, size, manufacturer, edid->product_code); - } - - for(j=0; modelines && (modelines[j].refresh != 0); j++){ - printf("# %dx%d, %1.1f%sHz", - modelines[j].width, - modelines[j].height, - modelines[j].refresh, - modelines[j].interlaced?"i":"" - ); - if(modelines[j].modeline) { - printf("; hfreq=%f, vfreq=%f\n%s\n", - modelines[j].hfreq, - modelines[j].vfreq, - modelines[j].modeline); - } else printf("\n"); - } - return 0; -} diff --git a/tools/ddcprobe/lrmi.c b/tools/ddcprobe/lrmi.c deleted file mode 100644 index e7e25ce2e..000000000 --- a/tools/ddcprobe/lrmi.c +++ /dev/null @@ -1,911 +0,0 @@ -/* -Linux Real Mode Interface - A library of DPMI-like functions for Linux. - -Copyright (C) 1998 by Josh Vanderhoof - -You are free to distribute and modify this file, as long as you -do not remove this copyright notice and clearly label modified -versions as being modified. - -This software has NO WARRANTY. Use it at your own risk. -*/ - -#include <stdio.h> -#include <string.h> -#include <sys/io.h> -#include <asm/vm86.h> - -#ifdef USE_LIBC_VM86 -#include <sys/vm86.h> -#endif - -#include <sys/types.h> -#include <sys/stat.h> -#include <sys/mman.h> -#include <unistd.h> -#include <fcntl.h> - -#include "lrmi.h" - -#define REAL_MEM_BASE ((void *)0x10000) -#define REAL_MEM_SIZE 0x10000 -#define REAL_MEM_BLOCKS 0x100 - -struct mem_block - { - unsigned int size : 20; - unsigned int free : 1; - }; - -static struct - { - int ready; - int count; - struct mem_block blocks[REAL_MEM_BLOCKS]; - } mem_info = { 0 }; - -static int -real_mem_init(void) - { - void *m; - int fd_zero; - - if (mem_info.ready) - return 1; - - fd_zero = open("/dev/zero", O_RDONLY); - if (fd_zero == -1) - { - perror("open /dev/zero"); - return 0; - } - - m = mmap((void *)REAL_MEM_BASE, REAL_MEM_SIZE, - PROT_READ | PROT_WRITE | PROT_EXEC, - MAP_FIXED | MAP_PRIVATE, fd_zero, 0); - - if (m == (void *)-1) - { - perror("mmap /dev/zero"); - close(fd_zero); - return 0; - } - - mem_info.ready = 1; - mem_info.count = 1; - mem_info.blocks[0].size = REAL_MEM_SIZE; - mem_info.blocks[0].free = 1; - - return 1; - } - - -static void -insert_block(int i) - { - memmove( - mem_info.blocks + i + 1, - mem_info.blocks + i, - (mem_info.count - i) * sizeof(struct mem_block)); - - mem_info.count++; - } - -static void -delete_block(int i) - { - mem_info.count--; - - memmove( - mem_info.blocks + i, - mem_info.blocks + i + 1, - (mem_info.count - i) * sizeof(struct mem_block)); - } - -void * -LRMI_alloc_real(int size) - { - int i; - char *r = (char *)REAL_MEM_BASE; - - if (!mem_info.ready) - return NULL; - - if (mem_info.count == REAL_MEM_BLOCKS) - return NULL; - - size = (size + 15) & ~15; - - for (i = 0; i < mem_info.count; i++) - { - if (mem_info.blocks[i].free && size < mem_info.blocks[i].size) - { - insert_block(i); - - mem_info.blocks[i].size = size; - mem_info.blocks[i].free = 0; - mem_info.blocks[i + 1].size -= size; - - return (void *)r; - } - - r += mem_info.blocks[i].size; - } - - return NULL; - } - - -void -LRMI_free_real(void *m) - { - int i; - char *r = (char *)REAL_MEM_BASE; - - if (!mem_info.ready) - return; - - i = 0; - while (m != (void *)r) - { - r += mem_info.blocks[i].size; - i++; - if (i == mem_info.count) - return; - } - - mem_info.blocks[i].free = 1; - - if (i + 1 < mem_info.count && mem_info.blocks[i + 1].free) - { - mem_info.blocks[i].size += mem_info.blocks[i + 1].size; - delete_block(i + 1); - } - - if (i - 1 >= 0 && mem_info.blocks[i - 1].free) - { - mem_info.blocks[i - 1].size += mem_info.blocks[i].size; - delete_block(i); - } - } - - -#define DEFAULT_VM86_FLAGS (IF_MASK | IOPL_MASK) -#define DEFAULT_STACK_SIZE 0x1000 -#define RETURN_TO_32_INT 255 - -static struct - { - int ready; - unsigned short ret_seg, ret_off; - unsigned short stack_seg, stack_off; - struct vm86_struct vm; - } context = { 0 }; - - -static inline void -set_bit(unsigned int bit, void *array) - { - unsigned char *a = array; - - a[bit / 8] |= (1 << (bit % 8)); - } - - -static inline unsigned int -get_int_seg(int i) - { - return *(unsigned short *)(i * 4 + 2); - } - - -static inline unsigned int -get_int_off(int i) - { - return *(unsigned short *)(i * 4); - } - - -static inline void -pushw(unsigned short i) - { - struct vm86_regs *r = &context.vm.regs; - r->esp -= 2; - *(unsigned short *)(((unsigned int)r->ss << 4) + r->esp) = i; - } - - -int -LRMI_init(void) - { - void *m; - int fd_mem; - - if (context.ready) - return 1; - - if (!real_mem_init()) - return 0; - - /* - Map the Interrupt Vectors (0x0 - 0x400) + BIOS data (0x400 - 0x502) - and the ROM (0xa0000 - 0x100000) - */ - fd_mem = open("/dev/mem", O_RDWR); - - if (fd_mem == -1) - { - perror("open /dev/mem"); - return 0; - } - - m = mmap((void *)0, 0x502, - PROT_READ | PROT_WRITE | PROT_EXEC, - MAP_FIXED | MAP_PRIVATE, fd_mem, 0); - - if (m == (void *)-1) - { - perror("mmap /dev/mem"); - return 0; - } - - m = mmap((void *)0xa0000, 0x100000 - 0xa0000, - PROT_READ | PROT_WRITE, - MAP_FIXED | MAP_SHARED, fd_mem, 0xa0000); - - if (m == (void *)-1) - { - perror("mmap /dev/mem"); - return 0; - } - - - /* - Allocate a stack - */ - m = LRMI_alloc_real(DEFAULT_STACK_SIZE); - - context.stack_seg = (unsigned int)m >> 4; - context.stack_off = DEFAULT_STACK_SIZE; - - /* - Allocate the return to 32 bit routine - */ - m = LRMI_alloc_real(2); - - context.ret_seg = (unsigned int)m >> 4; - context.ret_off = (unsigned int)m & 0xf; - - ((unsigned char *)m)[0] = 0xcd; /* int opcode */ - ((unsigned char *)m)[1] = RETURN_TO_32_INT; - - memset(&context.vm, 0, sizeof(context.vm)); - - /* - Enable kernel emulation of all ints except RETURN_TO_32_INT - */ - memset(&context.vm.int_revectored, 0, sizeof(context.vm.int_revectored)); - set_bit(RETURN_TO_32_INT, &context.vm.int_revectored); - - context.ready = 1; - - return 1; - } - - -static void -set_regs(struct LRMI_regs *r) - { - context.vm.regs.edi = r->edi; - context.vm.regs.esi = r->esi; - context.vm.regs.ebp = r->ebp; - context.vm.regs.ebx = r->ebx; - context.vm.regs.edx = r->edx; - context.vm.regs.ecx = r->ecx; - context.vm.regs.eax = r->eax; - context.vm.regs.eflags = DEFAULT_VM86_FLAGS; - context.vm.regs.es = r->es; - context.vm.regs.ds = r->ds; - context.vm.regs.fs = r->fs; - context.vm.regs.gs = r->gs; - } - - -static void -get_regs(struct LRMI_regs *r) - { - r->edi = context.vm.regs.edi; - r->esi = context.vm.regs.esi; - r->ebp = context.vm.regs.ebp; - r->ebx = context.vm.regs.ebx; - r->edx = context.vm.regs.edx; - r->ecx = context.vm.regs.ecx; - r->eax = context.vm.regs.eax; - r->flags = context.vm.regs.eflags; - r->es = context.vm.regs.es; - r->ds = context.vm.regs.ds; - r->fs = context.vm.regs.fs; - r->gs = context.vm.regs.gs; - } - -#define DIRECTION_FLAG (1 << 10) - -static void -em_ins(int size) - { - unsigned int edx, edi; - - edx = context.vm.regs.edx & 0xffff; - edi = context.vm.regs.edi & 0xffff; - edi += (unsigned int)context.vm.regs.ds << 4; - - if (context.vm.regs.eflags & DIRECTION_FLAG) - { - if (size == 4) - asm volatile ("std; insl; cld" - : "=D" (edi) : "d" (edx), "0" (edi)); - else if (size == 2) - asm volatile ("std; insw; cld" - : "=D" (edi) : "d" (edx), "0" (edi)); - else - asm volatile ("std; insb; cld" - : "=D" (edi) : "d" (edx), "0" (edi)); - } - else - { - if (size == 4) - asm volatile ("cld; insl" - : "=D" (edi) : "d" (edx), "0" (edi)); - else if (size == 2) - asm volatile ("cld; insw" - : "=D" (edi) : "d" (edx), "0" (edi)); - else - asm volatile ("cld; insb" - : "=D" (edi) : "d" (edx), "0" (edi)); - } - - edi -= (unsigned int)context.vm.regs.ds << 4; - - context.vm.regs.edi &= 0xffff0000; - context.vm.regs.edi |= edi & 0xffff; - } - -static void -em_rep_ins(int size) - { - unsigned int ecx, edx, edi; - - ecx = context.vm.regs.ecx & 0xffff; - edx = context.vm.regs.edx & 0xffff; - edi = context.vm.regs.edi & 0xffff; - edi += (unsigned int)context.vm.regs.ds << 4; - - if (context.vm.regs.eflags & DIRECTION_FLAG) - { - if (size == 4) - asm volatile ("std; rep; insl; cld" - : "=D" (edi), "=c" (ecx) - : "d" (edx), "0" (edi), "1" (ecx)); - else if (size == 2) - asm volatile ("std; rep; insw; cld" - : "=D" (edi), "=c" (ecx) - : "d" (edx), "0" (edi), "1" (ecx)); - else - asm volatile ("std; rep; insb; cld" - : "=D" (edi), "=c" (ecx) - : "d" (edx), "0" (edi), "1" (ecx)); - } - else - { - if (size == 4) - asm volatile ("cld; rep; insl" - : "=D" (edi), "=c" (ecx) - : "d" (edx), "0" (edi), "1" (ecx)); - else if (size == 2) - asm volatile ("cld; rep; insw" - : "=D" (edi), "=c" (ecx) - : "d" (edx), "0" (edi), "1" (ecx)); - else - asm volatile ("cld; rep; insb" - : "=D" (edi), "=c" (ecx) - : "d" (edx), "0" (edi), "1" (ecx)); - } - - edi -= (unsigned int)context.vm.regs.ds << 4; - - context.vm.regs.edi &= 0xffff0000; - context.vm.regs.edi |= edi & 0xffff; - - context.vm.regs.ecx &= 0xffff0000; - context.vm.regs.ecx |= ecx & 0xffff; - } - -static void -em_outs(int size) - { - unsigned int edx, esi; - - edx = context.vm.regs.edx & 0xffff; - esi = context.vm.regs.esi & 0xffff; - esi += (unsigned int)context.vm.regs.ds << 4; - - if (context.vm.regs.eflags & DIRECTION_FLAG) - { - if (size == 4) - asm volatile ("std; outsl; cld" - : "=S" (esi) : "d" (edx), "0" (esi)); - else if (size == 2) - asm volatile ("std; outsw; cld" - : "=S" (esi) : "d" (edx), "0" (esi)); - else - asm volatile ("std; outsb; cld" - : "=S" (esi) : "d" (edx), "0" (esi)); - } - else - { - if (size == 4) - asm volatile ("cld; outsl" - : "=S" (esi) : "d" (edx), "0" (esi)); - else if (size == 2) - asm volatile ("cld; outsw" - : "=S" (esi) : "d" (edx), "0" (esi)); - else - asm volatile ("cld; outsb" - : "=S" (esi) : "d" (edx), "0" (esi)); - } - - esi -= (unsigned int)context.vm.regs.ds << 4; - - context.vm.regs.esi &= 0xffff0000; - context.vm.regs.esi |= esi & 0xffff; - } - -static void -em_rep_outs(int size) - { - unsigned int ecx, edx, esi; - - ecx = context.vm.regs.ecx & 0xffff; - edx = context.vm.regs.edx & 0xffff; - esi = context.vm.regs.esi & 0xffff; - esi += (unsigned int)context.vm.regs.ds << 4; - - if (context.vm.regs.eflags & DIRECTION_FLAG) - { - if (size == 4) - asm volatile ("std; rep; outsl; cld" - : "=S" (esi), "=c" (ecx) - : "d" (edx), "0" (esi), "1" (ecx)); - else if (size == 2) - asm volatile ("std; rep; outsw; cld" - : "=S" (esi), "=c" (ecx) - : "d" (edx), "0" (esi), "1" (ecx)); - else - asm volatile ("std; rep; outsb; cld" - : "=S" (esi), "=c" (ecx) - : "d" (edx), "0" (esi), "1" (ecx)); - } - else - { - if (size == 4) - asm volatile ("cld; rep; outsl" - : "=S" (esi), "=c" (ecx) - : "d" (edx), "0" (esi), "1" (ecx)); - else if (size == 2) - asm volatile ("cld; rep; outsw" - : "=S" (esi), "=c" (ecx) - : "d" (edx), "0" (esi), "1" (ecx)); - else - asm volatile ("cld; rep; outsb" - : "=S" (esi), "=c" (ecx) - : "d" (edx), "0" (esi), "1" (ecx)); - } - - esi -= (unsigned int)context.vm.regs.ds << 4; - - context.vm.regs.esi &= 0xffff0000; - context.vm.regs.esi |= esi & 0xffff; - - context.vm.regs.ecx &= 0xffff0000; - context.vm.regs.ecx |= ecx & 0xffff; - } - -static void -em_inbl(unsigned char literal) - { - context.vm.regs.eax = inb(literal) & 0xff; - } - -static void -em_inb(void) - { - asm volatile ("inb (%w1), %b0" - : "=a" (context.vm.regs.eax) - : "d" (context.vm.regs.edx), "0" (context.vm.regs.eax)); - } - -static void -em_inw(void) - { - asm volatile ("inw (%w1), %w0" - : "=a" (context.vm.regs.eax) - : "d" (context.vm.regs.edx), "0" (context.vm.regs.eax)); - } - -static void -em_inl(void) - { - asm volatile ("inl (%w1), %0" - : "=a" (context.vm.regs.eax) - : "d" (context.vm.regs.edx)); - } - -static void -em_outbl(unsigned char literal) - { - outb(context.vm.regs.eax & 0xff, literal); - } - -static void -em_outb(void) - { - asm volatile ("outb %b0, (%w1)" - : : "a" (context.vm.regs.eax), - "d" (context.vm.regs.edx)); - } - -static void -em_outw(void) - { - asm volatile ("outw %w0, (%w1)" - : : "a" (context.vm.regs.eax), - "d" (context.vm.regs.edx)); - } - -static void -em_outl(void) - { - asm volatile ("outl %0, (%w1)" - : : "a" (context.vm.regs.eax), - "d" (context.vm.regs.edx)); - } - -static int -emulate(void) - { - unsigned char *insn; - struct - { - unsigned int size : 1; - unsigned int rep : 1; - } prefix = { 0, 0 }; - int i = 0; - - insn = (unsigned char *)((unsigned int)context.vm.regs.cs << 4); - insn += context.vm.regs.eip; - - while (1) - { - if (insn[i] == 0x66) - { - prefix.size = 1 - prefix.size; - i++; - } - else if (insn[i] == 0xf3) - { - prefix.rep = 1; - i++; - } - else if (insn[i] == 0xf0 || insn[i] == 0xf2 - || insn[i] == 0x26 || insn[i] == 0x2e - || insn[i] == 0x36 || insn[i] == 0x3e - || insn[i] == 0x64 || insn[i] == 0x65 - || insn[i] == 0x67) - { - /* these prefixes are just ignored */ - i++; - } - else if (insn[i] == 0x6c) - { - if (prefix.rep) - em_rep_ins(1); - else - em_ins(1); - i++; - break; - } - else if (insn[i] == 0x6d) - { - if (prefix.rep) - { - if (prefix.size) - em_rep_ins(4); - else - em_rep_ins(2); - } - else - { - if (prefix.size) - em_ins(4); - else - em_ins(2); - } - i++; - break; - } - else if (insn[i] == 0x6e) - { - if (prefix.rep) - em_rep_outs(1); - else - em_outs(1); - i++; - break; - } - else if (insn[i] == 0x6f) - { - if (prefix.rep) - { - if (prefix.size) - em_rep_outs(4); - else - em_rep_outs(2); - } - else - { - if (prefix.size) - em_outs(4); - else - em_outs(2); - } - i++; - break; - } - else if (insn[i] == 0xe4) - { - em_inbl(insn[i + 1]); - i += 2; - break; - } - else if (insn[i] == 0xe6) - { - em_outbl(insn[i + 1]); - i += 2; - break; - } - else if (insn[i] == 0xec) - { - em_inb(); - i++; - break; - } - else if (insn[i] == 0xed) - { - if (prefix.size) - em_inl(); - else - em_inw(); - i++; - break; - } - else if (insn[i] == 0xee) - { - em_outb(); - i++; - break; - } - else if (insn[i] == 0xef) - { - if (prefix.size) - em_outl(); - else - em_outw(); - - i++; - break; - } - else - return 0; - } - - context.vm.regs.eip += i; - return 1; - } - - -/* - I don't know how to make sure I get the right vm86() from libc. - The one I want is syscall # 113 (vm86old() in libc 5, vm86() in glibc) - which should be declared as "int vm86(struct vm86_struct *);" in - <sys/vm86.h>. - - This just does syscall 113 with inline asm, which should work - for both libc's (I hope). -*/ -#if !defined(USE_LIBC_VM86) -static int -lrmi_vm86(struct vm86_struct *vm) - { - int r; -#if 1 - asm volatile ( - "pushl %%ebx\n\t" - "movl %2, %%ebx\n\t" - "int $0x80\n\t" - "popl %%ebx" - : "=a" (r) - : "0" (113), "r" (vm)); -#else - asm volatile ( - "int $0x80" - : "=a" (r) - : "0" (113), "b" (vm)); -#endif - return r; - } -#else -#define lrmi_vm86 vm86 -#endif - - -static void -debug_info(int vret) - { - int i; - unsigned char *p; - - fputs("vm86() failed\n", stderr); - fprintf(stderr, "return = 0x%x\n", vret); - fprintf(stderr, "eax = 0x%08lx\n", context.vm.regs.eax); - fprintf(stderr, "ebx = 0x%08lx\n", context.vm.regs.ebx); - fprintf(stderr, "ecx = 0x%08lx\n", context.vm.regs.ecx); - fprintf(stderr, "edx = 0x%08lx\n", context.vm.regs.edx); - fprintf(stderr, "esi = 0x%08lx\n", context.vm.regs.esi); - fprintf(stderr, "edi = 0x%08lx\n", context.vm.regs.edi); - fprintf(stderr, "ebp = 0x%08lx\n", context.vm.regs.ebp); - fprintf(stderr, "eip = 0x%08lx\n", context.vm.regs.eip); - fprintf(stderr, "cs = 0x%04x\n", context.vm.regs.cs); - fprintf(stderr, "esp = 0x%08lx\n", context.vm.regs.esp); - fprintf(stderr, "ss = 0x%04x\n", context.vm.regs.ss); - fprintf(stderr, "ds = 0x%04x\n", context.vm.regs.ds); - fprintf(stderr, "es = 0x%04x\n", context.vm.regs.es); - fprintf(stderr, "fs = 0x%04x\n", context.vm.regs.fs); - fprintf(stderr, "gs = 0x%04x\n", context.vm.regs.gs); - fprintf(stderr, "eflags = 0x%08lx\n", context.vm.regs.eflags); - - fputs("cs:ip = [ ", stderr); - - p = (unsigned char *)((context.vm.regs.cs << 4) + (context.vm.regs.eip & 0xffff)); - - for (i = 0; i < 16; ++i) - fprintf(stderr, "%02x ", (unsigned int)p[i]); - - fputs("]\n", stderr); - } - - -static int -run_vm86(void) - { - unsigned int vret; - - while (1) - { - vret = lrmi_vm86(&context.vm); - - if (VM86_TYPE(vret) == VM86_INTx) - { - unsigned int v = VM86_ARG(vret); - - if (v == RETURN_TO_32_INT) - return 1; - - pushw(context.vm.regs.eflags); - pushw(context.vm.regs.cs); - pushw(context.vm.regs.eip); - - context.vm.regs.cs = get_int_seg(v); - context.vm.regs.eip = get_int_off(v); - context.vm.regs.eflags &= ~(VIF_MASK | TF_MASK); - - continue; - } - - if (VM86_TYPE(vret) != VM86_UNKNOWN) - break; - - if (!emulate()) - break; - } - -#ifdef ORIGINAL_LRMI_CODE_THAT_GOT_IFDEFED_OUT - debug_info(vret); -#endif - return 0; - } - - -int -LRMI_call(struct LRMI_regs *r) - { - unsigned int vret; - - memset(&context.vm.regs, 0, sizeof(context.vm.regs)); - - set_regs(r); - - context.vm.regs.cs = r->cs; - context.vm.regs.eip = r->ip; - - if (r->ss == 0 && r->sp == 0) - { - context.vm.regs.ss = context.stack_seg; - context.vm.regs.esp = context.stack_off; - } - else - { - context.vm.regs.ss = r->ss; - context.vm.regs.esp = r->sp; - } - - pushw(context.ret_seg); - pushw(context.ret_off); - - vret = run_vm86(); - - get_regs(r); - - return vret; - } - - -int -LRMI_int(int i, struct LRMI_regs *r) - { - unsigned int vret; - unsigned int seg, off; - - seg = get_int_seg(i); - off = get_int_off(i); - - /* - If the interrupt is in regular memory, it's probably - still pointing at a dos TSR (which is now gone). - */ - if (seg < 0xa000 || (seg << 4) + off >= 0x100000) - { -#ifdef ORIGINAL_LRMI_CODE_THAT_GOT_IFDEFED_OUT - fprintf(stderr, "Int 0x%x is not in rom (%04x:%04x)\n", i, seg, off); -#endif - return 0; - } - - memset(&context.vm.regs, 0, sizeof(context.vm.regs)); - - set_regs(r); - - context.vm.regs.cs = seg; - context.vm.regs.eip = off; - - if (r->ss == 0 && r->sp == 0) - { - context.vm.regs.ss = context.stack_seg; - context.vm.regs.esp = context.stack_off; - } - else - { - context.vm.regs.ss = r->ss; - context.vm.regs.esp = r->sp; - } - - pushw(DEFAULT_VM86_FLAGS); - pushw(context.ret_seg); - pushw(context.ret_off); - - vret = run_vm86(); - - get_regs(r); - - return vret; - } - diff --git a/tools/ddcprobe/lrmi.h b/tools/ddcprobe/lrmi.h deleted file mode 100644 index c9c186365..000000000 --- a/tools/ddcprobe/lrmi.h +++ /dev/null @@ -1,85 +0,0 @@ -/* -Linux Real Mode Interface - A library of DPMI-like functions for Linux. - -Copyright (C) 1998 by Josh Vanderhoof - -You are free to distribute and modify this file, as long as you -do not remove this copyright notice and clearly label modified -versions as being modified. - -This software has NO WARRANTY. Use it at your own risk. -*/ - -#ifndef LRMI_H -#define LRMI_H - -struct LRMI_regs - { - unsigned int edi; - unsigned int esi; - unsigned int ebp; - unsigned int reserved; - unsigned int ebx; - unsigned int edx; - unsigned int ecx; - unsigned int eax; - unsigned short int flags; - unsigned short int es; - unsigned short int ds; - unsigned short int fs; - unsigned short int gs; - unsigned short int ip; - unsigned short int cs; - unsigned short int sp; - unsigned short int ss; - }; - - -#ifndef LRMI_PREFIX -#define LRMI_PREFIX LRMI_ -#endif - -#define LRMI_CONCAT2(a, b) a ## b -#define LRMI_CONCAT(a, b) LRMI_CONCAT2(a, b) -#define LRMI_MAKENAME(a) LRMI_CONCAT(LRMI_PREFIX, a) - -/* - Initialize - returns 1 if sucessful, 0 for failure -*/ -#define LRMI_init LRMI_MAKENAME(init) -int -LRMI_init(void); - -/* - Simulate a 16 bit far call - returns 1 if sucessful, 0 for failure -*/ -#define LRMI_call LRMI_MAKENAME(call) -int -LRMI_call(struct LRMI_regs *r); - -/* - Simulate a 16 bit interrupt - returns 1 if sucessful, 0 for failure -*/ -#define LRMI_int LRMI_MAKENAME(int) -int -LRMI_int(int interrupt, struct LRMI_regs *r); - -/* - Allocate real mode memory - The returned block is paragraph (16 byte) aligned -*/ -#define LRMI_alloc_real LRMI_MAKENAME(alloc_real) -void * -LRMI_alloc_real(int size); - -/* - Free real mode memory -*/ -#define LRMI_free_real LRMI_MAKENAME(free_real) -void -LRMI_free_real(void *m); - -#endif diff --git a/tools/ddcprobe/not_handled.c b/tools/ddcprobe/not_handled.c deleted file mode 100644 index 40cbb5427..000000000 --- a/tools/ddcprobe/not_handled.c +++ /dev/null @@ -1 +0,0 @@ -int main() { return 1; } diff --git a/tools/ddcprobe/vbe.c b/tools/ddcprobe/vbe.c deleted file mode 100644 index a67e56d0b..000000000 --- a/tools/ddcprobe/vbe.c +++ /dev/null @@ -1,709 +0,0 @@ -#include <sys/types.h> -#include <sys/io.h> -#include <sys/mman.h> -#include <netinet/in.h> -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <assert.h> -#include <limits.h> -#include <ctype.h> -#include "lrmi.h" -#include "vesamode.h" -#include "vbe.h" -#ident "$Id$" - -/* Return information about a particular video mode. */ -struct vbe_mode_info *vbe_get_mode_info(u_int16_t mode) -{ - struct LRMI_regs regs; - char *mem; - struct vbe_mode_info *ret = NULL; - - /* Initialize LRMI. */ - if(LRMI_init() == 0) { - return NULL; - } - - /* Allocate a chunk of memory. */ - mem = LRMI_alloc_real(sizeof(struct vbe_mode_info)); - if(mem == NULL) { - return NULL; - } - memset(mem, 0, sizeof(struct vbe_mode_info)); - - memset(®s, 0, sizeof(regs)); - regs.eax = 0x4f01; - regs.ecx = mode; - regs.es = ((u_int32_t)mem) >> 4; - regs.edi = ((u_int32_t)mem) & 0x0f; - - /* Do it. */ - iopl(3); - ioperm(0, 0x400, 1); - - if(LRMI_int(0x10, ®s) == 0) { - LRMI_free_real(mem); - return NULL; - } - - /* Check for successful return. */ - if((regs.eax & 0xffff) != 0x004f) { - LRMI_free_real(mem); - return NULL; - } - - /* Get memory for return. */ - ret = malloc(sizeof(struct vbe_mode_info)); - if(ret == NULL) { - LRMI_free_real(mem); - return NULL; - } - - /* Copy the buffer for return. */ - memcpy(ret, mem, sizeof(struct vbe_mode_info)); - - /* Clean up and return. */ - LRMI_free_real(mem); - return ret; -} - -/* Get VBE info. */ -struct vbe_info *vbe_get_vbe_info() -{ - struct LRMI_regs regs; - unsigned char *mem; - struct vbe_info *ret = NULL; - int i; - - /* Initialize LRMI. */ - if(LRMI_init() == 0) { - return NULL; - } - - /* Allocate a chunk of memory. */ - mem = LRMI_alloc_real(sizeof(struct vbe_mode_info)); - if(mem == NULL) { - return NULL; - } - memset(mem, 0, sizeof(struct vbe_mode_info)); - - /* Set up registers for the interrupt call. */ - memset(®s, 0, sizeof(regs)); - regs.eax = 0x4f00; - regs.es = ((u_int32_t)mem) >> 4; - regs.edi = ((u_int32_t)mem) & 0x0f; - memcpy(mem, "VBE2", 4); - - /* Do it. */ - iopl(3); - ioperm(0, 0x400, 1); - - if(LRMI_int(0x10, ®s) == 0) { - LRMI_free_real(mem); - return NULL; - } - - /* Check for successful return code. */ - if((regs.eax & 0xffff) != 0x004f) { - LRMI_free_real(mem); - return NULL; - } - - /* Get memory to return the information. */ - ret = malloc(sizeof(struct vbe_info)); - if(ret == NULL) { - LRMI_free_real(mem); - return NULL; - } - memcpy(ret, mem, sizeof(struct vbe_info)); - - /* Set up pointers to usable memory. */ - ret->mode_list.list = (u_int16_t*) ((ret->mode_list.addr.seg << 4) + - (ret->mode_list.addr.ofs)); - ret->oem_name.string = (char*) ((ret->oem_name.addr.seg << 4) + - (ret->oem_name.addr.ofs)); - - /* Snip, snip. */ - mem = strdup(ret->oem_name.string); /* leak */ - while(((i = strlen(mem)) > 0) && isspace(mem[i - 1])) { - mem[i - 1] = '\0'; - } - ret->oem_name.string = mem; - - /* Set up pointers for VESA 3.0+ strings. */ - if(ret->version[1] >= 3) { - - /* Vendor name. */ - ret->vendor_name.string = (char*) - ((ret->vendor_name.addr.seg << 4) - + (ret->vendor_name.addr.ofs)); - - mem = strdup(ret->vendor_name.string); /* leak */ - while(((i = strlen(mem)) > 0) && isspace(mem[i - 1])) { - mem[i - 1] = '\0'; - } - ret->vendor_name.string = mem; - - /* Product name. */ - ret->product_name.string = (char*) - ((ret->product_name.addr.seg << 4) - + (ret->product_name.addr.ofs)); - - mem = strdup(ret->product_name.string); /* leak */ - while(((i = strlen(mem)) > 0) && isspace(mem[i - 1])) { - mem[i - 1] = '\0'; - } - ret->product_name.string = mem; - - /* Product revision. */ - ret->product_revision.string = (char*) - ((ret->product_revision.addr.seg << 4) - + (ret->product_revision.addr.ofs)); - - mem = strdup(ret->product_revision.string); /* leak */ - while(((i = strlen(mem)) > 0) && isspace(mem[i - 1])) { - mem[i - 1] = '\0'; - } - ret->product_revision.string = mem; - } - - /* Cleanup. */ - LRMI_free_real(mem); - return ret; -} - -/* Check if EDID queries are suorted. */ -int vbe_get_edid_supported() -{ - struct LRMI_regs regs; - int ret = 0; - - /* Initialize LRMI. */ - if(LRMI_init() == 0) { - return 0; - } - - memset(®s, 0, sizeof(regs)); - regs.eax = 0x4f15; - regs.ebx = 0x0000; - regs.es = 0x3000; - regs.edi = 0x3000; - - /* Do it. */ - iopl(3); - ioperm(0, 0x400, 1); - - if(LRMI_int(0x10, ®s) == 0) { - return 0; - } - - /* Check for successful return. */ - if((regs.eax & 0xff) == 0x4f) { - /* Supported. */ - ret = 1; - } else { - /* Not supported. */ - ret = 0; - } - - /* Clean up and return. */ - return ret; -} - -/* Get EDID info. */ -struct vbe_edid1_info *vbe_get_edid_info() -{ - struct LRMI_regs regs; - unsigned char *mem; - struct vbe_edid1_info *ret = NULL; - u_int16_t man; - - /* Initialize LRMI. */ - if(LRMI_init() == 0) { - return NULL; - } - - /* Allocate a chunk of memory. */ - mem = LRMI_alloc_real(sizeof(struct vbe_edid1_info)); - if(mem == NULL) { - return NULL; - } - memset(mem, 0, sizeof(struct vbe_edid1_info)); - - memset(®s, 0, sizeof(regs)); - regs.eax = 0x4f15; - regs.ebx = 0x0001; - regs.es = ((u_int32_t)mem) >> 4; - regs.edi = ((u_int32_t)mem) & 0x0f; - - /* Do it. */ - iopl(3); - ioperm(0, 0x400, 1); - - if(LRMI_int(0x10, ®s) == 0) { - LRMI_free_real(mem); - return NULL; - } - -#if 0 - /* Check for successful return. */ - if((regs.eax & 0xffff) != 0x004f) { - LRMI_free_real(mem); - return NULL; - } -#elseif - /* Check for successful return. */ - if((regs.eax & 0xff) != 0x4f) { - LRMI_free_real(mem); - return NULL; - } -#endif - - /* Get memory for return. */ - ret = malloc(sizeof(struct vbe_edid1_info)); - if(ret == NULL) { - LRMI_free_real(mem); - return NULL; - } - - /* Copy the buffer for return. */ - memcpy(ret, mem, sizeof(struct vbe_edid1_info)); - - memcpy(&man, &ret->manufacturer_name, 2); - man = ntohs(man); - memcpy(&ret->manufacturer_name, &man, 2); - - LRMI_free_real(mem); - return ret; -} - -/* Figure out what the current video mode is. */ -int32_t vbe_get_mode() -{ - struct LRMI_regs regs; - int32_t ret = -1; - - /* Initialize LRMI. */ - if(LRMI_init() == 0) { - return -1; - } - - memset(®s, 0, sizeof(regs)); - regs.eax = 0x4f03; - - /* Do it. */ - iopl(3); - ioperm(0, 0x400, 1); - - if(LRMI_int(0x10, ®s) == 0) { - return -1; - } - - /* Save the returned value. */ - if((regs.eax & 0xffff) == 0x004f) { - ret = regs.ebx & 0xffff; - } else { - ret = -1; - } - - /* Clean up and return. */ - return ret; -} - -/* Set the video mode. */ -void vbe_set_mode(u_int16_t mode) -{ - struct LRMI_regs regs; - - /* Initialize LRMI. */ - if(LRMI_init() == 0) { - return; - } - - memset(®s, 0, sizeof(regs)); - regs.eax = 0x4f02; - regs.ebx = mode; - - /* Do it. */ - iopl(3); - ioperm(0, 0x400, 1); - LRMI_int(0x10, ®s); - - /* Return. */ - return; -} - -/* Just read ranges from the EDID. */ -void vbe_get_edid_ranges(struct vbe_edid1_info *edid, - unsigned char *hmin, unsigned char *hmax, - unsigned char *vmin, unsigned char *vmax) -{ - struct vbe_edid_monitor_descriptor *monitor; - int i; - - *hmin = *hmax = *vmin = *vmax = 0; - - for(i = 0; i < 4; i++) { - monitor = &edid->monitor_details.monitor_descriptor[i]; - if(monitor->type == vbe_edid_monitor_descriptor_range) { - *hmin = monitor->data.range_data.horizontal_min; - *hmax = monitor->data.range_data.horizontal_max; - *vmin = monitor->data.range_data.vertical_min; - *vmax = monitor->data.range_data.vertical_max; - } - } -} - -static int compare_vbe_modelines(const void *m1, const void *m2) -{ - const struct vbe_modeline *M1 = (const struct vbe_modeline*) m1; - const struct vbe_modeline *M2 = (const struct vbe_modeline*) m2; - if(M1->width < M2->width) return -1; - if(M1->width > M2->width) return 1; - return 0; -} - -struct vbe_modeline *vbe_get_edid_modelines() -{ - struct vbe_edid1_info *edid; - struct vbe_modeline *ret; - char buf[LINE_MAX]; - int modeline_count = 0, i, j; - - if((edid = vbe_get_edid_info()) == NULL) { - return NULL; - } - - memcpy(buf, &edid->established_timings, - sizeof(edid->established_timings)); - for(i = 0; i < (8 * sizeof(edid->established_timings)); i++) { - if(buf[i / 8] & (1 << (i % 8))) { - modeline_count++; - } - } - - /* Count the number of standard timings. */ - for(i = 0; i < 8; i++) { - int x, v; - x = edid->standard_timing[i].xresolution; - v = edid->standard_timing[i].vfreq; - if(((edid->standard_timing[i].xresolution & 0x01) != x) && - ((edid->standard_timing[i].vfreq & 0x01) != v)) { - modeline_count++; - } - } - - ret = malloc(sizeof(struct vbe_modeline) * (modeline_count + 1)); - if(ret == NULL) { - return NULL; - } - memset(ret, 0, sizeof(struct vbe_modeline) * (modeline_count + 1)); - - modeline_count = 0; - - /* Fill out established timings. */ - if(edid->established_timings.timing_720x400_70) { - ret[modeline_count].width = 720; - ret[modeline_count].height = 400; - ret[modeline_count].refresh = 70; - modeline_count++; - } - if(edid->established_timings.timing_720x400_88) { - ret[modeline_count].width = 720; - ret[modeline_count].height = 400; - ret[modeline_count].refresh = 88; - modeline_count++; - } - if(edid->established_timings.timing_640x480_60) { - ret[modeline_count].width = 640; - ret[modeline_count].height = 480; - ret[modeline_count].refresh = 60; - modeline_count++; - } - if(edid->established_timings.timing_640x480_67) { - ret[modeline_count].width = 640; - ret[modeline_count].height = 480; - ret[modeline_count].refresh = 67; - modeline_count++; - } - if(edid->established_timings.timing_640x480_72) { - ret[modeline_count].width = 640; - ret[modeline_count].height = 480; - ret[modeline_count].refresh = 72; - modeline_count++; - } - if(edid->established_timings.timing_640x480_75) { - ret[modeline_count].width = 640; - ret[modeline_count].height = 480; - ret[modeline_count].refresh = 75; - modeline_count++; - } - if(edid->established_timings.timing_800x600_56) { - ret[modeline_count].width = 800; - ret[modeline_count].height = 600; - ret[modeline_count].refresh = 56; - modeline_count++; - } - if(edid->established_timings.timing_800x600_60) { - ret[modeline_count].width = 800; - ret[modeline_count].height = 600; - ret[modeline_count].refresh = 60; - modeline_count++; - } - if(edid->established_timings.timing_800x600_72) { - ret[modeline_count].width = 800; - ret[modeline_count].height = 600; - ret[modeline_count].refresh = 72; - modeline_count++; - } - if(edid->established_timings.timing_800x600_75) { - ret[modeline_count].width = 800; - ret[modeline_count].height = 600; - ret[modeline_count].refresh = 75; - modeline_count++; - } - if(edid->established_timings.timing_832x624_75) { - ret[modeline_count].width = 832; - ret[modeline_count].height = 624; - ret[modeline_count].refresh = 75; - modeline_count++; - } - if(edid->established_timings.timing_1024x768_87i) { - ret[modeline_count].width = 1024; - ret[modeline_count].height = 768; - ret[modeline_count].refresh = 87; - ret[modeline_count].interlaced = 1; - modeline_count++; - } - if(edid->established_timings.timing_1024x768_60){ - ret[modeline_count].width = 1024; - ret[modeline_count].height = 768; - ret[modeline_count].refresh = 60; - modeline_count++; - } - if(edid->established_timings.timing_1024x768_70){ - ret[modeline_count].width = 1024; - ret[modeline_count].height = 768; - ret[modeline_count].refresh = 70; - modeline_count++; - } - if(edid->established_timings.timing_1024x768_75){ - ret[modeline_count].width = 1024; - ret[modeline_count].height = 768; - ret[modeline_count].refresh = 75; - modeline_count++; - } - if(edid->established_timings.timing_1280x1024_75) { - ret[modeline_count].width = 1280; - ret[modeline_count].height = 1024; - ret[modeline_count].refresh = 75; - modeline_count++; - } - - /* Add in standard timings. */ - for(i = 0; i < 8; i++) { - float aspect = 1; - int x, v; - x = edid->standard_timing[i].xresolution; - v = edid->standard_timing[i].vfreq; - if(((edid->standard_timing[i].xresolution & 0x01) != x) && - ((edid->standard_timing[i].vfreq & 0x01) != v)) { - switch(edid->standard_timing[i].aspect) { - case aspect_75: aspect = 0.7500; break; - case aspect_8: aspect = 0.8000; break; - case aspect_5625: aspect = 0.5625; break; - default: aspect = 1; break; - } - x = (edid->standard_timing[i].xresolution + 31) * 8; - ret[modeline_count].width = x; - ret[modeline_count].height = x * aspect; - ret[modeline_count].refresh = - edid->standard_timing[i].vfreq + 60; - modeline_count++; - } - } - - /* Now tack on any matching modelines. */ - for(i = 0; ret[i].refresh != 0; i++) { - struct vesa_timing_t *t = NULL; - for(j = 0; known_vesa_timings[j].refresh != 0; j++) { - t = &known_vesa_timings[j]; - if(ret[i].width == t->x) - if(ret[i].height == t->y) - if(ret[i].refresh == t->refresh) { - snprintf(buf, sizeof(buf), - "ModeLine \"%dx%d\"\t%6.2f " - "%4d %4d %4d %4d %4d %4d %4d %4d %s %s" - , t->x, t->y, t->dotclock, - t->timings[0], - t->timings[0] + t->timings[1], - t->timings[0] + t->timings[1] + - t->timings[2], - t->timings[0] + t->timings[1] + - t->timings[2] + t->timings[3], - t->timings[4], - t->timings[4] + t->timings[5], - t->timings[4] + t->timings[5] + - t->timings[6], - t->timings[4] + t->timings[5] + - t->timings[6] + t->timings[7], - t->hsync == hsync_pos ? - "+hsync" : "-hsync", - t->vsync == vsync_pos ? - "+vsync" : "-vsync"); - ret[i].modeline = strdup(buf); - ret[i].hfreq = t->hfreq; - ret[i].vfreq = t->vfreq; - } - } - } - - modeline_count = 0; - for(i = 0; ret[i].refresh != 0; i++) { - modeline_count++; - } - qsort(ret, modeline_count, sizeof(ret[0]), compare_vbe_modelines); - - return ret; -} - -const void *vbe_save_svga_state() -{ - struct LRMI_regs regs; - unsigned char *mem; - u_int16_t block_size; - void *data; - - /* Initialize LRMI. */ - if(LRMI_init() == 0) { - return NULL; - } - - memset(®s, 0, sizeof(regs)); - regs.eax = 0x4f04; - regs.ecx = 0xffff; - regs.edx = 0; - - iopl(3); - ioperm(0, 0x400, 1); - - if(LRMI_int(0x10, ®s) == 0) { - return NULL; - } - - if((regs.eax & 0xff) != 0x4f) { - fprintf(stderr, "Get SuperVGA Video State not supported.\n"); - return NULL; - } - - if((regs.eax & 0xffff) != 0x004f) { - fprintf(stderr, "Get SuperVGA Video State Info failed.\n"); - return NULL; - } - - block_size = 64 * (regs.ebx & 0xffff); - - /* Allocate a chunk of memory. */ - mem = LRMI_alloc_real(block_size); - if(mem == NULL) { - return NULL; - } - memset(mem, 0, sizeof(block_size)); - - memset(®s, 0, sizeof(regs)); - regs.eax = 0x4f04; - regs.ecx = 0x000f; - regs.edx = 0x0001; - regs.es = ((u_int32_t)mem) >> 4; - regs.ebx = ((u_int32_t)mem) & 0x0f; - memset(mem, 0, block_size); - iopl(3); - ioperm(0, 0x400, 1); - - if(LRMI_int(0x10, ®s) == 0) { - LRMI_free_real(mem); - return NULL; - } - - if((regs.eax & 0xffff) != 0x004f) { - fprintf(stderr, "Get SuperVGA Video State Save failed.\n"); - return NULL; - } - - data = malloc(block_size); - if(data == NULL) { - LRMI_free_real(mem); - return NULL; - } - - /* Clean up and return. */ - memcpy(data, mem, block_size); - LRMI_free_real(mem); - return data; -} - -void vbe_restore_svga_state(const void *state) -{ - struct LRMI_regs regs; - unsigned char *mem; - u_int16_t block_size; - - /* Initialize LRMI. */ - if(LRMI_init() == 0) { - return; - } - - memset(®s, 0, sizeof(regs)); - regs.eax = 0x4f04; - regs.ecx = 0x000f; - regs.edx = 0; - - /* Find out how much memory we need. */ - iopl(3); - ioperm(0, 0x400, 1); - - if(LRMI_int(0x10, ®s) == 0) { - return; - } - - if((regs.eax & 0xff) != 0x4f) { - fprintf(stderr, "Get SuperVGA Video State not supported.\n"); - return; - } - - if((regs.eax & 0xffff) != 0x004f) { - fprintf(stderr, "Get SuperVGA Video State Info failed.\n"); - return; - } - - block_size = 64 * (regs.ebx & 0xffff); - - /* Allocate a chunk of memory. */ - mem = LRMI_alloc_real(block_size); - if(mem == NULL) { - return; - } - memset(mem, 0, sizeof(block_size)); - - memset(®s, 0, sizeof(regs)); - regs.eax = 0x4f04; - regs.ecx = 0x000f; - regs.edx = 0x0002; - regs.es = 0x2000; - regs.ebx = 0x0000; - memcpy(mem, state, block_size); - - iopl(3); - ioperm(0, 0x400, 1); - - if(LRMI_int(0x10, ®s) == 0) { - LRMI_free_real(mem); - return; - } - - if((regs.eax & 0xffff) != 0x004f) { - fprintf(stderr, "Get SuperVGA Video State Restore failed.\n"); - return; - } -} diff --git a/tools/ddcprobe/vbe.h b/tools/ddcprobe/vbe.h deleted file mode 100644 index 338d3bd88..000000000 --- a/tools/ddcprobe/vbe.h +++ /dev/null @@ -1,312 +0,0 @@ -#ifndef vbe_h -#define vbe_h -#ident "$Id$" -#include <sys/types.h> - -/* Record returned by int 0x10, function 0x4f, subfunction 0x00. */ -struct vbe_info { - unsigned char signature[4]; - unsigned char version[2]; - union { - struct { - u_int16_t ofs; - u_int16_t seg; - } addr; - const char *string; - } oem_name; - u_int32_t capabilities; - union { - struct { - u_int16_t ofs; - u_int16_t seg; - } addr; - u_int16_t *list; - } mode_list; - u_int16_t memory_size; - /* VESA 3.0+ */ - u_int16_t vbe_revision; - union { - struct { - u_int16_t ofs; - u_int16_t seg; - } addr; - const char *string; - } vendor_name; - union { - struct { - u_int16_t ofs; - u_int16_t seg; - } addr; - const char *string; - } product_name; - union { - struct { - u_int16_t ofs; - u_int16_t seg; - } addr; - const char *string; - } product_revision; - char reserved1[222]; - char reserved2[256]; -} __attribute__ ((packed)); - -/* Stuff returned by int 0x10, function 0x4f, subfunction 0x01. */ -struct vbe_mode_info { - /* required for all VESA versions */ - struct { - /* VBE 1.0+ */ - u_int16_t supported: 1; - u_int16_t optional_info_available: 1; - u_int16_t bios_output_supported: 1; - u_int16_t color: 1; - u_int16_t graphics: 1; - /* VBE 2.0+ */ - u_int16_t not_vga_compatible: 1; - u_int16_t not_bank_switched: 1; - u_int16_t lfb: 1; - /* VBE 1.0+ */ - u_int16_t unknown: 1; - u_int16_t must_enable_directaccess_in_10: 1; - } mode_attributes; - struct { - unsigned char exists: 1; - unsigned char readable: 1; - unsigned char writeable: 1; - unsigned char reserved: 5; - } windowa_attributes, windowb_attributes; - u_int16_t window_granularity; - u_int16_t window_size; - u_int16_t windowa_start_segment, windowb_start_segment; - u_int16_t window_positioning_seg, window_positioning_ofs; - u_int16_t bytes_per_scanline; - /* optional for VESA 1.0/1.1, required for OEM modes */ - u_int16_t w, h; - unsigned char cell_width, cell_height; - unsigned char memory_planes; - unsigned char bpp; - unsigned char banks; - enum { - memory_model_text = 0, - memory_model_cga = 1, - memory_model_hgc = 2, - memory_model_ega16 = 3, - memory_model_packed_pixel = 4, - memory_model_sequ256 = 5, - memory_model_direct_color = 6, - memory_model_yuv = 7, - } memory_model: 8; - unsigned char bank_size; - unsigned char image_pages; - unsigned char reserved1; - /* required for VESA 1.2+ */ - unsigned char red_mask, red_field; - unsigned char green_mask, green_field; - unsigned char blue_mask, blue_field; - unsigned char reserved_mask, reserved_field; - unsigned char direct_color_mode_info; - /* VESA 2.0+ */ - u_int32_t linear_buffer_address; - u_int32_t offscreen_memory_address; - u_int16_t offscreen_memory_size; - unsigned char reserved2[206]; -} __attribute__ ((packed)); - -/* Modeline information used by XFree86. */ -struct vbe_modeline { - u_int16_t width, height; - unsigned char interlaced; - float refresh; - char *modeline; - float hfreq, vfreq, pixel_clock; -}; - -/* Aspect ratios used in EDID info. */ -enum vbe_edid_aspect { - aspect_unknown = 0, - aspect_75, - aspect_8, - aspect_5625, -}; - -/* Detailed timing information used in EDID v1.x */ -struct vbe_edid_detailed_timing { - u_int16_t pixel_clock; -#define VBE_EDID_DETAILED_TIMING_PIXEL_CLOCK(_x) \ - ((_x).pixel_clock * 10000) - unsigned char horizontal_active; - unsigned char horizontal_blanking; - unsigned char horizontal_active_hi: 4; - unsigned char horizontal_blanking_hi: 4; -#define VBE_EDID_DETAILED_TIMING_HORIZONTAL_ACTIVE(_x) \ - (((_x).horizontal_active_hi << 8) + (_x).horizontal_active) -#define VBE_EDID_DETAILED_TIMING_HORIZONTAL_BLANKING(_x) \ - (((_x).horizontal_blanking_hi << 8) + (_x).horizontal_blanking) - unsigned char vertical_active; - unsigned char vertical_blanking; - unsigned char vertical_active_hi: 4; - unsigned char vertical_blanking_hi: 4; -#define VBE_EDID_DETAILED_TIMING_VERTICAL_ACTIVE(_x) \ - (((_x).vertical_active_hi << 8) + (_x).vertical_active) -#define VBE_EDID_DETAILED_TIMING_VERTICAL_BLANKING(_x) \ - (((_x).vertical_blanking_hi << 8) + (_x).vertical_blanking) - unsigned char hsync_offset; - unsigned char hsync_pulse_width; - unsigned char vsync_offset: 4; - unsigned char vsync_pulse_width: 4; - unsigned char hsync_offset_hi: 2; - unsigned char hsync_pulse_width_hi: 2; - unsigned char vsync_offset_hi: 2; - unsigned char vsync_pulse_width_hi: 2; -#define VBE_EDID_DETAILED_TIMING_HSYNC_OFFSET(_x) \ - (((_x).hsync_offset_hi << 8) + (_x).hsync_offset) -#define VBE_EDID_DETAILED_TIMING_HSYNC_PULSE_WIDTH(_x) \ - (((_x).hsync_pulse_width_hi << 8) + (_x).hsync_pulse_width) -#define VBE_EDID_DETAILED_TIMING_VSYNC_OFFSET(_x) \ - (((_x).vsync_offset_hi << 4) + (_x).vsync_offset) -#define VBE_EDID_DETAILED_TIMING_VSYNC_PULSE_WIDTH(_x) \ - (((_x).vsync_pulse_width_hi << 4) + (_x).vsync_pulse_width) - unsigned char himage_size; - unsigned char vimage_size; - unsigned char himage_size_hi: 4; - unsigned char vimage_size_hi: 4; -#define VBE_EDID_DETAILED_TIMING_HIMAGE_SIZE(_x) \ - (((_x).himage_size_hi << 8) + (_x).himage_size) -#define VBE_EDID_DETAILED_TIMING_VIMAGE_SIZE(_x) \ - (((_x).vimage_size_hi << 8) + (_x).vimage_size) - unsigned char hborder; - unsigned char vborder; - struct { - unsigned char interlaced: 1; - unsigned char stereo: 2; - unsigned char digital_composite: 2; - unsigned char variant: 2; - unsigned char zero: 1; - } flags __attribute__ ((packed)); -} __attribute__ ((packed)); - -enum { - vbe_edid_monitor_descriptor_serial = 0xff, - vbe_edid_monitor_descriptor_ascii = 0xfe, - vbe_edid_monitor_descriptor_range = 0xfd, - vbe_edid_monitor_descriptor_name = 0xfc, -} vbe_edid_monitor_descriptor_types; - -struct vbe_edid_monitor_descriptor { - u_int16_t zero_flag_1; - unsigned char zero_flag_2; - unsigned char type; - unsigned char zero_flag_3; - union { - char string[13]; - struct { - unsigned char vertical_min; - unsigned char vertical_max; - unsigned char horizontal_min; - unsigned char horizontal_max; - unsigned char pixel_clock_max; - unsigned char gtf_data[8]; - } range_data; - } data; -} __attribute__ ((packed)); - -struct vbe_edid1_info { - unsigned char header[8]; - struct { - u_int16_t char3: 5; - u_int16_t char2: 5; - u_int16_t char1: 5; - u_int16_t zero: 1; - } manufacturer_name __attribute__ ((packed)); - u_int16_t product_code; - u_int32_t serial_number; - unsigned char week; - unsigned char year; - unsigned char version; - unsigned char revision; - struct { - unsigned char separate_sync: 1; - unsigned char composite_sync: 1; - unsigned char sync_on_green: 1; - unsigned char unused: 2; - unsigned char voltage_level: 2; - unsigned char digital: 1; - } video_input_definition __attribute__ ((packed)); - unsigned char max_size_horizontal; - unsigned char max_size_vertical; - unsigned char gamma; - struct { - unsigned char unused1: 3; - unsigned char rgb: 1; - unsigned char unused2: 1; - unsigned char active_off: 1; - unsigned char suspend: 1; - unsigned char standby: 1; - } feature_support __attribute__ ((packed)); - unsigned char color_characteristics[10]; - struct { - unsigned char timing_720x400_70: 1; - unsigned char timing_720x400_88: 1; - unsigned char timing_640x480_60: 1; - unsigned char timing_640x480_67: 1; - unsigned char timing_640x480_72: 1; - unsigned char timing_640x480_75: 1; - unsigned char timing_800x600_56: 1; - unsigned char timing_800x600_60: 1; - unsigned char timing_800x600_72: 1; - unsigned char timing_800x600_75: 1; - unsigned char timing_832x624_75: 1; - unsigned char timing_1024x768_87i: 1; - unsigned char timing_1024x768_60: 1; - unsigned char timing_1024x768_70: 1; - unsigned char timing_1024x768_75: 1; - unsigned char timing_1280x1024_75: 1; - } established_timings __attribute__ ((packed)); - struct { - unsigned char timing_1152x870_75: 1; - unsigned char reserved: 7; - } manufacturer_timings __attribute__ ((packed)); - struct { - u_int16_t xresolution: 8; - u_int16_t vfreq: 6; - u_int16_t aspect: 2; - } standard_timing[8] __attribute__ ((packed)); - union { - struct vbe_edid_detailed_timing detailed_timing[4]; - struct vbe_edid_monitor_descriptor monitor_descriptor[4]; - } monitor_details __attribute__ ((packed)); - unsigned char extension_flag; - unsigned char checksum; - unsigned char padding[128]; -} __attribute__ ((packed)); - -#define VBE_LINEAR_FRAMEBUFFER 0x4000 - -/* Get VESA information. */ -struct vbe_info *vbe_get_vbe_info(); - -/* Get information about a particular video mode, bitwise or with - VBE_LINEAR_FRAMEBUFFER to check if LFB version is supported. */ -struct vbe_mode_info *vbe_get_mode_info(u_int16_t mode); - -/* Check if EDID reads are supported, and do them. */ -int vbe_get_edid_supported(); -struct vbe_edid1_info *vbe_get_edid_info(); - -/* Get the current video mode, -1 on error. */ -int32_t vbe_get_mode(); -/* Set a new video mode, bitwise or with VBE_LINEAR_FRAMEBUFFER. */ -void vbe_set_mode(u_int16_t mode); - -/* Save/restore the SVGA state. Call free() on the state record when done. */ -const void *vbe_save_svga_state(); -void vbe_restore_svga_state(const void *state); - -/* Get the ranges of values suitable for the attached monitor. */ -void vbe_get_edid_ranges(struct vbe_edid1_info *edid, - unsigned char *hmin, unsigned char *hmax, - unsigned char *vmin, unsigned char *vmax); - -/* Get a list of modelines that will work with this monitor. */ -struct vbe_modeline *vbe_get_edid_modelines(); - -#endif diff --git a/tools/ddcprobe/vesamode.c b/tools/ddcprobe/vesamode.c deleted file mode 100644 index 9d4c3797a..000000000 --- a/tools/ddcprobe/vesamode.c +++ /dev/null @@ -1,132 +0,0 @@ -#include "vesamode.h" -#ident "$Id$" - -/* Known standard VESA modes. */ -struct vesa_mode_t known_vesa_modes[] = { - /* VESA 1.0/1.1 ? */ - {0x100, 640, 400, 256, "640x400x256"}, - {0x101, 640, 480, 256, "640x480x256"}, - {0x102, 800, 600, 16, "800x600x16"}, - {0x103, 800, 600, 256, "800x600x256"}, - {0x104, 1024, 768, 16, "1024x768x16"}, - {0x105, 1024, 768, 256, "1024x768x256"}, - {0x106, 1280, 1024, 16, "1280x1024x16"}, - {0x107, 1280, 1024, 256,"1280x1024x256"}, - {0x108, 80, 60, 16, "80x60 (text)"}, - {0x109, 132, 25, 16, "132x25 (text)"}, - {0x10a, 132, 43, 16, "132x43 (text)"}, - {0x10b, 132, 50, 16, "132x50 (text)"}, - {0x10c, 132, 60, 16, "132x60 (text)"}, - /* VESA 1.2+ */ - {0x10d, 320, 200, 32768, "320x200x32k"}, - {0x10e, 320, 200, 65536, "320x200x64k"}, - {0x10f, 320, 200, 16777216, "320x200x16m"}, - {0x110, 640, 480, 32768, "640x480x32k"}, - {0x111, 640, 480, 65536, "640x480x64k"}, - {0x112, 640, 480, 16777216, "640x480x16m"}, - {0x113, 800, 600, 32768, "800x600x32k"}, - {0x114, 800, 600, 65536, "800x600x64k"}, - {0x115, 800, 600, 16777216, "800x600x16m"}, - {0x116, 1024, 768, 32768, "1024x768x32k"}, - {0x117, 1024, 768, 65536, "1024x768x64k"}, - {0x118, 1024, 768, 16777216, "1024x768x16m"}, - {0x119, 1280, 1024, 32768, "1280x1024x32k"}, - {0x11a, 1280, 1024, 65536, "1280x1024x64k"}, - {0x11b, 1280, 1024, 16777216, "1280x1024x16m"}, - /* VESA 2.0+ */ - {0x120, 1600, 1200, 256, "1600x1200x256"}, - {0x121, 1600, 1200, 32768, "1600x1200x32k"}, - {0x122, 1600, 1200, 65536, "1600x1200x64k"}, - { 0, 0, 0, 0, ""}, -}; - -struct vesa_timing_t known_vesa_timings[] = { - /* Source: VESA Monitor Timing Specifications 1.0 rev 0.8 */ - { 640, 350, 85, 31.500, { 640, 32, 64, 96, 350,32, 3, 60}, - hsync_pos, vsync_neg, 37.861, 85.080}, - - { 640, 400, 85, 31.500, { 640, 32, 64, 96, 400, 1, 3, 41}, - hsync_neg, vsync_pos, 37.861, 85.080}, - - { 720, 400, 85, 35.500, { 720, 36, 72, 108, 400, 1, 3, 42}, - hsync_neg, vsync_pos, 37.861, 85.080}, - - { 640, 480, 60, 25.175, { 640, 8, 96, 40, 480, 2, 2, 25}, - hsync_neg, vsync_neg, 31.469, 59.940}, - { 640, 480, 72, 31.500, { 640, 16, 40, 120, 480, 1, 3, 20}, - hsync_neg, vsync_neg, 37.861, 72.809}, - { 640, 480, 75, 31.500, { 640, 16, 64, 120, 480, 1, 3, 16}, - hsync_neg, vsync_neg, 37.500, 75.000}, - { 640, 480, 85, 36.000, { 640, 56, 56, 80, 480, 1, 3, 25}, - hsync_neg, vsync_neg, 43.269, 85.008}, - - { 800, 600, 56, 36.000, { 800, 24, 72, 128, 600, 1, 2, 22}, - hsync_pos, vsync_pos, 35.156, 56.250}, - { 800, 600, 60, 40.000, { 800, 40, 128, 88, 600, 1, 4, 23}, - hsync_pos, vsync_pos, 37.879, 60.317}, - { 800, 600, 72, 50.000, { 800, 56, 120, 64, 600,37, 6, 23}, - hsync_pos, vsync_pos, 48.077, 72.188}, - { 800, 600, 75, 49.500, { 800, 16, 80, 160, 600, 1, 3, 21}, - hsync_pos, vsync_pos, 46.875, 75.000}, - { 800, 600, 85, 56.250, { 800, 32, 64, 152, 600, 1, 3, 27}, - hsync_pos, vsync_pos, 53.674, 85.061}, - - {1024, 768, 43, 44.900, {1024, 8, 176, 56, 768, 0, 4, 20}, - hsync_pos, vsync_pos, 35.522, 86.957}, - {1024, 768, 60, 65.000, {1024, 24, 136, 160, 768, 3, 6, 29}, - hsync_neg, vsync_neg, 48.363, 60.004}, - {1024, 768, 70, 75.000, {1024, 24, 136, 144, 768, 3, 6, 29}, - hsync_neg, vsync_neg, 56.476, 70.069}, - {1024, 768, 75, 78.750, {1024, 16, 96, 176, 768, 1, 3, 28}, - hsync_pos, vsync_pos, 60.023, 75.029}, - {1024, 768, 85, 94.500, {1024, 48, 96, 208, 768, 1, 3, 36}, - hsync_pos, vsync_pos, 68.677, 84.997}, - - {1152, 864, 70, 94.200, {1152, 32, 96, 192, 864, 1, 3, 46}, - hsync_pos, vsync_pos, 0.000, 0.000}, - {1152, 864, 75, 108.000, {1152, 64, 128, 256, 864, 1, 3, 32}, - hsync_pos, vsync_pos, 67.500, 75.000}, - {1152, 864, 85, 121.500, {1152, 64, 128, 224, 864, 1, 3, 43}, - hsync_pos, vsync_pos, 0.000, 0.000}, - - {1280, 960, 60, 108.000, {1280, 96, 112, 312, 960, 1, 3, 36}, - hsync_pos, vsync_pos, 60.000, 60.000}, - {1280, 960, 85, 148.500, {1280, 64, 160, 224, 960, 1, 3, 47}, - hsync_pos, vsync_pos, 85.398, 85.002}, - - {1280, 1024, 60, 108.000, {1280, 48, 112, 248, 1024, 1, 3, 38}, - hsync_pos, vsync_pos, 63.981, 60.020}, - {1280, 1024, 75, 135.000, {1280, 16, 144, 248, 1024, 1, 3, 38}, - hsync_pos, vsync_pos, 79.976, 75.025}, - {1280, 1024, 85, 157.500, {1280, 64, 160, 224, 1024, 1, 3, 44}, - hsync_pos, vsync_pos, 91.146, 85.024}, - - {1600, 1200, 60, 162.000, {1600, 64, 192, 304, 1200, 1, 3, 46}, - hsync_pos, vsync_pos, 75.000, 60.000}, - {1600, 1200, 65, 175.500, {1600, 64, 192, 304, 1200, 1, 3, 46}, - hsync_pos, vsync_pos, 81.250, 65.000}, - {1600, 1200, 70, 189.000, {1600, 64, 192, 304, 1200, 1, 3, 46}, - hsync_pos, vsync_pos, 87.500, 70.000}, - {1600, 1200, 75, 202.500, {1600, 64, 192, 304, 1200, 1, 3, 46}, - hsync_pos, vsync_pos, 93.750, 75.000}, - {1600, 1200, 85, 229.500, {1600, 64, 192, 304, 1200, 1, 3, 46}, - hsync_pos, vsync_pos, 106.250, 85.000}, - - {1792, 1344, 60, 204.750, {1792,128, 200, 328, 1344, 1, 3, 46}, - hsync_neg, vsync_pos, 83.640, 60.000}, - {1792, 1344, 75, 261.000, {1792, 96, 216, 352, 1344, 1, 3, 69}, - hsync_neg, vsync_pos, 106.270, 74.997}, - - {1856, 1392, 60, 218.250, {1856, 96, 224, 352, 1392, 1, 3, 43}, - hsync_neg, vsync_pos, 86.333, 59.995}, - {1856, 1392, 75, 288.000, {1856,128, 224, 352, 1392, 1, 3,104}, - hsync_neg, vsync_pos, 112.500, 75.000}, - - {1920, 1440, 60, 234.000, {1920,128, 208, 344, 1440, 1, 3, 56}, - hsync_neg, vsync_pos, 90.000, 60.000}, - {1920, 1440, 75, 297.000, {1920,144, 224, 352, 1440, 1, 3, 56}, - hsync_neg, vsync_pos, 112.500, 75.000}, - - { 0, 0, 0, 0.000, { 0, 0, 0, 0, 0, 0, 0, 0}, - 000000000, 000000000, 0.000, 0.000}, -}; diff --git a/tools/ddcprobe/vesamode.h b/tools/ddcprobe/vesamode.h deleted file mode 100644 index b7eef9283..000000000 --- a/tools/ddcprobe/vesamode.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef vesamode_h -#define vesamode_h -#include <sys/types.h> -#ident "$Id$" - -typedef enum { hsync_neg = 0, hsync_pos } hsync_t; -typedef enum { vsync_neg = 0, vsync_pos } vsync_t; - -struct vesa_mode_t { - u_int16_t number; - u_int16_t x, y; - u_int32_t colors; - const char *text; - const char *modeline; -}; - -struct vesa_timing_t { - u_int16_t x, y; - float refresh; - float dotclock; - u_int16_t timings[8]; - hsync_t hsync; - vsync_t vsync; - float hfreq; - float vfreq; -}; - -extern struct vesa_mode_t known_vesa_modes[]; -extern struct vesa_timing_t known_vesa_timings[]; - -#endif /* vesamode_h */ diff --git a/tools/drakx-in-chroot b/tools/drakx-in-chroot new file mode 100755 index 000000000..6565ec9e0 --- /dev/null +++ b/tools/drakx-in-chroot @@ -0,0 +1,278 @@ +#!/usr/bin/perl + +use MDK::Common; + +my $SLASH_LOCATION = '/tmp/drakx-in-chroot'; + +my $verbose = 0; +my $prefix_ROOTED = '/mnt'; +my $IMAGE_LOCATION_ROOTED = '/tmp/image'; +my $MEDIA_LOCATION_ROOTED = '/tmp/media'; +my $STAGE2_LOCATION_ROOTED = '/tmp/stage2'; +my $LOOP_MOUNT_POINT = "$SLASH_LOCATION/tmp/loop"; +my $LIVE_LOCATION_REL = 'install/stage2/live/'; +my $COMPRESSED_LOCATION_REL = 'install/stage2/'; +my $COMPRESSED_FILE_REL = $COMPRESSED_LOCATION_REL . 'mdkinst.sqfs'; +my $AUTO_INSTALL_ROOTED = '/tmp/auto_inst.cfg.pl'; +my $DEFCFG_ROOTED = '/tmp/defcfg.pl'; +my $RPMSRATE_ROOTED = '/tmp/rpmsrate'; +my $resolution = '1024x768'; +my ($disk_iso_repository, $repository_uri); + +@ARGV >= 2 or die "usage: drakx-in-chroot <root of distrib> <dir to install to> [options]\n +\nOptions specific to drakx-in-chroot: + --flang XX use XX locale + --disk-iso path of a distro + --resolution=XXXxYYYY (eg: --resolution=800x600)\n + --repository=<path> path of packages repository + --text text mode installer + --depth=XX set screen color depth + --stage2-update X,Y will mount --bind X on Y +"; + +(my $repository, my $dir, @ARGV) = @ARGV; +my ($wrapper); +foreach (@ARGV) { + if (/--resolution=(.*)/) { + $resolution = $1; + } elsif (/--disk-iso=(.*)/) { + $disk_iso_repository = $1; + } elsif (/--repository=(.*)/) { + $repository_uri = $1; + } elsif (/--gdb/) { + $wrapper = "gdb -q --args"; + } elsif (/--strace/) { + $wrapper = "strace -e file $ENV{STRACE_OPTIONS}"; + } elsif (/--depth=(.*)/) { + $resolution .= "x$1"; + } +} +my ($repository_without_arch, $repository_arch) = basename($repository) eq arch() ? (dirname($repository), '/' . arch()) : ($repository, ''); +my $STAGE2_LOCATION = $SLASH_LOCATION . $STAGE2_LOCATION_ROOTED; + +my $sudo; +if ($>) { + $sudo = "sudo"; + $ENV{PATH} = "/sbin:/usr/sbin:$ENV{PATH}"; +} + +my @mounts; +my $_b = before_leaving { sys("$sudo umount $_") foreach reverse @mounts }; + +undef $ENV{TMPDIR}; # prevent packdrake faillure on creating temporary files + +if (-d $SLASH_LOCATION) { + umount_all(1) == 0 or exit(1); + sys("$sudo rm -rf $SLASH_LOCATION/var/lib/rpm $SLASH_LOCATION/dev/mapper"); + rm_rf($SLASH_LOCATION); +} + +mkdir_p("$SLASH_LOCATION$_") foreach '/dev', '/etc', '/var', '/proc', '/sys', '/run', $STAGE2_LOCATION_ROOTED, $MEDIA_LOCATION_ROOTED, $prefix_ROOTED; + +sys("$sudo rm -rf $dir") if $ENV{CLEAN}; +-e $dir or sys("$sudo mkdir -p $dir"); + +copy_auto_install_files(); + +my $remote_repository = $repository =~ m!^(ftp|http)://! && $1; +if ($remote_repository) { + my $local_mdkinst = "$SLASH_LOCATION/tmp/mdkinst.sqfs"; + sys("curl --silent -o $local_mdkinst $repository/$COMPRESSED_FILE_REL"); + mount_mdkinst($local_mdkinst); +} elsif (-d "$repository/$LIVE_LOCATION_REL") { + mount("$repository/$LIVE_LOCATION_REL", $STAGE2_LOCATION, "-o bind"); +} elsif (-e "$repository/$COMPRESSED_FILE_REL") { + mount_mdkinst("$repository/$COMPRESSED_FILE_REL"); +} + +mount($dir, "$SLASH_LOCATION$prefix_ROOTED", "-o bind"); +$repository_uri ||= $repository_without_arch if !$remote_repository; +mount($repository_uri, "$SLASH_LOCATION$MEDIA_LOCATION_ROOTED", "-o bind") if $repository_uri; + +mount('/dev', "$SLASH_LOCATION/dev", " --bind -o ro"); +mount('none', "$SLASH_LOCATION/proc", "-t proc"); +mount('none', "$SLASH_LOCATION/sys", "-t sysfs"); +mount('none', "$SLASH_LOCATION/sys/kernel/debug", "-t debugfs"); +mount('none', "$SLASH_LOCATION/run", "-t tmpfs"); + +# - Ensure we mount the udev run dir for various extra metadata from udevadm +# - If dracut has been used (and thus udev has yummy metadata) make sure +# drakx knows about it when running in the chroot +# - Also speedup blkid by using its cache +foreach my $dir (qw(initramfs udev blkid)) { + next if !-d "/run/$dir"; + mkdir_p("$SLASH_LOCATION/run/$dir"); + mount("/run/$dir", "$SLASH_LOCATION/run/$dir", "-o bind"); +} + +if ($disk_iso_repository) { + my $repository_arch = $repository_arch || 'i586'; + mkdir_p($LOOP_MOUNT_POINT); + mount($disk_iso_repository, $LOOP_MOUNT_POINT, "-o loop,ro"); + symlinkf('loop/' . $repository_arch, "$SLASH_LOCATION$IMAGE_LOCATION_ROOTED"); # FIXME: arch() +} + +symlinkf('media' . $repository_arch, "$SLASH_LOCATION$IMAGE_LOCATION_ROOTED"); +create_initial_symlinks(); + +apply_stage2_updates(); + +output("$SLASH_LOCATION/etc/hosts", "127.0.0.1 localhost\n") if ! -e "$SLASH_LOCATION/etc/hosts"; + +#- in the chroot, we have no way to know which device corresponds to the "/" partition. +#- so helping it by giving the device which provide major/minor information +mkdir_p("$dir/dev"); +eval { cp_af($_, "$dir$_") } foreach qw(/dev/root); + +#- if the DISPLAY is remote, we may need to resolve the name: +eval { cp_af('/etc/resolv.conf', "$SLASH_LOCATION/etc/resolv.conf") }; + +{ + chomp(my $kernel_version = `uname -r`); + my $dir = "/modules/$kernel_version"; + mkdir_p("$SLASH_LOCATION$dir"); + output_p("$SLASH_LOCATION$dir" . $_, "\n") foreach "/lib/$dir/modules.dep", "/lib/$dir/modules.alias"; +} + +my $Xnest_pid; +if (!-f ($SLASH_LOCATION . $AUTO_INSTALL_ROOTED) && join('', @ARGV) !~ /--text/) { + my $Xnest_bin = find { whereis_binary($_) } 'Xephyr', 'Xnest' or die "Xephyr not found! Please install x11-server-xephyr!\n"; + my $DISPLAY = ':8'; + $Xnest_pid = fork(); + if (!$Xnest_pid) { + exec $Xnest_bin, $DISPLAY, '-ac', ($Xnest_bin eq 'Xephyr' ? '-screen' : '-geometry'), $resolution or die "Xnest failed\n"; + } + $ENV{DISPLAY} = $DISPLAY; +} + +if (my $pid = fork()) { + waitpid $pid, 0; + umount_all() == 0 or warn "umounting failed\n"; + $Xnest_pid and kill 15, $Xnest_pid; +} else { + $ENV{TERM} = 'linux'; # we only have terminfo for terminal "linux" + $ENV{HOME} = '/'; + # to kept sync with mdk-stage1/init.c::env: + $ENV{LD_LIBRARY_PATH}='/lib:/usr/lib:/mnt/lib:/mnt/usr/lib:/lib64:/usr/lib64:/mnt/lib64:/mnt/usr/lib64'; + if ($remote_repository) { + $ENV{URLPREFIX} = $repository; + } + my $cmd = join(' ', "/usr/bin/runinstall2 --local_install", + if_($disk_iso_repository, "--method disk-iso"), + if_($remote_repository, "--method $remote_repository"), + @ARGV); + if ($wrapper) { + warn qq(GDB USAGE +Beware that debug info won't be found so on segfault +just generate a core dump with "gcore" and then +analyze it offline. +Thus you sessions will look like: +(gdb) run +(gdb) gcore +(gdb) exit +); + } + exec "$sudo $wrapper chroot $SLASH_LOCATION $cmd" or die "exec $cmd in $SLASH_LOCATION failed\n"; +} + +sub system_verbose { warn join(' ', @_), "\n" if $verbose; system(@_) } +sub sys { &system_verbose; $? and die qq(running "@_" failed: $?\n) } + +sub mount_mdkinst { + my ($mdkinst) = @_; + mount($mdkinst, $STAGE2_LOCATION, "-t squashfs -o loop,ro"); +} +sub create_initial_symlinks() { + foreach (cat_or_die("$STAGE2_LOCATION/usr/share/symlinks")) { + my ($from, $to_) = split; + my $to = $SLASH_LOCATION . ($to_ || $from); + $from = "$STAGE2_LOCATION_ROOTED$from" if !$to_; + if (! -l $to) { + symlink $from, $to or die "symlinking $to failed\n"; + } + } + my $from = "$STAGE2_LOCATION_ROOTED/usr"; + my $to = "$SLASH_LOCATION/usr"; + symlink $from, $to or die "symlinking $to failed\n"; + foreach ('bin', 'sbin', 'lib', 'lib64') { + $from = "usr/$_"; + $to = "$SLASH_LOCATION/$_"; + symlink $from, $to or die "symlinking $to failed\n"; + } +} + +sub mount { + my ($from, $mntpt, @opts) = @_; + push @mounts, $mntpt; + sys("$sudo mount $from $mntpt " . join(' ', @opts)); +} + +sub umount_all { + my ($b_umount_dev_too) = @_; + my $err; + clean_stage2_updates(); + my @procs = (qw(/proc /sys/kernel/debug /sys /run/udev /run/blkid /run/initramfs /run)); + # special case for !draklive case (else a 2nd run would fail): + if ($b_umount_dev_too && cat_('/proc/mounts') =~ m! $SLASH_LOCATION/dev !) { + system_verbose "$sudo umount $SLASH_LOCATION/dev" and rm_rf("$SLASH_LOCATION/dev"); + } + foreach ((map { "$prefix_ROOTED$_" } @procs, '/dev', ''), @procs, $STAGE2_LOCATION_ROOTED, $LOOP_MOUNT_POINT, $MEDIA_LOCATION_ROOTED, $IMAGE_LOCATION_ROOTED) { + my $dir = "$SLASH_LOCATION$_"; + rmdir $dir; + if (-d $dir) { + if (m!/sys/kernel/debug! || begins_with($_, $prefix_ROOTED)) { + system_verbose "$sudo umount $dir 2>/dev/null"; + next; + } + system_verbose "$sudo umount $dir"; + } + rmdir $dir; + if (-d $dir) { + warn "$dir is busy\n"; + $err++; + } + } + if (my @remaining = cat_('/proc/mounts') =~ m!($SLASH_LOCATION/mnt/\S+)!g) { + warn "umount those mount points first: ", join(' ', @remaining), "\n"; + $err++; + } + $err; +} + +sub copy_auto_install_files() { + my ($opt); + each_index { + if ($opt eq 'auto_install' && -f $_) { + cp_f($_, $SLASH_LOCATION . $AUTO_INSTALL_ROOTED); + $_ = $AUTO_INSTALL_ROOTED; + } elsif ($opt eq 'defcfg' && -f $_) { + cp_f($_, $SLASH_LOCATION . $DEFCFG_ROOTED); + $_ = $DEFCFG_ROOTED; + } elsif ($opt eq 'rpmsrate' && -f $_) { + cp_f($_, $SLASH_LOCATION . $RPMSRATE_ROOTED); + } + undef $opt; + /^--?(.*)/ and $opt = $1; + } @ARGV; +} + +my @stage2_updates; +sub apply_stage2_updates() { + each_index { + if ($_ eq '--stage2-update') { + my $file = $ARGV[$::i+1]; + my $dest = $ARGV[$::i+2]; + if (-f $file && $dest) { + undef $_; + undef $ARGV[$::i+1]; + undef $ARGV[$::i+2]; + push @stage2_updates, $dest; + mount($file, "$STAGE2_LOCATION/$dest", " --bind"); + } + } + } @ARGV; +} + +sub clean_stage2_updates() { + sys("$sudo umount $STAGE2_LOCATION/$_") foreach @stage2_updates; +} diff --git a/tools/find-drivers-needing-nonfree-firmware b/tools/find-drivers-needing-nonfree-firmware new file mode 100755 index 000000000..e8068baee --- /dev/null +++ b/tools/find-drivers-needing-nonfree-firmware @@ -0,0 +1,94 @@ +#!/usr/bin/perl +use MDK::Common; +use Data::Dumper; +use Data::Dumper::Perltidy; + +my $debug = member('--debug', @ARGV); + +my $path = '../../cache'; +my %cache = ( + version => "$path/version.txt", + modules => "$path/modules.txt", + firmwares => "$path/firmwares.txt", + modinfo => "$path/modinfo.", + ); + +mkdir_p($path) if !-d $path; +# version of main kernel flavor: +my $kernel = chomp_(cat_($cache{version})); +if (!$kernel) { + # get regular flavor: + ($kernel) = split('\|', chomp_(`urpmq -f kernel-desktop-latest`)); + # get real package name: + $kernel =~ s/-latest//; + # drop arch as it confuses urpmq: + $kernel =~ s/\.[^.]*$//; + output($cache{version}, $kernel); +} +warn ">> GOT '$kernel'\n" if $debug; + +# list of modules: +my @modules = cat_($cache{modules}); +if (!@modules) { + @modules = grep { /\.ko/ } `urpmq -l $kernel`; + output($cache{modules}, @modules); +} +@modules = map { chomp; $_ } @modules; + +# list of those module firmwares: +my %firmwares; +{ + my @firmwares = cat_($cache{firmwares}); + if (!@firmwares) { + @firmwares = `urpmf --qf '%name-%version-%release.%arch:%files' /lib/firmware/ |sort -u`; + output($cache{firmwares}, @firmwares); + } + %firmwares = map { chomp; s!^(.*):/lib/firmware/!!; $_ => $1 } @firmwares; +} + +#warn Data::Dumper->Dump([ \@modules ], [ 'modules' ]); +warn Data::Dumper->Dump([ \%firmwares ], [ 'firmwares' ]) if $debug; + +# compute list of module that needs nonfree firmwares: +my @non_free_fw_drivers; +foreach (uniq(@modules)) { + my ($raw) = m!([^/]*)$!; + my $cache = $cache{modinfo} . $raw; + my @firmwares = cat_($cache); + # speedup: cache might exists but being empty: + if (!-e $cache) { + #warn ">> run '/sbin/modinfo $_ | grep firmware:'\n" if $debug; + @firmwares = `/sbin/modinfo $_ | grep firmware:`; + output($cache, @firmwares); + } + @firmwares = map { chomp; s/^.*:\s+//; $_ } @firmwares; + next if !@firmwares; + warn Data::Dumper->Dump([ \@firmwares ], [ 'firmware' ]) if $debug; + if (any { $firmwares{$_} && $firmwares{$_} =~ /nonfree/ } @firmwares) { + push @non_free_fw_drivers, $_; + #last; + } +} + +# cleaning: +@non_free_fw_drivers = sort map { s!.*/!!; s!\.ko.*$!!; $_ } @non_free_fw_drivers; + +#$Data::Dumper::Perltidy::ARGV = '-it=2 -l 100'; +#warn Dumper(\@non_free_fw_drivers) . "\n"; + +# Pretty dump: +my $sep = ' '; +my $s = $sep . 'qw(' . join(' ', @non_free_fw_drivers) . ')'; +$s =~ s/(.{70}\S*)\s+/$1\n$sep/g; + +output('list_firmwares.pm', + "# generated using $kernel\n", + q(# This list is autogenerated ; Do NOT alter manually. + +package list_firmwares; + +our @modules_with_nonfree_firmware = +), + $s, ";\n\n1;\n"); + + diff --git a/tools/gencompss b/tools/gencompss deleted file mode 100755 index b12328e49..000000000 --- a/tools/gencompss +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/perl - -open F, "packdrake -c @ARGV | hdlist2groups - |"; -foreach (<F>) { - chop; - /(.*):(.*)/; - $l{$2}{$1} = undef; -} -close F or die; -foreach (sort keys %l) { - print "$_\n"; - print "\t$_\n" foreach sort keys %{$l{$_}}; - print "\n"; -} diff --git a/tools/gencryptofiles b/tools/gencryptofiles deleted file mode 100755 index f86b1ec3a..000000000 --- a/tools/gencryptofiles +++ /dev/null @@ -1,115 +0,0 @@ -#!/usr/bin/perl - -#- Mandrake cryptographic package hdlist and depslist generation tools. -#- Copyright (C) 1999 MandrakeSoft (fpons@mandrakesoft.com) -#- -#- 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, 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. - -#- usage: gencryptofiles <crypto_dir> -#- build an hdlist and depslist file for crypto, need rpmtools also. - -my %resolver = ( - '/bin/sh' => 'bash', - '/bin/bash' => 'bash', - '/usr/bin/perl' => 'perl', - '/usr/bin/perl5' => 'perl', - - 'libBrokenLocale.so' => 'glibc', - 'libICE.so' => 'XFree86-libs', - 'libSM.so' => 'XFree86-libs', - 'libX11.so' => 'XFree86-libs', - 'libXext.so' => 'XFree86-libs', - 'libXmu.so' => 'XFree86-libs', - 'libXpm.so' => 'xpm', - 'libXt.so' => 'XFree86-libs', - 'libc.so.6' => 'glibc', - 'libgdbm.so' => 'gdbm', - 'libgpm.so' => 'gpm', - 'libm.so' => 'glibc', - 'libncurses.so' => 'ncurses', - 'libnsl.so' => 'glibc', - 'libpam.so' => 'pam', - 'libpthread.so' => 'glibc', - 'libreadline.so' => 'readline', - 'libstdc++-libc6.1-2.so' => 'libstdc++', - 'libstdc++.so' => 'libstdc++-compat', - 'libutil.so' => 'glibc', - 'libz.so' => 'zlib', - 'smtpdaemon' => 'postfix', - ); - -sub gendepslist_crypto { - my ($dir) = @_; - my %depslist; - - #- get information about each rpm. - local *DIR; - opendir DIR, $dir or die "cannot open directory: $!\n"; - while ($_ = readdir DIR) { - my ($key) = /(.*)\..*\.rpm$/ or next; - my ($name) = /(.*)-[^-]*-[^-]*-/; - - my $size = `rpm -qp --queryformat="%{SIZE}" $dir/$_`; - my @filelist = split "\n", `rpm -qpl $dir/$_`; - my @requires = split "\n", `rpm -qpR $dir/$_`; - - $depslist{$key} = { - key => $key, - size => $size, - filelist => \@filelist, - requires => \@requires, - deps => [], - }; - - foreach (@filelist) { - $resolver{$_} = $name; - m|.*/([^/]*)$| and $resolver{$1} = $name; - } - } - close DIR; - - #- resolve the dependancies. - foreach my $pkg (values %depslist) { - foreach (@{$pkg->{requires}}) { - $resolver{$_} and push(@{$pkg->{deps}}, $resolver{$_}), next; - m|^([^\s\(]*)| and $resolver{$1} and push(@{$pkg->{deps}}, $resolver{$1}), next; - m|^.*/([^/\s\(]*)| and $resolver{$1} and push(@{$pkg->{deps}}, $resolver{$1}), next; - m|^([^\s\(]*\.so)| and $resolver{$1} and push(@{$pkg->{deps}}, $resolver{$1}), next; - m|^.*/([^\s\(]*\.so)| and $resolver{$1} and push(@{$pkg->{deps}}, $resolver{$1}), next; - m|^([\w-]*)(?:\s+.*)$| and push(@{$pkg->{deps}}, $1); #- last and default to package name. - } - } - - #- build depslist-crypto file. - local *F; - open F, ">$dir/depslist-crypto" or die "cannot open depslist-crypto file for writing: $!\n"; - foreach (values %depslist) { - my %deps; - @deps{@{$_->{deps}}} = (); - print F "$_->{key} $_->{size} ", join(" ", keys %deps), "\n"; - } - close F; -} - -sub main { - my ($dir) = @_; - -d $dir or die "usage: gencryptofiles <crypto_dir>\n"; - -x "/usr/bin/genhdlist_cz2" or die "I need rpmtools to work (ie /usr/bin/genhdlist_cz2)\n"; - - print `genhdlist_cz2 -o $dir/hdlist-crypto.cz2 $dir`; - gendepslist_crypto($dir); -} - -main(@ARGV); diff --git a/tools/genmodparm b/tools/genmodparm deleted file mode 100755 index e4aa5d4e9..000000000 --- a/tools/genmodparm +++ /dev/null @@ -1,145 +0,0 @@ -#!/usr/bin/perl - -# Mandrake Graphic Install -# Copyright (C) 1999 MandrakeSoft (fpons@mandrakesoft.com) -# -# 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, 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. - -$srctop = $ARGV[0]; - -unless (-d $srctop) { - print STDERR "usage: $0 <linux_src_top>\n"; - print STDERR " <linux_src_top> is the linux source top directory,\n"; - print STDERR " for example /usr/src/linux\n"; - exit 1; -} - -open (FILE_LIST, "find $srctop/ -name \"*.c\" |"); - -while (<FILE_LIST>) { - chomp; - - my $file = $_; - my $dir = $file; - my $module = $file; - my $incfile; - my @incfiles; - my %parms; - my $oldline; - my $descline; - my $default; - my %substvars; - - # get mormalized directory name. - $dir =~ s/^(.*)\/[^\/]*$/$1/; - - # get mormalized module name. - $module =~ s/^.*\/([^\/]*)\.c$/$1/; - - # search for recogniwed special keywords. - open (F, $file); - while (<F>) { - # track for include files. - if (/^\#\s*include\s+[\<\"]([\w-\.\/]*)[\"\>]/) { - # search from /usr/src/linux/include directory. - push @incfiles, "/usr/src/linux/include/$1"; - - # search from current working directory. - push @incfiles, "$dir/$1"; - } - - if (/^\s*MODULE_PARM\s*\((\w*)\s*,\s*\"/) { - $parms{$1}{type} = '?'; - } - if (/^\s*MODULE_PARM\s*\((\w*)\s*,\s*\"([^\"]*)\"\s*\)/) { - $parms{$1}{type} = $2; - } - if (/^\s*MODULE_PARM_DESC\s*\((\w*)\s*,\s*\"([^\"]*)\"\s*\)/) { - $parms{$1}{desc} = $2; - } - } - close F; - - # parse associated include file if exist. - foreach $incfile (@incfiles) { - if (-r $incfile) { - open (F, $incfile); - while (<F>) { - s/^(.*)\/\*.*$/$1/g; - if (/^\#\s*define\s*(\w*)\s*(.*)$/) { - $substvars{$1}=$2; - } - } - close F; - } - } - - # search for comments about each module parameter. - open (F, $file); - while (<F>) { - my $line = $_; - - # manage simple preprocessor. - s/^(.*)\/\*.*$/$1/g; - if (/^\#\s*define\s*(\w*)\s*(.*)$/) { - $substvars{$1}=$2; - } - - # parse for parameters definition. - foreach $parm (keys %parms) { - if ($line =~ /^\s*(static\s+)?((short|long|signed|unsigned)\s+)?\w+(\s*\**\s+|\s+\**\s*)$parm(\s*\[.*\]\s*)?\s*=\s*([^\;]*)\;/) { - $default = $descline = $6; - $default =~ s/^(.*)\/\*.*$/$1/g; - - # remove hypothetic couple of { }. - $default =~ s/^(\s*\{\s*)(.*)(\s*\}\s*)$/$2/; - - # subsitute variable. - foreach $substvar (keys %substvars) { - $default =~ s/$substvar/$substvars{$substvar}/g; - } - $default =~ s/NULL/0/g; - $default =~ s/^\s*(.*?)\s*$/$1/; - $default = '' if $default =~ /\(\s*\(\s*void*\s*\*\)\s*0\s*\)\s*,?/; - - # store value. - $parms{$parm}{default} = $default; - - # try to search a comment on the previous line. - if (!defined($parms{$parm}{desc})) { - if ($oldline =~ /^\s*\/\*\s*(.*)\s*\*\/\s*$/ || /\/\*\s*(.*)\s*\*\/\s*$/) { - $parms{$parm}{desc} = $1; - } - } - - # try to search a comment on the line (multiline not supported). - if (!defined($parms{$parm}{desc})) { - if ($descline =~ /^.*\/\*\s*(.*)\s*\*\/\s*$/) { - $parms{$parm}{desc} = $1; - } - } - } - } - $oldline = $_; - } - close F; - - # dump all result to stdout associated to current module. - foreach $parm (keys %parms) { - print "$module:$parm:$parms{$parm}{type}:$parms{$parm}{default}:$parms{$parm}{desc}\n"; - } -} - -close FILE_LIST; diff --git a/tools/get-needed-drakx-modules b/tools/get-needed-drakx-modules new file mode 100755 index 000000000..019820c04 --- /dev/null +++ b/tools/get-needed-drakx-modules @@ -0,0 +1,19 @@ +#!/usr/bin/perl + +use MDK::Common; + +my ($rel, $dest, $script) = @ARGV; + +$rel =~ s!/?$!!; + +foreach (`strace -efile perl -cw -I $rel $script 2>&1`) { + my ($f) = /^open\("(.*?)",.*\)\s*=\s*\d+$/ or next; + $f !~ m!/usr/lib/perl5/[^/]*/warnings.pm! or next; + if (begins_with($f, $rel)) { + print $f, "\t", $dest . substr($f, length($rel)), "\n"; + } elsif (begins_with($f, '/dev/')) { + # skip + } elsif (begins_with($f, '/')) { + print "$f\n"; + } +} diff --git a/tools/hd_grub.cgi b/tools/hd_grub.cgi new file mode 100755 index 000000000..ac55b6eaf --- /dev/null +++ b/tools/hd_grub.cgi @@ -0,0 +1,102 @@ +#!/usr/bin/perl + +use CGI ':all'; +use CGI::Carp; + +my $default_append = "ramdisk_size=128000 root=/dev/ram3"; +my $default_acpi = "acpi=ht"; +my $default_vga = "vga=788"; + +my $cgi_name = "/" . ($0 =~ m|([^/]+)$|)[0]; + +print + header(), + start_html(-TITLE => 'hd_grub configuration'); + +if (param()) { + print_menu_lst(); +} else { + print_form(); +} + +print end_html; + + +sub menu_lst { + my ($hd, $hd_linux, $partition_number, $directory) = @_; + + my $grub_partition_number = $partition_number - 1; + + <<EOF; +timeout 0 +default 0 + +title Mageia Install + +root ($hd,$grub_partition_number) +kernel $directory/isolinux/alt0/vmlinuz $default_append $default_acpi $default_vga automatic=method:disk,partition:$hd_linux$partition_number,directory:$directory +initrd $directory/isolinux/alt0/all.rdz +EOF + +} + +sub print_menu_lst { + my $directory = param('directory'); + $directory =~ s!^/!!; + print + ol(li(qq(Select the text below and save it in a file "menu.lst")), + li(qq(Create a floppy from $directory/images/hd_grub.img (eg: <tt>dd if=hd_grub.img of=/dev/fd0</tt>))), + li(qq(Copy the file "menu.lst" to the floppy, overwriting the existing one)), + ), + p(), + start_form(-name => 'form', -action => $cgi_name, -method => 'get'), + textarea(-default => menu_lst(param('hd'), param('hd_linux'), param('partition_number'), "/$directory"), + -rows => 15, -columns => 120, + ), + end_form(), +} + +sub print_form { + print + p(), + start_form(-name => 'form', -action => $cgi_name, -method => 'get'), + ul("Please choose the partition where %s is copied.", + li(popup_menu(-name => "hd", -default => 'hd0', + -values => [ 'hd0' .. 'hd3' ], + -labels => { hd0 => '1st BIOS hard drive (usually hda or sda)', + hd1 => '2nd BIOS hard drive', + hd2 => '3rd BIOS hard drive', + hd3 => '4th BIOS hard drive', + })), + li(popup_menu(-name => "hd_linux", -default => 'hda', + -values => [ 'hda' .. 'hdd', 'sda' .. 'sdc', 'hde' .. 'hdh' ], + -labels => { + hda => '1st IDE hard drive (hda)', + hdb => '2nd IDE hard drive (hdb)', + hdc => '3rd IDE hard drive (hdc)', + hdd => '4th IDE hard drive (hdd)', + hde => '5th IDE hard drive (hde)', + hdf => '6th IDE hard drive (hdf)', + hdg => '7th IDE hard drive (hdg)', + hdh => '8th IDE hard drive (hdh)', + sda => '1st SCSI hard drive (sda)', + sdb => '2nd SCSI hard drive (sdb)', + sdc => '3rd SCSI hard drive (sdc)', + })), + li(popup_menu(-name => "partition_number", -default => '0', + -values => [ 1 .. 15 ], + -labels => { 1 => '1st primary partition (hda1, sda1 or ...)', + 2 => '2nd primary partition', + 3 => '3rd primary partition', + 4 => '4th primary partition', + 5 => '5th partition (hda5, sda5 or ...) (first logical partition)', + map { $_ => $_ . 'th partition' } 6 .. 15 + })), + ), + p(), + ul("Please enter the directory containing the %s Distribution (relative to the partition chosen above)", + li(textfield(-name => 'directory', -default => '/cooker/i586', size => 40)), + ), + p(submit(-name => 'Go')), + end_form(); +} diff --git a/tools/i386/busybox b/tools/i386/busybox Binary files differdeleted file mode 100755 index cebd84853..000000000 --- a/tools/i386/busybox +++ /dev/null diff --git a/tools/i386/e2fsck.shared b/tools/i386/e2fsck.shared Binary files differdeleted file mode 100755 index ad4d660a0..000000000 --- a/tools/i386/e2fsck.shared +++ /dev/null diff --git a/tools/i386/mkreiserfs b/tools/i386/mkreiserfs Binary files differdeleted file mode 100755 index 65fdf49f6..000000000 --- a/tools/i386/mkreiserfs +++ /dev/null diff --git a/tools/i386/netboot/.cvsignore b/tools/i386/netboot/.cvsignore deleted file mode 100644 index 64daa531c..000000000 --- a/tools/i386/netboot/.cvsignore +++ /dev/null @@ -1,4 +0,0 @@ -menu.lst -stage1 -stage2 -automatic.para diff --git a/tools/i386/netboot/3c503/nbgrub b/tools/i386/netboot/3c503/nbgrub Binary files differdeleted file mode 100644 index 4f4a14df4..000000000 --- a/tools/i386/netboot/3c503/nbgrub +++ /dev/null diff --git a/tools/i386/netboot/3c503/pxegrub b/tools/i386/netboot/3c503/pxegrub Binary files differdeleted file mode 100644 index cce227069..000000000 --- a/tools/i386/netboot/3c503/pxegrub +++ /dev/null diff --git a/tools/i386/netboot/3c503/stage1 b/tools/i386/netboot/3c503/stage1 Binary files differdeleted file mode 100755 index 8c923a183..000000000 --- a/tools/i386/netboot/3c503/stage1 +++ /dev/null diff --git a/tools/i386/netboot/3c503/stage2 b/tools/i386/netboot/3c503/stage2 Binary files differdeleted file mode 100644 index 35dbd34cb..000000000 --- a/tools/i386/netboot/3c503/stage2 +++ /dev/null diff --git a/tools/i386/netboot/3c507/nbgrub b/tools/i386/netboot/3c507/nbgrub Binary files differdeleted file mode 100644 index 2a09e2095..000000000 --- a/tools/i386/netboot/3c507/nbgrub +++ /dev/null diff --git a/tools/i386/netboot/3c507/pxegrub b/tools/i386/netboot/3c507/pxegrub Binary files differdeleted file mode 100644 index 55527173b..000000000 --- a/tools/i386/netboot/3c507/pxegrub +++ /dev/null diff --git a/tools/i386/netboot/3c507/stage1 b/tools/i386/netboot/3c507/stage1 Binary files differdeleted file mode 100755 index 8c923a183..000000000 --- a/tools/i386/netboot/3c507/stage1 +++ /dev/null diff --git a/tools/i386/netboot/3c507/stage2 b/tools/i386/netboot/3c507/stage2 Binary files differdeleted file mode 100644 index 83b8308bf..000000000 --- a/tools/i386/netboot/3c507/stage2 +++ /dev/null diff --git a/tools/i386/netboot/3c509/nbgrub b/tools/i386/netboot/3c509/nbgrub Binary files differdeleted file mode 100644 index fca541707..000000000 --- a/tools/i386/netboot/3c509/nbgrub +++ /dev/null diff --git a/tools/i386/netboot/3c509/pxegrub b/tools/i386/netboot/3c509/pxegrub Binary files differdeleted file mode 100644 index 00f4c227d..000000000 --- a/tools/i386/netboot/3c509/pxegrub +++ /dev/null diff --git a/tools/i386/netboot/3c509/stage1 b/tools/i386/netboot/3c509/stage1 Binary files differdeleted file mode 100755 index 8c923a183..000000000 --- a/tools/i386/netboot/3c509/stage1 +++ /dev/null diff --git a/tools/i386/netboot/3c509/stage2 b/tools/i386/netboot/3c509/stage2 Binary files differdeleted file mode 100644 index 8923e18aa..000000000 --- a/tools/i386/netboot/3c509/stage2 +++ /dev/null diff --git a/tools/i386/netboot/3c529/nbgrub b/tools/i386/netboot/3c529/nbgrub Binary files differdeleted file mode 100644 index b1dd42069..000000000 --- a/tools/i386/netboot/3c529/nbgrub +++ /dev/null diff --git a/tools/i386/netboot/3c529/pxegrub b/tools/i386/netboot/3c529/pxegrub Binary files differdeleted file mode 100644 index 7a265d20a..000000000 --- a/tools/i386/netboot/3c529/pxegrub +++ /dev/null diff --git a/tools/i386/netboot/3c529/stage1 b/tools/i386/netboot/3c529/stage1 Binary files differdeleted file mode 100755 index 8c923a183..000000000 --- a/tools/i386/netboot/3c529/stage1 +++ /dev/null diff --git a/tools/i386/netboot/3c529/stage2 b/tools/i386/netboot/3c529/stage2 Binary files differdeleted file mode 100644 index 98f710a27..000000000 --- a/tools/i386/netboot/3c529/stage2 +++ /dev/null diff --git a/tools/i386/netboot/3c595/nbgrub b/tools/i386/netboot/3c595/nbgrub Binary files differdeleted file mode 100644 index f4d7ca004..000000000 --- a/tools/i386/netboot/3c595/nbgrub +++ /dev/null diff --git a/tools/i386/netboot/3c595/pxegrub b/tools/i386/netboot/3c595/pxegrub Binary files differdeleted file mode 100644 index 3e5a81018..000000000 --- a/tools/i386/netboot/3c595/pxegrub +++ /dev/null diff --git a/tools/i386/netboot/3c595/stage1 b/tools/i386/netboot/3c595/stage1 Binary files differdeleted file mode 100755 index 8c923a183..000000000 --- a/tools/i386/netboot/3c595/stage1 +++ /dev/null diff --git a/tools/i386/netboot/3c595/stage2 b/tools/i386/netboot/3c595/stage2 Binary files differdeleted file mode 100644 index a1638948d..000000000 --- a/tools/i386/netboot/3c595/stage2 +++ /dev/null diff --git a/tools/i386/netboot/3c90x/nbgrub b/tools/i386/netboot/3c90x/nbgrub Binary files differdeleted file mode 100644 index d9d9a7bfe..000000000 --- a/tools/i386/netboot/3c90x/nbgrub +++ /dev/null diff --git a/tools/i386/netboot/3c90x/pxegrub b/tools/i386/netboot/3c90x/pxegrub Binary files differdeleted file mode 100644 index 621456a88..000000000 --- a/tools/i386/netboot/3c90x/pxegrub +++ /dev/null diff --git a/tools/i386/netboot/3c90x/stage1 b/tools/i386/netboot/3c90x/stage1 Binary files differdeleted file mode 100755 index 8c923a183..000000000 --- a/tools/i386/netboot/3c90x/stage1 +++ /dev/null diff --git a/tools/i386/netboot/3c90x/stage2 b/tools/i386/netboot/3c90x/stage2 Binary files differdeleted file mode 100644 index 28a350009..000000000 --- a/tools/i386/netboot/3c90x/stage2 +++ /dev/null diff --git a/tools/i386/netboot/depca/nbgrub b/tools/i386/netboot/depca/nbgrub Binary files differdeleted file mode 100644 index 2b413376b..000000000 --- a/tools/i386/netboot/depca/nbgrub +++ /dev/null diff --git a/tools/i386/netboot/depca/pxegrub b/tools/i386/netboot/depca/pxegrub Binary files differdeleted file mode 100644 index 458733521..000000000 --- a/tools/i386/netboot/depca/pxegrub +++ /dev/null diff --git a/tools/i386/netboot/depca/stage1 b/tools/i386/netboot/depca/stage1 Binary files differdeleted file mode 100755 index 8c923a183..000000000 --- a/tools/i386/netboot/depca/stage1 +++ /dev/null diff --git a/tools/i386/netboot/depca/stage2 b/tools/i386/netboot/depca/stage2 Binary files differdeleted file mode 100644 index 339375ce3..000000000 --- a/tools/i386/netboot/depca/stage2 +++ /dev/null diff --git a/tools/i386/netboot/device.map b/tools/i386/netboot/device.map deleted file mode 100644 index bf3423b23..000000000 --- a/tools/i386/netboot/device.map +++ /dev/null @@ -1 +0,0 @@ -(fd0) /dev/fd0 diff --git a/tools/i386/netboot/eepro/nbgrub b/tools/i386/netboot/eepro/nbgrub Binary files differdeleted file mode 100644 index c9a080623..000000000 --- a/tools/i386/netboot/eepro/nbgrub +++ /dev/null diff --git a/tools/i386/netboot/eepro/pxegrub b/tools/i386/netboot/eepro/pxegrub Binary files differdeleted file mode 100644 index de839080d..000000000 --- a/tools/i386/netboot/eepro/pxegrub +++ /dev/null diff --git a/tools/i386/netboot/eepro/stage1 b/tools/i386/netboot/eepro/stage1 Binary files differdeleted file mode 100755 index 8c923a183..000000000 --- a/tools/i386/netboot/eepro/stage1 +++ /dev/null diff --git a/tools/i386/netboot/eepro/stage2 b/tools/i386/netboot/eepro/stage2 Binary files differdeleted file mode 100644 index 5703e33c8..000000000 --- a/tools/i386/netboot/eepro/stage2 +++ /dev/null diff --git a/tools/i386/netboot/eepro100/nbgrub b/tools/i386/netboot/eepro100/nbgrub Binary files differdeleted file mode 100644 index 841acc541..000000000 --- a/tools/i386/netboot/eepro100/nbgrub +++ /dev/null diff --git a/tools/i386/netboot/eepro100/pxegrub b/tools/i386/netboot/eepro100/pxegrub Binary files differdeleted file mode 100644 index 7eea03239..000000000 --- a/tools/i386/netboot/eepro100/pxegrub +++ /dev/null diff --git a/tools/i386/netboot/eepro100/stage1 b/tools/i386/netboot/eepro100/stage1 Binary files differdeleted file mode 100755 index 8c923a183..000000000 --- a/tools/i386/netboot/eepro100/stage1 +++ /dev/null diff --git a/tools/i386/netboot/eepro100/stage2 b/tools/i386/netboot/eepro100/stage2 Binary files differdeleted file mode 100644 index a8ac76752..000000000 --- a/tools/i386/netboot/eepro100/stage2 +++ /dev/null diff --git a/tools/i386/netboot/epic100/nbgrub b/tools/i386/netboot/epic100/nbgrub Binary files differdeleted file mode 100644 index b896e95d3..000000000 --- a/tools/i386/netboot/epic100/nbgrub +++ /dev/null diff --git a/tools/i386/netboot/epic100/pxegrub b/tools/i386/netboot/epic100/pxegrub Binary files differdeleted file mode 100644 index b54698e3f..000000000 --- a/tools/i386/netboot/epic100/pxegrub +++ /dev/null diff --git a/tools/i386/netboot/epic100/stage1 b/tools/i386/netboot/epic100/stage1 Binary files differdeleted file mode 100755 index 8c923a183..000000000 --- a/tools/i386/netboot/epic100/stage1 +++ /dev/null diff --git a/tools/i386/netboot/epic100/stage2 b/tools/i386/netboot/epic100/stage2 Binary files differdeleted file mode 100644 index 7742e2bc2..000000000 --- a/tools/i386/netboot/epic100/stage2 +++ /dev/null diff --git a/tools/i386/netboot/exos205/nbgrub b/tools/i386/netboot/exos205/nbgrub Binary files differdeleted file mode 100644 index 5218c738d..000000000 --- a/tools/i386/netboot/exos205/nbgrub +++ /dev/null diff --git a/tools/i386/netboot/exos205/pxegrub b/tools/i386/netboot/exos205/pxegrub Binary files differdeleted file mode 100644 index 951284ffe..000000000 --- a/tools/i386/netboot/exos205/pxegrub +++ /dev/null diff --git a/tools/i386/netboot/exos205/stage1 b/tools/i386/netboot/exos205/stage1 Binary files differdeleted file mode 100755 index 8c923a183..000000000 --- a/tools/i386/netboot/exos205/stage1 +++ /dev/null diff --git a/tools/i386/netboot/exos205/stage2 b/tools/i386/netboot/exos205/stage2 Binary files differdeleted file mode 100644 index 38e9e1562..000000000 --- a/tools/i386/netboot/exos205/stage2 +++ /dev/null diff --git a/tools/i386/netboot/grub b/tools/i386/netboot/grub Binary files differdeleted file mode 100755 index b4d77fe36..000000000 --- a/tools/i386/netboot/grub +++ /dev/null diff --git a/tools/i386/netboot/lance/nbgrub b/tools/i386/netboot/lance/nbgrub Binary files differdeleted file mode 100644 index fe9df36be..000000000 --- a/tools/i386/netboot/lance/nbgrub +++ /dev/null diff --git a/tools/i386/netboot/lance/pxegrub b/tools/i386/netboot/lance/pxegrub Binary files differdeleted file mode 100644 index 265f276c0..000000000 --- a/tools/i386/netboot/lance/pxegrub +++ /dev/null diff --git a/tools/i386/netboot/lance/stage1 b/tools/i386/netboot/lance/stage1 Binary files differdeleted file mode 100755 index 8c923a183..000000000 --- a/tools/i386/netboot/lance/stage1 +++ /dev/null diff --git a/tools/i386/netboot/lance/stage2 b/tools/i386/netboot/lance/stage2 Binary files differdeleted file mode 100644 index 653f7b212..000000000 --- a/tools/i386/netboot/lance/stage2 +++ /dev/null diff --git a/tools/i386/netboot/makeImages b/tools/i386/netboot/makeImages deleted file mode 100755 index 79d45c11e..000000000 --- a/tools/i386/netboot/makeImages +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh -# compile multiple grub stages (1, 2, pxegrub and nbgrub) for all supported network cards -LOCALPATH=`pwd` -PATHGRUB="../grub-0.91" # Path were grub is stored -DRIVERTOCOMPILE=`grep NETBOOT_DRIVERS= ${PATHGRUB}/configure.in | cut -d " " -f 4 | cut -d "." -f 1` - -echo "Cleaning old drivers" -for i in `ls` -do - if [ -d $i ]; then - rm -rf $i - fi - -done - -cd ${PATHGRUB} - -echo "Compiling new ones" -for i in ${DRIVERTOCOMPILE} - do - make clean - ./configure --enable-$i --enable-diskless - make - mkdir ${LOCALPATH}/$i - cp stage1/stage1 ${LOCALPATH}/$i/stage1 - cp stage2/stage2 ${LOCALPATH}/$i/stage2 - cp stage2/pxegrub ${LOCALPATH}/$i/pxegrub - cp stage2/nbgrub ${LOCALPATH}/$i/nbgrub - echo "compil done for " $i -done -cp ${PATHGRUB}/grub/grub ${LOCALPATH} -f diff --git a/tools/i386/netboot/make_boot_network b/tools/i386/netboot/make_boot_network deleted file mode 100755 index a0b0302a4..000000000 --- a/tools/i386/netboot/make_boot_network +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -type=$1 -[ -z "$type" ] && { echo "usage: $0 <network card type> (eg: 3c90x)" ; exit 1; } - -[ -e menu.lst ] || { echo "missing file menu.lst, create one based on menu.lst.example"; exit 1; } - -ln -sf ${type}/stage1 stage1 -ln -sf ${type}/stage2 stage2 - -mformat a: -mcopy {stage1,stage2} a: -mcopy menu.lst a:menu.lst - -./grub --batch <<EOF -install (fd0)/stage1 d (fd0) (fd0)/stage2 p (fd0)/menu.lst $automatic -EOF diff --git a/tools/i386/netboot/menu.lst.example b/tools/i386/netboot/menu.lst.example deleted file mode 100644 index 41022579a..000000000 --- a/tools/i386/netboot/menu.lst.example +++ /dev/null @@ -1,21 +0,0 @@ -timeout 0 -default 0 - -title nfs -dhcp -tftpserver 192.168.100.39 -kernel (nd)/vmlinuz ramdisk=32000 vga=788 kickstart=Mandrake/base/auto_inst.cfg.pl useless_thing_accepted automatic=method:nfs,network:static,ip:192.168.100.25,dns:192.168.100.11,gateway:192.168.100.1,server:192.168.100.39,directory:/export,user:a,pass:a -initrd (nd)/network.rdz - -title ftp -dhcp -tftpserver 192.168.100.39 -kernel (nd)/vmlinuz ramdisk=32000 vga=788 kickstart=Mandrake/base/auto_inst.cfg.pl useless_thing_accepted automatic=method:ftp,network:static,ip:192.168.100.25,dns:192.168.100.11,gateway:192.168.100.1,server:192.168.100.39,directory:/export,user:a,pass:a -initrd (nd)/network.rdz - -title rescue -dhcp -tftpserver 192.168.100.39 -kernel (nd)/vmlinuz rescue rw root=/dev/ram3 ramdisk=32000 vga=788 kickstart=Mandrake/base/auto_inst.cfg.pl useless_thing_accepted automatic=method:nfs,network:static,ip:192.168.100.25,dns:192.168.100.11,gateway:192.168.100.1,server:192.168.100.39,directory:/export,user:a,pass:a -initrd (nd)/network.rdz - diff --git a/tools/i386/netboot/ne/nbgrub b/tools/i386/netboot/ne/nbgrub Binary files differdeleted file mode 100644 index 622e5db90..000000000 --- a/tools/i386/netboot/ne/nbgrub +++ /dev/null diff --git a/tools/i386/netboot/ne/pxegrub b/tools/i386/netboot/ne/pxegrub Binary files differdeleted file mode 100644 index 0d59f4473..000000000 --- a/tools/i386/netboot/ne/pxegrub +++ /dev/null diff --git a/tools/i386/netboot/ne/stage1 b/tools/i386/netboot/ne/stage1 Binary files differdeleted file mode 100755 index 8c923a183..000000000 --- a/tools/i386/netboot/ne/stage1 +++ /dev/null diff --git a/tools/i386/netboot/ne/stage2 b/tools/i386/netboot/ne/stage2 Binary files differdeleted file mode 100644 index 60877704a..000000000 --- a/tools/i386/netboot/ne/stage2 +++ /dev/null diff --git a/tools/i386/netboot/ne2100/nbgrub b/tools/i386/netboot/ne2100/nbgrub Binary files differdeleted file mode 100644 index 86a640cfd..000000000 --- a/tools/i386/netboot/ne2100/nbgrub +++ /dev/null diff --git a/tools/i386/netboot/ne2100/pxegrub b/tools/i386/netboot/ne2100/pxegrub Binary files differdeleted file mode 100644 index 289459191..000000000 --- a/tools/i386/netboot/ne2100/pxegrub +++ /dev/null diff --git a/tools/i386/netboot/ne2100/stage1 b/tools/i386/netboot/ne2100/stage1 Binary files differdeleted file mode 100755 index 8c923a183..000000000 --- a/tools/i386/netboot/ne2100/stage1 +++ /dev/null diff --git a/tools/i386/netboot/ne2100/stage2 b/tools/i386/netboot/ne2100/stage2 Binary files differdeleted file mode 100644 index 4db05ff1b..000000000 --- a/tools/i386/netboot/ne2100/stage2 +++ /dev/null diff --git a/tools/i386/netboot/ni5010/nbgrub b/tools/i386/netboot/ni5010/nbgrub Binary files differdeleted file mode 100644 index befe61355..000000000 --- a/tools/i386/netboot/ni5010/nbgrub +++ /dev/null diff --git a/tools/i386/netboot/ni5010/pxegrub b/tools/i386/netboot/ni5010/pxegrub Binary files differdeleted file mode 100644 index 9ba588161..000000000 --- a/tools/i386/netboot/ni5010/pxegrub +++ /dev/null diff --git a/tools/i386/netboot/ni5010/stage1 b/tools/i386/netboot/ni5010/stage1 Binary files differdeleted file mode 100755 index 8c923a183..000000000 --- a/tools/i386/netboot/ni5010/stage1 +++ /dev/null diff --git a/tools/i386/netboot/ni5010/stage2 b/tools/i386/netboot/ni5010/stage2 Binary files differdeleted file mode 100644 index ad87dd76e..000000000 --- a/tools/i386/netboot/ni5010/stage2 +++ /dev/null diff --git a/tools/i386/netboot/ni5210/nbgrub b/tools/i386/netboot/ni5210/nbgrub Binary files differdeleted file mode 100644 index f32d888e0..000000000 --- a/tools/i386/netboot/ni5210/nbgrub +++ /dev/null diff --git a/tools/i386/netboot/ni5210/pxegrub b/tools/i386/netboot/ni5210/pxegrub Binary files differdeleted file mode 100644 index c9378a973..000000000 --- a/tools/i386/netboot/ni5210/pxegrub +++ /dev/null diff --git a/tools/i386/netboot/ni5210/stage1 b/tools/i386/netboot/ni5210/stage1 Binary files differdeleted file mode 100755 index 8c923a183..000000000 --- a/tools/i386/netboot/ni5210/stage1 +++ /dev/null diff --git a/tools/i386/netboot/ni5210/stage2 b/tools/i386/netboot/ni5210/stage2 Binary files differdeleted file mode 100644 index 3f2b6897e..000000000 --- a/tools/i386/netboot/ni5210/stage2 +++ /dev/null diff --git a/tools/i386/netboot/ni6510/nbgrub b/tools/i386/netboot/ni6510/nbgrub Binary files differdeleted file mode 100644 index 9f738a857..000000000 --- a/tools/i386/netboot/ni6510/nbgrub +++ /dev/null diff --git a/tools/i386/netboot/ni6510/pxegrub b/tools/i386/netboot/ni6510/pxegrub Binary files differdeleted file mode 100644 index 57b4cbc31..000000000 --- a/tools/i386/netboot/ni6510/pxegrub +++ /dev/null diff --git a/tools/i386/netboot/ni6510/stage1 b/tools/i386/netboot/ni6510/stage1 Binary files differdeleted file mode 100755 index 8c923a183..000000000 --- a/tools/i386/netboot/ni6510/stage1 +++ /dev/null diff --git a/tools/i386/netboot/ni6510/stage2 b/tools/i386/netboot/ni6510/stage2 Binary files differdeleted file mode 100644 index e1d209afc..000000000 --- a/tools/i386/netboot/ni6510/stage2 +++ /dev/null diff --git a/tools/i386/netboot/ns8390/nbgrub b/tools/i386/netboot/ns8390/nbgrub Binary files differdeleted file mode 100644 index e2fc9c88f..000000000 --- a/tools/i386/netboot/ns8390/nbgrub +++ /dev/null diff --git a/tools/i386/netboot/ns8390/pxegrub b/tools/i386/netboot/ns8390/pxegrub Binary files differdeleted file mode 100644 index 2d2aa4654..000000000 --- a/tools/i386/netboot/ns8390/pxegrub +++ /dev/null diff --git a/tools/i386/netboot/ns8390/stage1 b/tools/i386/netboot/ns8390/stage1 Binary files differdeleted file mode 100755 index 8c923a183..000000000 --- a/tools/i386/netboot/ns8390/stage1 +++ /dev/null diff --git a/tools/i386/netboot/ns8390/stage2 b/tools/i386/netboot/ns8390/stage2 Binary files differdeleted file mode 100644 index 689d8513f..000000000 --- a/tools/i386/netboot/ns8390/stage2 +++ /dev/null diff --git a/tools/i386/netboot/otulip/nbgrub b/tools/i386/netboot/otulip/nbgrub Binary files differdeleted file mode 100644 index 59b7c5e74..000000000 --- a/tools/i386/netboot/otulip/nbgrub +++ /dev/null diff --git a/tools/i386/netboot/otulip/pxegrub b/tools/i386/netboot/otulip/pxegrub Binary files differdeleted file mode 100644 index 48ae66374..000000000 --- a/tools/i386/netboot/otulip/pxegrub +++ /dev/null diff --git a/tools/i386/netboot/otulip/stage1 b/tools/i386/netboot/otulip/stage1 Binary files differdeleted file mode 100755 index 8c923a183..000000000 --- a/tools/i386/netboot/otulip/stage1 +++ /dev/null diff --git a/tools/i386/netboot/otulip/stage2 b/tools/i386/netboot/otulip/stage2 Binary files differdeleted file mode 100644 index f8353a1bb..000000000 --- a/tools/i386/netboot/otulip/stage2 +++ /dev/null diff --git a/tools/i386/netboot/rtl8139/nbgrub b/tools/i386/netboot/rtl8139/nbgrub Binary files differdeleted file mode 100644 index d8686c84c..000000000 --- a/tools/i386/netboot/rtl8139/nbgrub +++ /dev/null diff --git a/tools/i386/netboot/rtl8139/pxegrub b/tools/i386/netboot/rtl8139/pxegrub Binary files differdeleted file mode 100644 index 46e4665cc..000000000 --- a/tools/i386/netboot/rtl8139/pxegrub +++ /dev/null diff --git a/tools/i386/netboot/rtl8139/stage1 b/tools/i386/netboot/rtl8139/stage1 Binary files differdeleted file mode 100755 index 8c923a183..000000000 --- a/tools/i386/netboot/rtl8139/stage1 +++ /dev/null diff --git a/tools/i386/netboot/rtl8139/stage2 b/tools/i386/netboot/rtl8139/stage2 Binary files differdeleted file mode 100644 index d3418e589..000000000 --- a/tools/i386/netboot/rtl8139/stage2 +++ /dev/null diff --git a/tools/i386/netboot/sis900/nbgrub b/tools/i386/netboot/sis900/nbgrub Binary files differdeleted file mode 100644 index d3ff63241..000000000 --- a/tools/i386/netboot/sis900/nbgrub +++ /dev/null diff --git a/tools/i386/netboot/sis900/pxegrub b/tools/i386/netboot/sis900/pxegrub Binary files differdeleted file mode 100644 index 0de4866b6..000000000 --- a/tools/i386/netboot/sis900/pxegrub +++ /dev/null diff --git a/tools/i386/netboot/sis900/stage1 b/tools/i386/netboot/sis900/stage1 Binary files differdeleted file mode 100755 index 8c923a183..000000000 --- a/tools/i386/netboot/sis900/stage1 +++ /dev/null diff --git a/tools/i386/netboot/sis900/stage2 b/tools/i386/netboot/sis900/stage2 Binary files differdeleted file mode 100644 index 5b466e882..000000000 --- a/tools/i386/netboot/sis900/stage2 +++ /dev/null diff --git a/tools/i386/netboot/sk_g16/nbgrub b/tools/i386/netboot/sk_g16/nbgrub Binary files differdeleted file mode 100644 index a3684a225..000000000 --- a/tools/i386/netboot/sk_g16/nbgrub +++ /dev/null diff --git a/tools/i386/netboot/sk_g16/pxegrub b/tools/i386/netboot/sk_g16/pxegrub Binary files differdeleted file mode 100644 index 69a34390d..000000000 --- a/tools/i386/netboot/sk_g16/pxegrub +++ /dev/null diff --git a/tools/i386/netboot/sk_g16/stage1 b/tools/i386/netboot/sk_g16/stage1 Binary files differdeleted file mode 100755 index 8c923a183..000000000 --- a/tools/i386/netboot/sk_g16/stage1 +++ /dev/null diff --git a/tools/i386/netboot/sk_g16/stage2 b/tools/i386/netboot/sk_g16/stage2 Binary files differdeleted file mode 100644 index 3a118dcdb..000000000 --- a/tools/i386/netboot/sk_g16/stage2 +++ /dev/null diff --git a/tools/i386/netboot/smc9000/nbgrub b/tools/i386/netboot/smc9000/nbgrub Binary files differdeleted file mode 100644 index 94932dac3..000000000 --- a/tools/i386/netboot/smc9000/nbgrub +++ /dev/null diff --git a/tools/i386/netboot/smc9000/pxegrub b/tools/i386/netboot/smc9000/pxegrub Binary files differdeleted file mode 100644 index d4f9a4133..000000000 --- a/tools/i386/netboot/smc9000/pxegrub +++ /dev/null diff --git a/tools/i386/netboot/smc9000/stage1 b/tools/i386/netboot/smc9000/stage1 Binary files differdeleted file mode 100755 index 8c923a183..000000000 --- a/tools/i386/netboot/smc9000/stage1 +++ /dev/null diff --git a/tools/i386/netboot/smc9000/stage2 b/tools/i386/netboot/smc9000/stage2 Binary files differdeleted file mode 100644 index 9017fac90..000000000 --- a/tools/i386/netboot/smc9000/stage2 +++ /dev/null diff --git a/tools/i386/netboot/stage1.3c59x b/tools/i386/netboot/stage1.3c59x Binary files differdeleted file mode 100755 index 1cd1292ac..000000000 --- a/tools/i386/netboot/stage1.3c59x +++ /dev/null diff --git a/tools/i386/netboot/stage1.3c90x b/tools/i386/netboot/stage1.3c90x Binary files differdeleted file mode 100755 index 1cd1292ac..000000000 --- a/tools/i386/netboot/stage1.3c90x +++ /dev/null diff --git a/tools/i386/netboot/stage1.eepro100 b/tools/i386/netboot/stage1.eepro100 Binary files differdeleted file mode 100755 index 90f9c2210..000000000 --- a/tools/i386/netboot/stage1.eepro100 +++ /dev/null diff --git a/tools/i386/netboot/stage1.rtl8139 b/tools/i386/netboot/stage1.rtl8139 Binary files differdeleted file mode 100755 index 1cd1292ac..000000000 --- a/tools/i386/netboot/stage1.rtl8139 +++ /dev/null diff --git a/tools/i386/netboot/stage1.tulip b/tools/i386/netboot/stage1.tulip Binary files differdeleted file mode 100755 index 1cd1292ac..000000000 --- a/tools/i386/netboot/stage1.tulip +++ /dev/null diff --git a/tools/i386/netboot/stage1.via-rhine b/tools/i386/netboot/stage1.via-rhine Binary files differdeleted file mode 100755 index c15d90622..000000000 --- a/tools/i386/netboot/stage1.via-rhine +++ /dev/null diff --git a/tools/i386/netboot/stage2.3c59x b/tools/i386/netboot/stage2.3c59x Binary files differdeleted file mode 100644 index f1efb805d..000000000 --- a/tools/i386/netboot/stage2.3c59x +++ /dev/null diff --git a/tools/i386/netboot/stage2.3c90x b/tools/i386/netboot/stage2.3c90x Binary files differdeleted file mode 100644 index b53b66d56..000000000 --- a/tools/i386/netboot/stage2.3c90x +++ /dev/null diff --git a/tools/i386/netboot/stage2.eepro100 b/tools/i386/netboot/stage2.eepro100 Binary files differdeleted file mode 100644 index 5fb781dd8..000000000 --- a/tools/i386/netboot/stage2.eepro100 +++ /dev/null diff --git a/tools/i386/netboot/stage2.rtl8139 b/tools/i386/netboot/stage2.rtl8139 Binary files differdeleted file mode 100644 index 39136b67c..000000000 --- a/tools/i386/netboot/stage2.rtl8139 +++ /dev/null diff --git a/tools/i386/netboot/stage2.tulip b/tools/i386/netboot/stage2.tulip Binary files differdeleted file mode 100644 index ca238d182..000000000 --- a/tools/i386/netboot/stage2.tulip +++ /dev/null diff --git a/tools/i386/netboot/stage2.via-rhine b/tools/i386/netboot/stage2.via-rhine Binary files differdeleted file mode 100644 index 7fb5cb251..000000000 --- a/tools/i386/netboot/stage2.via-rhine +++ /dev/null diff --git a/tools/i386/netboot/tiara/nbgrub b/tools/i386/netboot/tiara/nbgrub Binary files differdeleted file mode 100644 index f40d1b39d..000000000 --- a/tools/i386/netboot/tiara/nbgrub +++ /dev/null diff --git a/tools/i386/netboot/tiara/pxegrub b/tools/i386/netboot/tiara/pxegrub Binary files differdeleted file mode 100644 index cf1321d0b..000000000 --- a/tools/i386/netboot/tiara/pxegrub +++ /dev/null diff --git a/tools/i386/netboot/tiara/stage1 b/tools/i386/netboot/tiara/stage1 Binary files differdeleted file mode 100755 index 8c923a183..000000000 --- a/tools/i386/netboot/tiara/stage1 +++ /dev/null diff --git a/tools/i386/netboot/tiara/stage2 b/tools/i386/netboot/tiara/stage2 Binary files differdeleted file mode 100644 index 5db3cb1cd..000000000 --- a/tools/i386/netboot/tiara/stage2 +++ /dev/null diff --git a/tools/i386/netboot/tulip/nbgrub b/tools/i386/netboot/tulip/nbgrub Binary files differdeleted file mode 100644 index 89a4ce0d4..000000000 --- a/tools/i386/netboot/tulip/nbgrub +++ /dev/null diff --git a/tools/i386/netboot/tulip/pxegrub b/tools/i386/netboot/tulip/pxegrub Binary files differdeleted file mode 100644 index 8d2344af1..000000000 --- a/tools/i386/netboot/tulip/pxegrub +++ /dev/null diff --git a/tools/i386/netboot/tulip/stage1 b/tools/i386/netboot/tulip/stage1 Binary files differdeleted file mode 100755 index 8c923a183..000000000 --- a/tools/i386/netboot/tulip/stage1 +++ /dev/null diff --git a/tools/i386/netboot/tulip/stage2 b/tools/i386/netboot/tulip/stage2 Binary files differdeleted file mode 100644 index e637e814a..000000000 --- a/tools/i386/netboot/tulip/stage2 +++ /dev/null diff --git a/tools/i386/netboot/w89c840/nbgrub b/tools/i386/netboot/w89c840/nbgrub Binary files differdeleted file mode 100644 index 068dc4d68..000000000 --- a/tools/i386/netboot/w89c840/nbgrub +++ /dev/null diff --git a/tools/i386/netboot/w89c840/pxegrub b/tools/i386/netboot/w89c840/pxegrub Binary files differdeleted file mode 100644 index 38e17d93d..000000000 --- a/tools/i386/netboot/w89c840/pxegrub +++ /dev/null diff --git a/tools/i386/netboot/w89c840/stage1 b/tools/i386/netboot/w89c840/stage1 Binary files differdeleted file mode 100755 index 8c923a183..000000000 --- a/tools/i386/netboot/w89c840/stage1 +++ /dev/null diff --git a/tools/i386/netboot/w89c840/stage2 b/tools/i386/netboot/w89c840/stage2 Binary files differdeleted file mode 100644 index e49a7aea6..000000000 --- a/tools/i386/netboot/w89c840/stage2 +++ /dev/null diff --git a/tools/i386/netboot/wd/nbgrub b/tools/i386/netboot/wd/nbgrub Binary files differdeleted file mode 100644 index e08bc08e6..000000000 --- a/tools/i386/netboot/wd/nbgrub +++ /dev/null diff --git a/tools/i386/netboot/wd/pxegrub b/tools/i386/netboot/wd/pxegrub Binary files differdeleted file mode 100644 index 6f3759ccf..000000000 --- a/tools/i386/netboot/wd/pxegrub +++ /dev/null diff --git a/tools/i386/netboot/wd/stage1 b/tools/i386/netboot/wd/stage1 Binary files differdeleted file mode 100755 index 8c923a183..000000000 --- a/tools/i386/netboot/wd/stage1 +++ /dev/null diff --git a/tools/i386/netboot/wd/stage2 b/tools/i386/netboot/wd/stage2 Binary files differdeleted file mode 100644 index 64988d4eb..000000000 --- a/tools/i386/netboot/wd/stage2 +++ /dev/null diff --git a/tools/i386/sh b/tools/i386/sh Binary files differdeleted file mode 100755 index 084a97837..000000000 --- a/tools/i386/sh +++ /dev/null diff --git a/tools/ia64/e2fsck.shared b/tools/ia64/e2fsck.shared Binary files differdeleted file mode 100755 index 1ca570a7b..000000000 --- a/tools/ia64/e2fsck.shared +++ /dev/null diff --git a/tools/ia64/elilo.efi b/tools/ia64/elilo.efi Binary files differdeleted file mode 100755 index 39151b8e3..000000000 --- a/tools/ia64/elilo.efi +++ /dev/null diff --git a/tools/install-xml-file-list b/tools/install-xml-file-list new file mode 100755 index 000000000..64c70b9c6 --- /dev/null +++ b/tools/install-xml-file-list @@ -0,0 +1,396 @@ +#!/usr/bin/perl + +use FileHandle; +use MDK::Common; +use XML::Parser; +use Data::Dumper; +use File::Glob; +use Config; +use Cwd 'cwd'; + +my $want_sudo = $ARGV[0] eq '--sudo' && shift @ARGV; + +@ARGV == 2 or die "usage: install-xml-file-list [--sudo] <xml file> <destination>\n"; +my ($xml_file_list, $DEST) = @ARGV; + +my $sudo = ''; +if ($>) { + $sudo = "sudo" if $want_sudo; + $ENV{PATH} = "/sbin:/usr/sbin:$ENV{PATH}"; +} + +my $verbose; +#$verbose = 1; + +my $initial_dir = cwd(); +my $ARCH = arch() =~ /i.86/ ? 'i386' : arch(); +$ARCH =~ s/^(arm).*/$1/; +my $LIB = arch() =~ /x86_64/ ? "lib64" : "lib"; + +my $base_cpio_options = '-pumd --quiet'; + +my $problem; +my $tree = XML::Parser->new(Style => 'Tree')->parsefile($xml_file_list); + +my $main_node = decompose($tree); + +$main_node->{tag} eq 'list' or die "bad file $xml_file_list (main tag should be <list>)\n"; + +handle_nodes({}, $main_node); + +$problem and exit 1; + +install_needed_libraries(); + +final_cleanup(); + +sub error { + my ($err) = @_; + warn "FATAL: $err\n"; + $problem = 1; +} + +sub final_cleanup() { + #- cpio creates directory 700, that's not nice + system("find $DEST -type d -print0 | xargs -0 $sudo chmod 755"); +} + +sub handle_nodes { + my ($env, $e) = @_; + handle_node($env, decompose($_)) foreach @{$e->{l}}; +} +sub handle_node { + my ($env, $node) = @_; + + if (!$node->{tag} && $node->{text} !~ /\S/) { + } elsif (!$node->{tag}) { + install($env, $node->{text}); + } elsif ($node->{tag} eq 'if') { + my $cond = valid_cond($node->{attr}); + handle_nodes($env, $node) if $cond; + } elsif ($node->{tag} eq 'if-not') { + my $cond = valid_cond($node->{attr}); + handle_nodes($env, $node) if !$cond; + } elsif (member($node->{tag}, 'from', 'to', 'mode', 'filter')) { + handle_nodes(add_to_env($env, $node->{tag} => $node->{attr}), $node); + } else { + warn "expecting tag <from>, not <$node->{tag}>\n"; + } +} + +sub valid_cond { + my ($attr) = @_; + every { + if ($_ eq 'ARCH') { + $ARCH =~ /$attr->{$_}/; + } elsif ($_ eq 'set') { + $ENV{$attr->{$_}}; + } else { + die "<if>: unknown condition $_\n"; + } + } keys %$attr; +} + +sub add_to_env { + my ($env, $tag, $attr) = @_; + my %env = map_each { $::a => +{ %$::b } } %$env; + foreach (keys %$attr) { + !$env{$tag}{$_} or die qq(overriding attribute <$tag $_="$env{$tag}{$_}"> with $_="$attr->{$_}"\n); + $env{$tag}{$_} = $attr->{$_}; + } + \%env; +} + +sub group_by_n { + my ($n, $l) = @_; + my (@r, $subl); + my $i = 0; + foreach (@$l) { + if ($i % $n == 0) { + push @r, $subl = []; + } + push @$subl, $_; + $i++; + } + @r; +} + +sub identify_file { + my ($dev, $ino) = @_; + "$dev:$ino"; +} + +sub all_files_rec_ { + my ($d) = @_; + + $d, -d $d && ! -l $d ? map { all_files_rec_("$d/$_") } all($d) : (); +} + +sub expand_macros { + my ($f) = @_; + $f =~ s!\bLIB\b!$LIB!g; + $f =~ s!\bARCH\b!$ARCH!ge; + $f =~ s!\$\((\w+)\)!$ENV{$1} || die "$1 undefined\n"!ge; + $f; +} + +my %needed_libraries; +sub collect_needed_libraries { + my (@to_check) = @_; + while (@to_check) { + my $to_check = join(' ', @to_check); + my @l = `ldd $to_check 2>/dev/null` =~ m! => (/\S+)!g; + foreach (@l) { + if ($main_node->{attr}{'no-arch-libraries'}) { + #- replace /lib/tls or /lib/i686 with /lib + s!^(/lib(64)?/).*?/!$1! if arch() !~ /x86_64/; + } + } + @to_check = grep { !$needed_libraries{$_}++ } @l; + @to_check = (); + } +} +sub install_needed_libraries() { + copy_files('', $DEST, [ keys %needed_libraries ], '', '--dereference'); +} + +sub collect_needed_perl_files { + my ($local_rep, @scripts) = @_; + + my (%local, %global); + foreach my $script (@scripts) { + foreach (`strace -efile perl -cw -I$local_rep $script 2>&1`) { + my ($f) = /^open(?:at\([^,]*, |)"(.*?)",.*\)\s*=\s*\d+$/ or next; + if ($f =~ m!^\Q$local_rep\E/(.*)!) { + $local{$1} = 1; + } elsif (begins_with($f, '/dev/')) { + # skip + } elsif (begins_with($f, '/')) { + if ($main_node->{attr}{'no-arch-libraries'}) { + #- replace /lib/tls or /lib/i686 with /lib + $f =~ s!^(/lib(64)?/).*?/!$1! if arch() !~ /x86_64/; + } + $global{$f} = 1; + } + } + } + [ keys %local ], [ keys %global ]; +} + +sub copy_files { + my ($working_dir, $to_dir, $files, $b_flatten, @options) = @_; + + if ($b_flatten) { + mkdir_p($to_dir); + my $options = join(' ', '-r', @options); + foreach (group_by_n(20, $files)) { + warn "cp $options to_dir $to_dir from $working_dir: @$_\n" if $verbose; + system("cd $working_dir ; $sudo cp $options @$_ $to_dir"); + } + } else { + my $options = join(' ', $base_cpio_options, @options); + warn "cpio $options to_dir=$to_dir from=$working_dir: @$files\n" if $verbose; + open(my $F, "| cd $working_dir ; $sudo cpio $options $to_dir"); + print $F "$_\n" foreach @$files; + close($F) or die "cpio $to_dir failed\n"; + } +} + +sub install { + my ($env, $text) = @_; + + my $from_dir = expand_macros($env->{from}{dir}); + my $to_dir = $DEST . expand_macros($env->{to}{dir} || $env->{to}{flatten} && $from_dir || ''); + my $copy_mode = $env->{mode}{copy} || ''; + my $working_dir = '.'; + + my $expand = $env->{from}{expand} || ''; + + my $disallow_from_dir = sub { + !$from_dir or die "from dir not allowed with $expand binary\n"; + }; + + my $from_file = sub { + my ($rel, $b_full_glob, $b_recursive_dirs) = @_; + my $f = expand_macros($from_dir ? "$from_dir/$rel" : $rel); + my @l = $f; + chdir $working_dir; + if ($f =~ /\*/ || $b_full_glob) { + @l = File::Glob::bsd_glob($f); #- using bsd_glob because CORE::glob() splits on whitespace and we don't want this + if (@l == 0) { + error("no match for $f"); + } elsif (@l == 1 || $b_full_glob) { + } else { + error("multiple match for $f"); + @l = (); + } + } elsif (! -e $f) { + error("missing file $f ($rel) in $working_dir"); + @l = (); + } + if (@l == 1 && -d $l[0] && $b_recursive_dirs) { + @l = all_files_rec_($l[0]); + } + @l = grep { !m!/(\.svn|CVS)($|/)! } @l; + if (my $re = expand_macros($env->{from}{matching})) { + @l = grep { eval $re } @l; + } + + collect_needed_libraries(grep { -f $_ && -x $_ } @l); + + chdir $initial_dir; + @l; + }; + + my @text_l = $env->{from}{spaces_in_filename} ? $text =~ /^\s*(.*?)\s*$/ : split(' ', $text); + my @files; + if ($expand eq 'tar') { + foreach (@text_l) { + my ($tarball) = $from_file->($_) or next; + system('tar', 'xfj', $tarball, '-C', $to_dir); + } + # not filling @files, things are already done + + } elsif ($expand eq 'command') { + @files = chomp_(`$text`); + + } elsif ($expand eq 'glob') { + #- glob done in $from_file + @files = @text_l; + + } elsif ($expand eq 'binary') { + $disallow_from_dir->(); + my @PATH = qw(/usr/sbin /usr/bin /usr/X11R6/bin); + unshift(@PATH, "/bin") unless -l "/bin"; + unshift(@PATH, "/sbin") unless -l "/sbin"; + foreach my $name (map { expand_macros($_) } @text_l) { + my @l = grep { -x $_ } map { "$_/$name" } @PATH; + @l or error("can't find binary $name"), next; + if (@l > 1) { + my @m = grep { ! -l $_ } @l; + if (@m == 1) { + my $id = identify_file($m[0]); + push @files, grep { -l $_ && identify_file($_) eq $id } @l; + } + @l = @m if @m; + } + if (@l > 1) { + warn "many matches for binary $name: " . join(' ', @l) . ", choosing $l[0]\n"; + } + my $f = $l[0]; + while (1) { + push @files, $f; + $copy_mode ne 'dereference' or last; + my $l = readlink($f) or last; + if ($l =~ m!/! && $l !~ m!^\.\..*/s?bin/[^/]+$!) { + warn "keeping symlink $f -> $l as is\n"; + last; + } + $f = dirname($f) . '/' . $l; + } + } + $copy_mode ||= 'keep-links'; + $env->{filter}{command} ||= 'strip'; + + } elsif ($expand eq 'rpm') { + $disallow_from_dir->(); + foreach my $rpm (@text_l) { + my @l = chomp_(`rpm -ql $rpm`) or error("rpm $rpm must be installed"); + push @files, @l; + } + + } elsif ($expand eq 'perl-bin') { + $disallow_from_dir->(); + $from_dir = '/usr/LIB/perl5/vendor_perl/'; + @files = @text_l; + } elsif ($expand eq 'perl') { + $disallow_from_dir->(); + $from_dir = '/usr/share/perl5/vendor_perl/'; + @files = @text_l; + } elsif ($expand eq 'main-perl') { + $disallow_from_dir->(); + $from_dir = $Config{privlib}; + @files = @text_l; + } elsif ($expand eq 'main-perl-bin') { + $disallow_from_dir->(); + $from_dir = $Config{archlib}; + @files = @text_l; + } elsif ($expand =~ /collect-perl-files/) { + my (undef, $local, $to) = split(' ', $expand); + + @files = @text_l; + warn "collect-perl-files $local $to @files ($env->{filter}{command})\n"; + my ($local_perl_files, $global_perl_files) = collect_needed_perl_files($local, @files); + warn "collect-perl-files gave: ", join(' ', @$local_perl_files), "\n"; +# warn " and: ", join(' ', @$global_perl_files), "\n"; + copy_and_filter($local =~ m!/! ? $local : "$working_dir/$local", "$DEST$to", $local_perl_files, $env->{filter}, '', '--dereference'); + copy_and_filter('', $DEST, $global_perl_files, $env->{filter}, '', '--dereference'); + + } elsif ($expand) { + die "unknown expand method $expand\n"; + } else { + @files = @text_l; + + $env->{filter}{command} ||= 'strip' if $to_dir =~ m!/bin$!; + } + + if ($env->{to}{dir} && $from_dir) { + $working_dir = $from_dir; + undef $from_dir; + } + + my @all_files = map { $from_file->($_, $expand eq 'glob', $expand ne 'rpm') } @files; + + my @options = ( + if_($copy_mode ne 'keep-links', '--dereference'), + ); + if (@all_files) { + copy_and_filter($working_dir, $to_dir, \@all_files, $env->{filter}, $env->{to}{flatten}, @options); + } +} + +sub copy_and_filter { + my ($working_dir, $to_dir, $all_files, $filter, $flatten, @copy_options) = @_; + + copy_files($working_dir, $to_dir, $all_files, $flatten, @copy_options); + apply_filter($to_dir, $filter, $all_files, $flatten); +} + +sub apply_filter { + my ($to_dir, $filter, $all_files, $b_flatten) = @_; + + chdir $to_dir; + foreach (group_by_n(20, $all_files)) { + my @l = $b_flatten ? (map { basename($_) } @$_) : (map { "./$_" } @$_); + @l = grep { ! -d $_ } @l or next; + + if (my $subst = $filter->{subst}) { + warn "running substition $subst \n" if $verbose; + system('perl', '-pi', '-e', $subst, @l); + } + if (my $command = $filter->{command}) { + $command = $initial_dir . "/$command" if $command =~ m!^..?/!; + if ($command =~ /simplify-drakx-modules/) { + @l = grep { !/\.so($|\.)/ } @l or next; + } + my @options = ( + if_($command eq 'gzip', '-9f'), + if_($command eq 'strip', '2>/dev/null'), + ); + warn "running $command @options @l\n" if $verbose; + system(join(' ', $command, @options, @l)); + } + } + chdir $initial_dir; +} + +sub decompose { + my ($tree) = @_; + my ($tag, $val) = @$tree; + if ($tag eq '0') { + { text => $val }; + } else { + my ($attr, @l) = @$val; + { tag => $tag, attr => $attr, l => [ group_by2(@l) ] }; + } +} diff --git a/tools/mailchangelog.pl b/tools/mailchangelog.pl deleted file mode 100755 index 6e7793eb7..000000000 --- a/tools/mailchangelog.pl +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/perl - -open F, '|/usr/sbin/sendmail -oi -t'; - -chomp($ver = <STDIN>); - -print F -q(Subject: [DrakX] DrakX snapshot #), $ver, q( uploaded -From: DrakX Builder Robot <devel@mandrakesoft.com> -To: changelog@linux-mandrake.com -Reply-To: install@mandrakesoft.com - -); -print F foreach <STDIN>; diff --git a/tools/make_lang_png_transparent.c b/tools/make_lang_png_transparent.c new file mode 100644 index 000000000..9a037e864 --- /dev/null +++ b/tools/make_lang_png_transparent.c @@ -0,0 +1,167 @@ +/* + * Guillaume Cottenceau (gc at mandriva.com) + * + * Copyright 2002-2005 Mandriva + * + * This software may be freely redistributed under the terms of the GNU + * public license. + * + */ + +#include <unistd.h> +#include <stdio.h> +#include <string.h> +#include <stdarg.h> + +#define PNG_DEBUG 3 +#include <png.h> + +void abort_(const char * s, ...) +{ + va_list args; + va_start(args, s); + vfprintf(stderr, s, args); + fprintf(stderr, "\n"); + va_end(args); + abort(); +} + +int x, y; + +int width, height; +png_byte color_type; +png_byte bit_depth; + +png_structp png_ptr; +png_infop info_ptr; +int number_of_passes; +png_bytep * row_pointers; + +void read_png_file(char* file_name) +{ + char header[8]; // 8 is the maximum size that can be checked + + /* open file and test for it being a png */ + FILE *fp = fopen(file_name, "rb"); + if (!fp) + abort_("[read_png_file] File %s could not be opened for reading", file_name); + fread(header, 1, 8, fp); + if (png_sig_cmp(header, 0, 8)) + abort_("[read_png_file] File %s is not recognized as a PNG file", file_name); + + + /* initialize stuff */ + png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); + + if (!png_ptr) + abort_("[read_png_file] png_create_read_struct failed"); + + info_ptr = png_create_info_struct(png_ptr); + if (!info_ptr) + abort_("[read_png_file] png_create_info_struct failed"); + + if (setjmp(png_jmpbuf(png_ptr))) + abort_("[read_png_file] Error during init_io"); + + png_init_io(png_ptr, fp); + png_set_sig_bytes(png_ptr, 8); + + png_read_info(png_ptr, info_ptr); + + width = info_ptr->width; + height = info_ptr->height; + color_type = info_ptr->color_type; + bit_depth = info_ptr->bit_depth; + + number_of_passes = png_set_interlace_handling(png_ptr); + png_read_update_info(png_ptr, info_ptr); + + + /* read file */ + if (setjmp(png_jmpbuf(png_ptr))) + abort_("[read_png_file] Error during read_image"); + + row_pointers = (png_bytep*) malloc(sizeof(png_bytep) * height); + for (y=0; y<height; y++) + row_pointers[y] = (png_byte*) malloc(info_ptr->rowbytes); + + png_read_image(png_ptr, row_pointers); +} + + +void write_png_file(char* file_name) +{ + /* create file */ + FILE *fp = fopen(file_name, "wb"); + if (!fp) + abort_("[write_png_file] File %s could not be opened for writing", file_name); + + + /* initialize stuff */ + png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); + + if (!png_ptr) + abort_("[write_png_file] png_create_write_struct failed"); + + info_ptr = png_create_info_struct(png_ptr); + if (!info_ptr) + abort_("[write_png_file] png_create_info_struct failed"); + + if (setjmp(png_jmpbuf(png_ptr))) + abort_("[write_png_file] Error during init_io"); + + png_init_io(png_ptr, fp); + + + /* write header */ + if (setjmp(png_jmpbuf(png_ptr))) + abort_("[write_png_file] Error during writing header"); + + png_set_IHDR(png_ptr, info_ptr, width, height, + bit_depth, color_type, PNG_INTERLACE_NONE, + PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE); + + png_write_info(png_ptr, info_ptr); + + + /* write bytes */ + if (setjmp(png_jmpbuf(png_ptr))) + abort_("[write_png_file] Error during writing bytes"); + + png_write_image(png_ptr, row_pointers); + + + /* end write */ + if (setjmp(png_jmpbuf(png_ptr))) + abort_("[write_png_file] Error during end of write"); + + png_write_end(png_ptr, NULL); + +} + +void process_file(void) +{ + if (info_ptr->color_type != PNG_COLOR_TYPE_RGBA) + abort_("[process_file] color_type of input file must be PNG_COLOR_TYPE_RGBA (is %d)", info_ptr->color_type); + + for (y=0; y<height; y++) { + png_byte* row = row_pointers[y]; + for (x=0; x<width; x++) { + png_byte* ptr = &(row[x*4]); + ptr[3] = 255-ptr[0]; + ptr[0] = ptr[1] = ptr[2] = 0; + } + } + +} + + +int main(int argc, char **argv) +{ + if (argc != 3) + abort_("Usage: program_name <file_in> <file_out>"); + + read_png_file(argv[1]); + process_file(); + write_png_file(argv[2]); +} diff --git a/tools/make_mdkinst_stage2 b/tools/make_mdkinst_stage2 deleted file mode 100755 index 48182616a..000000000 --- a/tools/make_mdkinst_stage2 +++ /dev/null @@ -1,78 +0,0 @@ -#!/bin/sh - -[ $# != 2 ] && { - echo "usage: make_mdkinst_stage2 <live dir> <output image>" ; - echo " example: misc/make_mdkinst_stage2 Mandrake/mdkinst Mandrake/base/mdkinst_stage2" - exit -} - -TMPDIR=${TMPDIR=/tmp} -STAGE2TMP=$TMPDIR/stage2_tmp -MKE2FS="/sbin/mke2fs -q -m 0 -F -s 1" -MNTPOINT=$TMPDIR/stage2_img -REP4PMS=/usr/bin/perl-install -DEST=$1 -STAGE2=$2 - -testandset() { [ -x $1/packdrake ] && BUILD_ARCHIVE=$1/packdrake; } -testandset `pwd`/misc -testandset `pwd`/. -testandset /$DEST/../../misc -testandset `pwd`/$DEST/../../misc -[ -z "$BUILD_ARCHIVE" ] && { echo "can't find packdrake"; exit 1; } - -if [ $EUID != "0" ]; then - SUDO="sudo" - PATH="/sbin:/usr/sbin:$PATH" -fi - -$SUDO rm -rf $STAGE2TMP -install -d $STAGE2TMP -$SUDO cp -a $DEST/* $STAGE2TMP - -#mkdir -p $MNTPOINT 2>/dev/null -#for i in $MNTPOINT $STAGE2; do $SUDO umount $i 2>/dev/null ; done -#dd if=/dev/zero of=$STAGE2 bs=1k count=24000 -#$MKE2FS -N 1000 $STAGE2 -#$SUDO mount -t ext2 $STAGE2 $MNTPOINT -o loop -# hack to reduce the STAGE2 image (do not edit without modifying in DrakX) -# be sure to keep the biggest server -rm -f $STAGE2TMP/usr/X11R6/bin/XF86_{VGA16,3DLabs,TGA,S3} -rm -f `ls --sort=size $STAGE2TMP/lib/modules.cz-* | perl -ne 'print if $i++'` -rm -f $STAGE2TMP/usr/bin/{pv*,vg*,lv*} $STAGE2TMP/lib/liblvm* -rm -f $STAGE2TMP/usr/bin/{resize_reiserfs,fsck.jfs} -rm -f $STAGE2TMP/usr/X11R6/lib/X11/fonts/{12x13mdk,18x18mdk}.pcf* -rm -rf $STAGE2TMP{/usr/bin/brltty,/etc/brltty,/lib/brltty} -rm -rf $STAGE2TMP/usr/share/locale_special - -( # only keeping UTF-8 - cd $STAGE2TMP/usr/share/locale; - mv UTF-8 .. - rm -rf * - mv ../UTF-8 . -) -for i in /usr/share/keymaps /usr/share/xmodmap; do - name=`basename $i` - (cd $STAGE2TMP/$i ; ls * | $BUILD_ARCHIVE -b9s ../$name.cz2 400000) - rm -rf $STAGE2TMP/$i -done - -eval `find $STAGE2TMP | perl -MMDK::Common -lne '-l or $s += round_up(-s, 1024); $i++; END { print "size=",int($s/1024),";inodes=$i" }'`; - -mkdir -p $MNTPOINT 2>/dev/null -for i in $MNTPOINT $STAGE2; do $SUDO umount $i 2>/dev/null ; done -dd if=/dev/zero of=$STAGE2 bs=1k count=$[ $size + 1024 + 200 ] -$MKE2FS -N $[$inodes + 50] $STAGE2 -$SUDO mount -t ext2 $STAGE2 $MNTPOINT -o loop - -rmdir $MNTPOINT/lost+found -$SUDO cp -a $STAGE2TMP/* $MNTPOINT -$SUDO rm -rf $STAGE2TMP - -df $MNTPOINT -$SUDO umount $STAGE2 -rmdir $MNTPOINT - -echo bzipping $STAGE2 - -bzip2 -v -f -9 $STAGE2 diff --git a/tools/mdkinst_stage2_tool b/tools/mdkinst_stage2_tool new file mode 100755 index 000000000..0019ffc86 --- /dev/null +++ b/tools/mdkinst_stage2_tool @@ -0,0 +1,69 @@ +#!/bin/sh + +error() { + cat <<EOF; +usage: mdkinst_stage2_tool [--clean] [--compress | --uncompress] <stage2 dir> [<compressed file>] +EOF + exit 1 +} + +if [ "$1" = "--clean" ]; then + CLEAN=1 + shift +fi + +[ $# = 2 -o $# = 3 ] || error + +if [ "$1" = "--compress" -o "$1" == "--uncompress" ]; then + ACTION=$1 + shift + STAGE2_DIR="$1" + shift + LIVE_DIR="$STAGE2_DIR/live" + if [ -n "$1" ]; then + COMPRESSED_IMAGE=$1 + shift + else + COMPRESSED_IMAGE="$STAGE2_DIR/mdkinst.sqfs" + fi +else + error +fi + +if [ $ACTION = "--compress" ]; then + which mksquashfs >/dev/null 2>/dev/null || { echo "missing command mksquashfs (from squashfs-tools)"; exit 1; } + + [ -d "$LIVE_DIR" ] || error + echo "Creating $COMPRESSED_IMAGE from $LIVE_DIR" + rm -f $STAGE2_DIR/.room + if ! mksquashfs $LIVE_DIR $COMPRESSED_IMAGE -all-root -noappend >/dev/null; then + echo "mksquashfs failed" + exit 1 + fi + chmod 755 $COMPRESSED_IMAGE + echo foo > $STAGE2_DIR/.room + if [ -s $STAGE2_DIR/.room ]; then + rm -f $STAGE2_DIR/.room + [ -n "$CLEAN" ] && rm -rf $LIVE_DIR + else + echo "not enough space" + rm -f $COMPRESSED_IMAGE + exit 1 + fi +else + which unsquashfs >/dev/null 2>/dev/null || { echo "missing command unsquashfs (from squashfs-tools)"; exit 1; } + + [ -f "$COMPRESSED_IMAGE" ] || error + echo "Creating $LIVE_DIR from $COMPRESSED_IMAGE" + + if [ $EUID != "0" ]; then + SUDO="sudo" + PATH="/sbin:/usr/sbin:$PATH" + fi + + unsquashfs -dest $LIVE_DIR $COMPRESSED_IMAGE || { rm -rf $LIVE_DIR; exit 1; } + + [ -n "$CLEAN" ] && rm -f $COMPRESSED_IMAGE +fi + +exit 0 diff --git a/tools/mkhdlist b/tools/mkhdlist deleted file mode 100755 index 6ef783ca1..000000000 --- a/tools/mkhdlist +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh -# Regenerate hdlist, root_directory should be the binary -# root_directory where you find generally this structure : -# -# COPYING Mandrake/ RPM-GPG-KEYS VERSION dosutils/ images/ lnx4win/ -# misc/ - -if [ -z "$1" ];then - echo "Usage: $(basename $0) /path/to/root_directory/" - exit 1 -fi - -cd $1 -rm -rf /tmp/.build_hdlist/ -./misc/genhdlist_cz2 --noclean --distrib . -./misc/gendepslist2 -o Mandrake/base/depslist Mandrake/base/hdlist.cz2 diff --git a/tools/ntp_servers.pl b/tools/ntp_servers.pl index 62640557c..d0a4b6cc2 100644 --- a/tools/ntp_servers.pl +++ b/tools/ntp_servers.pl @@ -1,7 +1,7 @@ #!/usr/bin/perl -open F, "links -dump http://www.eecis.udel.edu/~mills/ntp/clock1.htm|"; -open G, "links -dump http://www.eecis.udel.edu/~mills/ntp/clock2.htm|"; +#open F, "/usr/bin/lynx -dump http://www.eecis.udel.edu/~mills/ntp/clock1a.html|"; +open(my $G, "/usr/bin/lynx -dump http://www.eecis.udel.edu/~mills/ntp/clock2a.html|"); # Chris Kloiber <ckloiber@redhat.com> writes: # > It's not considered polite to use the Stratum 1 servers for purposes that @@ -9,45 +9,50 @@ open G, "links -dump http://www.eecis.udel.edu/~mills/ntp/clock2.htm|"; # > the few nanoseconds difference. #parse() while <F>; -parse() while <G>; +parse($_) while <$G>; +my @all; +my ($l, $nb); sub parse { - /\0/ .. 1 or return; - if (/^ [\d\0]\d\./) { - push @all, { name => $name, indic => $indic, %l } if $name; - %l = (); + local ($_) = @_; + /Active Servers/ .. /Discontinued Service/ or return; + if (/^\s+\d+\. ([A-Z ]*[A-Z]);?\s+([.\w-]+)/) { + push @all, $l = { name => $2, indic => $1 }; $nb = 0; } else { s/^\s*//; s/\s*$//; - if ($nb == 2) { - s/US CA:/US CA/; - ($indic, $name) = /([A-Z ]*[A-Z])\s+([.\w-]+)/ or die "bad line $_"; + my ($field, $val) = /^(.*):\s*(.*)/; + if ($field =~ /policy/i) { + $field = "policy"; + $val = lc join(' ', split(' ', $val)); + $val =~ s/glad to receive a note//; + $val =~ s/(but )?please send (a )?message to notify//; + $val =~ s/an email note is appreciated//; + $val =~ s/please send a message with the//; + $val =~ s/no need to notify//; + $val =~ s/[(), .;]*$//; + $val = "open access" if $val eq "public"; + warn "$val ($all[-1]{name})\n" if $val ne 'open access'; + } elsif ($field =~ /^Contact|Synchroni[sz]ation|Location|Geographic\s+Coordinates|Service\s+Area|Note$/i) { } else { - s/^(.*):\s*/$field = $1; ''/e; - $field = lc $field; - if ($field =~ /policy/) { - $field = "policy"; - $_ = lc $_; - s/glad to receive a note//; - s/[(), ]*$//; - $_ = "open access" if $_ eq "public"; - } - $l{$field} .= ($l{$field} && ' ') . $_; +# warn "bad line ($field) $_\n"; + return; } + $l->{$field} .= ($l->{$field} && ' ') . $val; } $nb++; } use Data::Dumper; -#print Dumper(\@all); +#warn Dumper(\@all); foreach (grep { $_->{policy} eq 'open access' } @all) { - ($country, $state) = split ' ', $_->{indic}; + my ($country, $state) = split ' ', $_->{indic}; $country = ucfirst(lc $country_codes{$country}); $country .= " $state" if $state; - print "$country (", lc($_->{name}), ")\n"; + printf "\t'%s' => '%s',\n", lc($_->{name}), $country; } BEGIN { diff --git a/tools/oem-prepare b/tools/oem-prepare deleted file mode 100755 index e6c3b1458..000000000 --- a/tools/oem-prepare +++ /dev/null @@ -1,477 +0,0 @@ -#!/usr/bin/perl - -my ($mode, $dir, $reject_dir, $lang) = @ARGV; -$mode =~ s/^--(rebuild|clean)$/$1/ or die "mode should be --rebuild or --clean\n"; --e "$dir/Mandrake/base/hdlists" && -d $reject_dir or die "usage: oem-prepare <--rebuild|--clean> <top_dir> <reject_dir> <lang>\n"; - -#- detect language used and default options. -open F, "$dir/VERSION" or die "no installation found on $dir"; -while (<F>) { - /[\s-]fr/ and $lang = 'fr'; - /\[lang[=:]([^]]*)\]/ and $lang = $1; - /[\[\-]server[\]\-]/ and $options{server} = ''; -} -close F; - -my ($flang, $charset); -#- default language fall to english ? -foreach ($lang || 'en') { - /fr/ and ($lang, $flang, $charset) = ('fr', 'fr_FR@euro', 'iso-8859-15'); - /en/ and ($lang, $flang, $charset) = ('en', 'en_US', 'iso-8859-1'); - /de/ and ($lang, $flang, $charset) = ('de', 'de_DE@euro', 'iso-8859-15'); - /it/ and ($lang, $flang, $charset) = ('it', 'it_IT@euro', 'iso-8859-15'); - /es/ and ($lang, $flang, $charset) = ('es', 'es_ES@euro', 'iso-8859-15'); -} -print "Found lang $lang\n"; -foreach (keys %options) { - print "Using option [$_" . ($options{$_} && "=$options{$_}") . "]\n"; -} - - -my $packages = select_packages($dir, $lang); - -my @media; -open F, "$dir/Mandrake/base/hdlists"; -foreach (<F>) { - chomp; - s/\s*#.*$//; - /^\s*$/ and next; - m/^\s*(hdlist\S*\.cz2?)\s+(\S+)\s*(.*)$/ or die "invalid hdlist description \"$_\" in hdlists file"; - - push @media, { hdlist => $1, rpmsdir => $2, descr => $3 }; -} -close F; - - -#- keep in mind all the rpm files available (according to hdlists). -my (%rpms, %files); - -require packdrake; -foreach my $medium (@media) { - my $packer = new packdrake("$dir/Mandrake/base/$medium->{hdlist}"); - foreach (@{$packer->{files}}) { - $packer->{data}{$_}[0] eq 'f' or next; - my ($fullname, $file) = /([^:]*):(.*)/ ? ($1, "$2.rpm") : ($_, "$_.rpm"); - $files{$fullname} = $file; - $rpms{$file} = $medium->{rpmsdir}; - -e "$dir/$medium->{rpmsdir}/$file" and next; #- already exist in the right directory. - if (-e "$reject_dir/$file") { - $mode eq 'rebuild' and system "mv", "-f", "$reject_dir/$file", "$dir/$medium->{rpmsdir}/"; - next; - } - print STDERR "unable to find package $file listed in medium \"$medium->{descr}\"\n"; - } -} - -if ($mode eq 'clean') { - #- copy and install from each cd image. - foreach my $medium (@media) { - print "Examining packages from medium labeled \"$medium->{descr}\"\n"; - - foreach my $pkg (@{$packages->{depslist}}) { - $pkg->{closure} && !$pkg->{selected} or next; - my $file = "$dir/$medium->{rpmsdir}/" . $files{rpm_fullname($pkg)}; - if (-e $file) { - delete $rpms{$files{rpm_fullname($pkg)}} or next; - print " copying $file\n"; - delete $pkg->{closure}; - } - } - - if (my $pkg = pkgs::packageByName($packages, 'glibc')) { #- HACK FOR GLIBC - if ($pkg->{selected}) { - my $file = "$dir/$medium->{rpmsdir}/" . $files{rpm_fullname($pkg)}; - if (-e $file) { - delete $rpms{$files{rpm_fullname($pkg)}} or next; - print " installing $file\n"; - delete $pkg->{selected}; - } - } - } else { - die "no glibc package found"; - } - foreach my $pkg (@{$packages->{depslist}}) { - $pkg->{selected} or next; - my $file = "$dir/$medium->{rpmsdir}/" . $files{rpm_fullname($pkg)}; - if (-e $file) { - delete $rpms{$files{rpm_fullname($pkg)}} or next; - print " installing $file\n"; - delete $pkg->{selected}; - } - } - - scalar(grep { $_->{selected} || $_->{closure} } @{$packages->{depslist}}) == 0 and last; - } - - #- copy files. - #- at this point, everything left in %rpms has to be moved to $reject_dir. - foreach (keys %rpms) { - -e "$reject_dir/$_" and next; #- already cleaned. - -e "$dir/$rpms{$_}/$_" or print STDERR "file \"$_\" should be in [$dir/$rpms{$_}]\n", next; - system "mv", "-f", "$dir/$rpms{$_}/$_", $reject_dir; - } -} - -#- provide package fullname that have to be installed and copied. -sub select_packages { - my ($dir, $lang) = @_; - my $o = { packages => read_depslist("$dir/Mandrake/base/depslist.ordered") }; - - #- act as DrakX will do to select packages. - pkgs::read_rpmsrate($o->{packages}, install_any::getFile("Mandrake/base/rpmsrate") || die "unable to read rpmsrate"); - ($o->{compssUsers}, $o->{compssUsersSorted}, $o->{compssUsersIcons}, $o->{compssUsersDescr}) = - pkgs::readCompssUsers($o->{packages}, $o->{meta_class}); - eval { install_any::getFile("XXX") }; #- close out any still opened filehandle.. - - pkgs::selectPackage($o->{packages}, pkgs::packageByName($o->{packages}, 'basesystem') || die "no basesystem package found"); - #- by default, choose: - $o->{compssUsersChoice}{$_} = 1 foreach 'GNOME', 'KDE', 'CONFIG', 'X'; - $o->{compssUsersChoice}{$_} = 1 - foreach map { @{$o->{compssUsers}{$_}{flags}} } 'Workstation|Office Workstation', 'Workstation|Internet station'; - - if (exists $options{server}) { - foreach (qw(KDE ACCESSIBILITY PUBLISHING CUPS EDITORS TEXT_TOOLS COMMUNICATIONS TERMINALS - NETWORKING_FILE_TRANSFER NETWORKING_OTHER - NETWORKING_FILE_TRANSFER_SERVER NETWORKING_FIREWALLING_SERVER NETWORKING_LDAP_SERVER - NETWORKING_MAIL_SERVER NETWORKING_OTHER_SERVER - NETWORKING_REMOTE_ACCESS NETWORKING_REMOTE_ACCESS_SERVER NETWORKING_DNS NETWORKING_DNS_SERVER - NETWORKING_FILE NETWORKING_FILE_SERVER NETWORKING_WWW NETWORKING_WWW_SERVER - ARCHIVING DEVELOPMENT MONITORING FILE_TOOLS CONFIG BOOKS SYSTEM X DOCS)) { - $o->{compssUsersChoice}{$_} = 1; - } - #- additional packages to be selected for server, databases with MySQL (avoid rpmsrate modifications). - foreach (qw(MySQL-client MySQL-shared MySQL perl-Mysql)) { - my $pkg = pkgs::packageByName($o->{packages}, $_); - $pkg and pkgs::selectPackage($o->{packages}, $pkg); - } - } else { - $o->{compssUsersChoice}{$_} = 1 foreach map { @{$o->{compssUsers}{$_}} } @{$o->{compssUsersSorted}}; - $o->{compssUsersChoice}{$_} = 1 foreach qw(SYSTEM X DOCS); - @{$o->{compssUsersChoice}}{grep { /SERVER|DATABASES/ } keys %{$o->{compssUsersChoice}}} = (); - } - - my $lang_pkg = $lang && pkgs::packageByName($o->{packages}, "locales-$lang"); - if ($lang_pkg) { - pkgs::selectPackage($o->{packages}, $lang_pkg); - $o->{compssUsersChoice}{qq(LOCALES"$lang")} = 1; - $o->{compssUsersChoice}{qq(LOCALES"$flang")} = 1; - $o->{compssUsersChoice}{qq(CHARSET"$charset")} = 1; - } - - pkgs::setSelectedFromCompssList($o->{packages}, $o->{compssUsersChoice}, 4, 0); - #- save selected, but keep selected property. - foreach my $pkg (@{$o->{packages}{depslist}}) { - $pkg->{selected} and $pkg->{save_selected} = $pkg->{selected}; - } - - #- extend selection to closure now, make all selected as closure and restore selected after. - $o->{compssUsersChoice}{$_} = 1 foreach qw(BURNER DVD PCMCIA BIGMEM SMP 3D TV SCANNER PHOTO SOUND); - pkgs::setSelectedFromCompssList($o->{packages}, $o->{compssUsersChoice}, 4, 0); - $o->{compssUsersChoice}{$_} = 0 foreach qw(BURNER DVD PCMCIA BIGMEM SMP 3D TV SCANNER PHOTO SOUND); - #- INSTALL class need to be copied as closure (unless installed after). - #- but we have to remove kernel22 and kernel22-smp now obsolete for oem. - foreach (@{$o->{packages}{needToCopy}}) { - /^(kernel22.*|raidtools|lvm|reiserfsprogs|xfsprogs|jfsprogs|XFree86-(Mach8|Mach32|Mono|W32|3DLabs|P9000|8514|VGA16|I128|AGX))$/ and next; - my $pkg = pkgs::packageByName($o->{packages}, $_); - pkgs::selectPackage($o->{packages}, $pkg); - } - #- first select package that have to go to closure according to their names. - foreach my $pkg (@{$o->{packages}{depslist}}) { - $pkg->{name} =~ /kernel-(\d|smp|enterprise)/ and pkgs::selectPackage($o->{packages}, $pkg); - $pkg->{name} =~ /NVIDIA/ and pkgs::selectPackage($o->{packages}, $pkg); - } - foreach my $pkg (@{$o->{packages}{depslist}}) { - delete $pkg->{selected} && !$pkg->{save_selected} and $pkg->{closure} = 1; - $pkg->{save_selected} and $pkg->{selected} = $pkg->{save_selected}; - } - - #- package that have to selected here as a bonus for oem install. - foreach (qw(cups cups-drivers a2ps drakprofile draksync numlock icewm-light - Mesa Mesa-demos alsa alsa-utils curl - glibc vim-minimal kernel gcc-cpp - ), exists $options{server} ? qw(openldap-migration openldap-clients pam_ldap) : ()) { - my $pkg = pkgs::packageByName($o->{packages}, $_); - $pkg and pkgs::selectPackage($o->{packages}, $pkg); - } - - #- special packages that are to be move to closure always ... - foreach (qw(nfs-utils-client numlock usbd hotplug alsa alsa-utils - Aurora Aurora-Monitor-NewStyle-Categorizing-WsLib bootsplash)) { - my $pkg = pkgs::packageByName($o->{packages}, $_); - if ($pkg) { - pkgs::selectPackage($o->{packages}, $pkg); - $pkg->{closure} = 1; - delete $pkg->{selected}; - } - } - - #- special packages that are to be removed always... BEWARE THIS IS A HACK !!! -# foreach (qw(gmc gcc3.0 gcc3.0-c++ gcc3.0-cpp libstdc++3.0 libstdc++3.0-devel)) { -# my $pkg = pkgs::packageByName($o->{packages}, $_); -# if ($pkg) { -# delete $pkg->{closure}; -# delete $pkg->{selected}; -# } -# } - - $o->{packages}; -} - -sub chop_version { - ($_[0] =~ /^([^:\s]*)-[^:\-\s]+-[^:\-\s]+\.[^:\.\-\s]*(?::\S*)?/)[0] || die "unable to parse $_[0]"; -} -sub rpm_fullname { - ($_[0]{name} =~ /^([^:\s]*-[^:\-\s]+-[^:\-\s]+\.[^:\.\-\s]*)(?::\S*)?/)[0] || die "unable to parse $_[0]"; -} - -sub read_depslist { - my ($file) = @_; - my $packages = { depslist => [], names => {} }; - - #- read depslist.oredered file. - my $id = 0; - - open F, "$file" or die "unable to open ordered dependencies list file"; - while (<F>) { - my ($name, $size, @deps) = split; - push @{$packages->{depslist}}, { id => $id++, name => $name, size => $size, deps => \@deps }; - } - close F; - - foreach (@{$packages->{depslist}}) { - $packages->{names}{chop_version($_->{name})} = $_; - } - - print "read " . scalar(@{$packages->{depslist}}) . " package dependancies\n"; - $packages; -} - -#- compability method for the below ones, wrap DrakX code extracted. -package log; -sub l {} - -package detect_devices; -sub matching_desc { 1 } - -package install_any; -sub getFile { open FILE, "$dir/$_[0]" or return; \*FILE } - -package pkgs; -sub if_ { my $b = shift; $b or return (); wantarray ? @_ : $_[0] } -sub formatXiB { $_[0] } #- NOP -sub packageName { ::chop_version($_[0]{name}) } -sub packageFlagSelected { $_[0]{selected} } -sub packageSize { $_[0]{size} } -sub packageDepsId { @{$_[0]{deps}} } -sub packageRate { $_[0]{values}[0] } -sub packageRateRFlags { @{$_[0]{values}} } -sub packageSetRateRFlags { - my ($pkg, @rate_rflags) = @_; - $pkg->{values} = [ @rate_rflags ]; -} -sub packageByName { - my ($packages, $name) = @_; - $packages->{names}{$name}; -} -sub packageById { - my ($packages, $id) = @_; - $packages->{depslist}[$id]; -} -sub selectedSize { - my ($packages) = @_; - my $size = 0; - foreach (@{$packages->{depslist}}) { - $_->{selected} and $size += $_->{size}; - } - $size; -} -my @preferred = qw(perl-GTK postfix gcc gcc-cpp gcc-c++ proftpd ghostscript-X vim-minimal kernel db1 db2 ispell-en Bastille-Curses-module nautilus libxpm4); -sub selectPackage { - my ($packages, $pkg, $base, $otherOnly, $check_recursion) = @_; - - #- avoid infinite recursion (mainly against badly generated depslist.ordered). - $check_recursion ||= {}; exists $check_recursion->{$pkg->{name}} and return; $check_recursion->{$pkg->{name}} = undef; - - #- make sure base package are set even if already selected. - $base and $pkg->{base} = 1; - - #- select package and dependancies, otherOnly may be a reference - #- to a hash to indicate package that will strictly be selected - #- when value is true, may be selected when value is false (this - #- is only used for unselection, not selection) - unless ($pkg->{selected}) { - foreach (@{$pkg->{deps}}) { - my $preferred; - if (/\|/) { - #- choice deps should be reselected recursively as no - #- closure on them is computed, this code is exactly the - #- same as pixel's one. - my %preferred; @preferred{@preferred} = (); - foreach (split '\|') { - my $dep = $packages->{depslist}[$_] or next; - $preferred ||= $dep; - $dep->{selected} and $preferred = $dep, last; - exists $preferred{::chop_version($dep->{name})} and $preferred = $dep; - } - selectPackage($packages, $preferred, $base, $otherOnly, $check_recursion) if $preferred; - } else { - #- deps have been closed except for choices, so no need to - #- recursively apply selection, expand base on it. - my $dep = $packages->{depslist}[$_]; - $base and $dep->{base} = 1; - $otherOnly and !$dep->{selected} and $otherOnly->{::chop_version($dep->{name})} = 1; - $otherOnly or $dep->{selected} += 1; - } - } - } - $otherOnly and !$pkg->{selected} and $otherOnly->{::chop_version($pkg->{name})} = 1; - $otherOnly or $pkg->{selected} += 1; - 1; -} - -#- this code is extracted from DrakX and SHOULD NOT BE MODIFIED, wrapper method exists above to provide a good choice. -sub read_rpmsrate { - my ($packages, $f) = @_; - my $line_nb = 0; - my $fatal_error; - my (@l); - while (<$f>) { - $line_nb++; - /\t/ and die "tabulations not allowed at line $line_nb\n"; - s/#.*//; # comments - - my ($indent, $data) = /(\s*)(.*)/; - next if !$data; # skip empty lines - - @l = grep { $_->[0] < length $indent } @l; - - my @m = @l ? @{$l[$#l][1]} : (); - my ($t, $flag, @l2); - while ($data =~ - /^(( - [1-5] - | - (?: (?: !\s*)? [0-9A-Z_]+(?:".*?")?) - (?: \s*\|\|\s* (?: !\s*)? [0-9A-Z_]+(?:".*?")?)* - ) - (?:\s+|$) - )(.*)/x) { #@")) { - ($t, $flag, $data) = ($1,$2,$3); - while ($flag =~ s,^\s*(("[^"]*"|[^"\s]*)*)\s+,$1,) {} - my $ok = 0; - $flag = join('||', grep { - if (my ($inv, $p) = /^(!)?HW"(.*)"/) { - ($inv xor detect_devices::matching_desc($p)) and $ok = 1; - 0; - } else { - 1; - } - } split '\|\|', $flag); - push @m, $ok ? 'TRUE' : $flag || 'FALSE'; - push @l2, [ length $indent, [ @m ] ]; - $indent .= $t; - } - if ($data) { - # has packages on same line - my ($rate) = grep { /^\d$/ } @m or die sprintf qq(missing rate for "%s" at line %d (flags are %s)\n), $data, $line_nb, join('&&', @m); - foreach (split ' ', $data) { - if ($packages) { - my $p = packageByName($packages, $_) or next; - my @m2 = - map { if_($_ && packageName($_) =~ /locales-(.*)/, qq(LOCALES"$1")) } - map { packageById($packages, $_) } packageDepsId($p); - - my @m3 = ((grep { !/^\d$/ } @m), @m2); - if (@m3 >= 1 && $m3[0] eq 'INSTALL' || @m3 >=2 && $m3[1] eq 'INSTALL') { - push @{$packages->{needToCopy} ||= []}, $_; - next; #- don't need to put INSTALL flag for a package. - } - if (packageRate($p)) { - my ($rate2, @m4) = packageRateRFlags($p); - if (@m3 > 1 || @m4 > 1) { - log::l("can't handle complicate flags for packages appearing twice ($_)"); - $fatal_error++; - } - log::l("package $_ appearing twice with different rates ($rate != $rate2)") if $rate != $rate2; - packageSetRateRFlags($p, $rate, "$m3[0]||$m4[0]"); - } else { - packageSetRateRFlags($p, $rate, @m3); - } - } else { - print "$_ = ", join(" && ", @m), "\n"; - } - } - push @l, @l2; - } else { - push @l, [ $l2[0][0], $l2[$#l2][1] ]; - } - } - $fatal_error and die "$fatal_error fatal errors in rpmsrate"; -} - -sub readCompssUsers { - my ($packages, $meta_class) = @_; - my (%compssUsers, %compssUsersIcons, , %compssUsersDescr, @sorted, $l); - my (%compss); - - my $file = 'Mandrake/base/compssUsers'; - my $f = $meta_class && install_any::getFile("$file.$meta_class") || install_any::getFile($file) or die "can't find $file"; - local $_; - while (<$f>) { - /^\s*$/ || /^#/ and next; - s/#.*//; - - if (/^(\S.*)/) { - my ($icon, $descr); - /^(.*?)\s*\[icon=(.*?)\](.*)/ and $_ = "$1$3", $icon = $2; - /^(.*?)\s*\[descr=(.*?)\](.*)/ and $_ = "$1$3", $descr = $2; - $compssUsersIcons{$_} = $icon; - $compssUsersDescr{$_} = $descr; - push @sorted, $_; - $compssUsers{$_} = $l = []; - } elsif (/^\s+(.*?)\s*$/) { - push @$l, $1; - } - } - \%compssUsers, \@sorted, \%compssUsersIcons, \%compssUsersDescr; -} - -sub setSelectedFromCompssList { - my ($packages, $compssUsersChoice, $min_level, $max_size, $otherOnly) = @_; - $compssUsersChoice->{TRUE} = 1; #- ensure TRUE is set - my $nb = selectedSize($packages); - foreach my $p (sort { packageRate($b) <=> packageRate($a) } values %{$packages->{names}}) { - my ($rate, @flags) = packageRateRFlags($p); - next if - !$rate || $rate < $min_level || - grep { !grep { /^!(.*)/ ? !$compssUsersChoice->{$1} : $compssUsersChoice->{$_} } split('\|\|') } @flags; - - #- determine the packages that will be selected when - #- selecting $p. the packages are not selected. - my %newSelection; - selectPackage($packages, $p, 0, \%newSelection); - - #- this enable an incremental total size. - my $old_nb = $nb; - foreach (grep { $newSelection{$_} } keys %newSelection) { - $nb += packageSize($packages->{names}{$_}); - } - if ($max_size && $nb > $max_size) { - $nb = $old_nb; - $min_level = packageRate($p); - last; - } - - #- at this point the package can safely be selected. - if ($otherOnly) { - selectPackage($packages, $p, 0, $otherOnly); - } else { - selectPackage($packages, $p); - } - } - unless ($otherOnly) { - log::l("setSelectedFromCompssList: reached size ", formatXiB($nb), ", up to indice $min_level (less than ", formatXiB($max_size), ")"); - log::l("setSelectedFromCompssList: ", join(" ", sort map { packageName($_) } grep { packageFlagSelected($_) } @{$packages->{depslist}})); - } - $min_level; -} diff --git a/tools/patch_pcmcia_config.pl b/tools/patch_pcmcia_config.pl deleted file mode 100755 index 109cfcba7..000000000 --- a/tools/patch_pcmcia_config.pl +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/perl - -use MDK::Common; - -listlength(@ARGV) == 2 or die "usage: $0 /path/to/etc/pcmcia/config /path/to/modules.dep\n"; - -my ($pcmcia_config, $modules_dep) = @ARGV; - - -my @ignore_modules_in_deps = qw(pcmcia_core ds); - -my @conf_contents = cat_($pcmcia_config); -die "uhm, problem, <$pcmcia_config> seems short in lines\n" if listlength(@conf_contents) < 10; - -foreach (cat_($modules_dep)) { - /^(\S+): (.*)/ and $deps{$1} = [ split ' ', $2 ] or die "could not understand `$_' in <$modules_dep>\n"; -} - -foreach my $confline (@conf_contents) { - $confline =~ /class.*\s+module\s+(.*)/ or next; - my @modules = map { /"([^"]+)"(.*)/ && [ $1, $2 ] } split ',', $1; - $_->[0] =~ s|.*/([^/]+)$|$1|g foreach @modules; #- remove directories since we don't support that during install - my @deps = grep { !member($_, @ignore_modules_in_deps, map { $_->[0] } @modules) } map { @{$deps{$_->[0]}} } @modules; - my $new_modz = join ', ', (map { "\"$_\"" } @deps), (map { "\"$_->[0]\"$_->[1]" } @modules); - $confline =~ s/(class.*\s+module\s+).*/$1$new_modz/; -} - -output($pcmcia_config, @conf_contents); diff --git a/tools/ppc/README b/tools/ppc/README deleted file mode 100644 index fd1aaae03..000000000 --- a/tools/ppc/README +++ /dev/null @@ -1,39 +0,0 @@ -Mini-Howto on burning Mandrake PPC Bootable CD's for Apple G3/G4 systems -------------------------------------------------------------------------- -email: John Buswell <johnb@mandrakesoft.com> - -To create a disk image simply use the mkINSTALLCD script provided in this -directory. The path you provide the script should point to the root directory -for the CD. - -For example after you have built the gi install with /export, simply pass -/export to the script as the distribution path and a name for the image. -Once the image is built you can use hmount, humount, hdir, hcd and hattrib -to modify and inspect the image before you commit it to CD-R. - -Before you run the script make sure the CD version of iBoot is in the -iBoot directory below /export (eg. /export/iBoot), if you want to use some -other directory then simply modify the script. Beware, HFS is not case -sensitive, so if you already have an INSTALL file you cannot create install. - -Currently iBoot sports two trees, one for the install CD and another for -regular usage. These will be merged shortly and a simply #define can be used -in the Makefile to implement one or the other from a single binary. - -Enjoy!! - - -Addendum: 3/15/2001 Stew Benedict <sbenedict@mandrakesoft.com> --------------------------------------------------------------------------- - -A couple of changes. - -I've opted to standardize on yaboot, which is user configurable, so the script -is modified now to use yaboot. - -Secondly, since mkhybrid merged with mkisofs, the hybrid images it creates are -read-only, so one is unable to mount the image and bless the boot directory for -booting. Consequently, I've included the binary for mkhybrid-1.12b5.4, which -does work. - - diff --git a/tools/ppc/Xpmac b/tools/ppc/Xpmac Binary files differdeleted file mode 100755 index ec50e6aa0..000000000 --- a/tools/ppc/Xpmac +++ /dev/null diff --git a/tools/ppc/convert b/tools/ppc/convert deleted file mode 100755 index a2622c630..000000000 --- a/tools/ppc/convert +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -mv $1.orig $1.Unix -tr "\n" "\r" < $1.Unix > $1.MacOS -perl -e '@line = <>; $line = join("\r\n", split(/\n/, join("", @line))); print $line; print "\r\n";' < $1.Unix > $1.DOS diff --git a/tools/ppc/e2fsck.shared b/tools/ppc/e2fsck.shared Binary files differdeleted file mode 100644 index 32e506c31..000000000 --- a/tools/ppc/e2fsck.shared +++ /dev/null diff --git a/tools/ppc/magic b/tools/ppc/magic deleted file mode 100755 index 91f4193ea..000000000 --- a/tools/ppc/magic +++ /dev/null @@ -1,89 +0,0 @@ -# -# Example magic file for mkhybrid -# -# The "message" for the offset MUST be 4 characters for the CREATOR -# and 4 characters for the TYPE - white space is optional between them. -# Any other characters on this line are ignored. Continuation lines (starting -# with '>') are also ignored i.e. only the initial offset lines are used. -# -# The continuation lines are given here, but they do not need to exist. - -# -# James Pearson 20/5/98 - -# Modified by Christian Walther, 2003/01/17: -# changed gzip to StuffIt Expander -# added perl & shell script - -# off type test message - -# GIF -0 string GIF8 8BIM GIFf ->4 string 7a \b, version 8%s, ->4 string 9a \b, version 8%s, ->6 leshort >0 %hd x ->8 leshort >0 %hd, -#>10 byte &0x80 color mapped, -#>10 byte&0x07 =0x00 2 colors -#>10 byte&0x07 =0x01 4 colors -#>10 byte&0x07 =0x02 8 colors -#>10 byte&0x07 =0x03 16 colors -#>10 byte&0x07 =0x04 32 colors -#>10 byte&0x07 =0x05 64 colors -#>10 byte&0x07 =0x06 128 colors -#>10 byte&0x07 =0x07 256 colors - -# JPEG images -# -0 ubeshort 0xffd8 8BIM JPEG image data - -# StuffIt -# -0 string SIT! SIT!SIT! - -# standard unix compress -0 string \037\235 LZIV ZIVU ->2 byte&0x80 >0 block compressed ->2 byte&0x1f x %d bits - -# gzip (GNU zip, not to be confused with Info-ZIP or PKWARE zip archiver) -0 string \037\213 Gzip SITx gzip compressed data ->2 byte <8 \b, reserved method, ->2 byte 8 \b, deflated, ->3 byte &0x01 ASCII, ->3 byte &0x02 continuation, ->3 byte &0x04 extra field, ->3 byte &0x08 original filename, ->3 byte &0x10 comment, ->3 byte &0x20 encrypted, ->4 ledate x last modified: %s, ->8 byte 2 max compression, ->8 byte 4 max speed, ->9 byte =0x00 os: MS-DOS ->9 byte =0x01 os: Amiga ->9 byte =0x02 os: VMS ->9 byte =0x03 os: Unix ->9 byte =0x05 os: Atari ->9 byte =0x06 os: OS/2 ->9 byte =0x07 os: MacOS ->9 byte =0x0A os: Tops/20 ->9 byte =0x0B os: Win/32 - -# Postscript -0 string %! ASPSTEXT ->2 string PS-Adobe- conforming ->>11 string >\0 at level %.3s ->>>15 string EPS - type %s ->>>15 string Query - type %s ->>>15 string ExitServer - type %s -# Some PCs have the annoying habit of adding a ^D as a document separator -0 string \004%! ASPS TEXT PostScript document text ->3 string PS-Adobe- conforming ->>12 string >\0 at level %.3s ->>>16 string EPS - type %s ->>>16 string Query - type %s ->>>16 string ExitServer - type %s - -# scripts -0 string #!/usr/bin/perl McPL TEXT -0 string #!/bin/sh ttxt TEXT diff --git a/tools/ppc/mapping b/tools/ppc/mapping deleted file mode 100755 index 35d5d3d1c..000000000 --- a/tools/ppc/mapping +++ /dev/null @@ -1,29 +0,0 @@ -# Example filename mapping file -# Modified by Christian Walther, 2003/01/17 -# -# EXTN XLate CREATOR TYPE Comment -COPYING Ascii 'ttxt' 'ttro' "Text File" -CREDITS Ascii 'ttxt' 'ttro' "Text File" -README Ascii 'ttxt' 'ttro' "Text File" -RPM-PGP-KEY Ascii 'ttxt' 'ttro' "Text File" -VERSION Ascii 'ttxt' 'ttro' "Text File" -.gz Raw 'SITx' 'Gzip' "GZip Compressed File" -.sit Raw 'SIT!' 'SITD' "StuffIt Archive" -.hqx Ascii 'SITx' 'TEXT' "BinHex Encoded File" -.html Ascii 'MOSS' 'TEXT' "HTML File" -.htm Ascii 'MOSS' 'TEXT' "HTML File" -.gif Raw 'ogle' 'GIFf' "GIF Image" -.jpg Raw 'ogle' 'JPEG' "JPEG Image" -.tif Raw 'ogle' 'TIFF' "TIFF Image" -.bz2 Raw 'SITx' 'Bzp2' "BZip2 Compressed File" -.png Raw 'ogle' 'PNGf' "PNG Image" -.rpm Raw 'mRPM' 'RPMf' "RPM Software Package" -.pl Ascii 'McPL' 'TEXT' "Perl Script" -.pl Ascii 'McPL' 'TEXT' "Perl Module" -.doc Raw 'MSWD' 'WDBN' "Word file" -.mov Raw 'TVOD' 'MooV' "QuickTime Movie" -.txt Ascii 'ttxt' 'TEXT' "Text File" -.conf Ascii 'ttxt' 'TEXT' "config file" -.tbxi Raw 'chrp' 'tbxi' "Macintosh Toolbox ROM file" -.sea Raw 'aust' 'APPL' "Self Expanding Archive" -* Raw '????' '????' "Unknown" diff --git a/tools/ppc/mkINSTALLCD b/tools/ppc/mkINSTALLCD deleted file mode 100755 index 96741c605..000000000 --- a/tools/ppc/mkINSTALLCD +++ /dev/null @@ -1,80 +0,0 @@ -#!/bin/sh -# shell script to build a bootable hybrid PPC CD - -if ! rpm -q hfsutils ; then - echo 'You need hfsutils installed!!' - exit 1 -fi - -if [ -e $2 ] ; then - echo "Output image $2 exists, please delete" - echo "usage: $0 <CD tree> <output image name>" - exit 1 -fi - -if [ ! -d $1 ] ; then - echo "CD tree $1 is not a directory!" - echo "usage: $0 <CD tree> <output image name>" - exit 1 -fi - -# select the appropriate mkhybrid binary depending on if -# we are on x86 or ppc - -ARCH=`uname -m | sed -e 's/i.86/i386/' -e 's/sparc.*/sparc/'` - -if [ "$ARCH" == "ppc" ]; then - MKHYBRID=mkhybrid-1.12b5.4 -else - if [ "$ARCH" == "i386" ]; then - MKHYBRID=mkhybrid-1.12b5.4-x86 - else - echo "Sorry, no mkhybrid binary for $ARCH..." - exit - fi -fi - -#Change these when you build the CD.. -ApplicationID="Linux-Mandrake" -PublisherID="MandrakeSoft" -PreparerID="sbenedict@mandrakesoft.com" -SystemID=PPC -volid=ppc -hfsVolid=Linux-Mandrake -curPwd=`pwd` - -$curPwd/$MKHYBRID -part -hfs -r -l -J \ --A $ApplicationID \ --P $PublisherID \ --p $PreparerID \ --abstract "README" \ --sysid $SystemID \ --V $volid \ --volset "Update" \ --volset-size 2 \ --volset-seqno 1 \ --hfs-volid $hfsVolid \ --map $curPwd/mapping \ --magic $curPwd/magic \ --m "*.orig" \ --hide '*.MacOS' -hide '*.DOS' \ --hide-joliet '*.Unix' -hide-joliet '*.MacOS' \ --hide-hfs '*.Unix' -hide-hfs '*.DOS' \ --pad \ --o $2 \ -$1 - -#Bless boot folder so yaboot can boot -hmount $2 -hattrib -b boot -hcd boot -hattrib -t tbxi -c UNIX ofboot.b -hattrib -t boot -c UNIX yaboot -hattrib -t boot -c UNIX vmlinux -hattrib -t boot -c UNIX vmlinux-2.2 -hattrib -t conf -c UNIX yaboot.conf -hcd -hcd BootX -hrename Mandrake_Linux_Install.sit 'Mandrake Linux Install.sit' -hattrib -t APPL -c STi0 'Mandrake Linux Install.sit' -humount diff --git a/tools/ppc/mkhybrid-1.12b5.4 b/tools/ppc/mkhybrid-1.12b5.4 Binary files differdeleted file mode 100755 index 0e0901314..000000000 --- a/tools/ppc/mkhybrid-1.12b5.4 +++ /dev/null diff --git a/tools/ppc/mkhybrid-1.12b5.4-x86 b/tools/ppc/mkhybrid-1.12b5.4-x86 Binary files differdeleted file mode 100755 index fd5b21709..000000000 --- a/tools/ppc/mkhybrid-1.12b5.4-x86 +++ /dev/null diff --git a/tools/ppc/yaboot b/tools/ppc/yaboot Binary files differdeleted file mode 100644 index 72b19b911..000000000 --- a/tools/ppc/yaboot +++ /dev/null diff --git a/tools/serial_probe/.cvsignore b/tools/serial_probe/.cvsignore deleted file mode 100644 index e8e3e2d94..000000000 --- a/tools/serial_probe/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -serial_probe diff --git a/tools/serial_probe/Makefile b/tools/serial_probe/Makefile index 8e8590d62..86deb49f9 100644 --- a/tools/serial_probe/Makefile +++ b/tools/serial_probe/Makefile @@ -5,5 +5,9 @@ GOAL = serial_probe $(GOAL): $(OFILES) +serial.o: serial.c serial.h device.h kudzu.h +serial_probe.o: serial_probe.c serial.h device.h +serial_probe: serial_probe.o + clean: rm -f $(GOAL) $(OFILES) *~ diff --git a/tools/serial_probe/device.h b/tools/serial_probe/device.h index fa5f8183e..58d1414a0 100644 --- a/tools/serial_probe/device.h +++ b/tools/serial_probe/device.h @@ -1,5 +1,4 @@ - -/* Copyright 1999 Red Hat, Inc. +/* Copyright 1999-2003 Red Hat, Inc. * * This software may be freely redistributed under the terms of the GNU * public license. @@ -18,30 +17,56 @@ enum deviceClass { /* device classes... this is somewhat ad-hoc */ - CLASS_UNSPEC, CLASS_OTHER, CLASS_NETWORK, CLASS_SCSI, CLASS_VIDEO, - CLASS_AUDIO, CLASS_MOUSE, CLASS_MODEM, CLASS_CDROM, CLASS_TAPE, - CLASS_FLOPPY, CLASS_SCANNER, CLASS_HD, CLASS_RAID, CLASS_PRINTER, - CLASS_CAPTURE, CLASS_KEYBOARD, CLASS_PCMCIA + CLASS_UNSPEC = ~0, + CLASS_OTHER = (1 << 0), + CLASS_NETWORK = (1 << 1), + CLASS_SCSI = (1 << 2), + CLASS_MOUSE = (1 << 3), + CLASS_AUDIO = (1 << 4), + CLASS_CDROM = (1 << 5), + CLASS_MODEM = (1 << 6), + CLASS_VIDEO = (1 << 7), + CLASS_TAPE = (1 << 8), + CLASS_FLOPPY = (1 << 9), + CLASS_SCANNER = (1 << 10), + CLASS_HD = (1 << 11), + CLASS_RAID = (1 << 12), + CLASS_PRINTER = (1 << 13), + CLASS_CAPTURE = (1 << 14), + CLASS_KEYBOARD = (1 << 15), + CLASS_MONITOR = (1 << 16), + CLASS_USB = (1 << 17), + CLASS_SOCKET = (1 << 18), + CLASS_FIREWIRE = (1 << 19), + CLASS_IDE = (1 << 20) }; +/* Update this if needed */ +#define CLASS_LAST CLASS_IDE + enum deviceBus { /* 'bus' that a device is attached to... this is also ad-hoc */ /* BUS_SBUS is sort of a misnomer - it's more or less Sun */ /* OpenPROM probing of all various associated non-PCI buses */ - BUS_UNSPEC = 0, + BUS_UNSPEC = ~0, BUS_OTHER = (1 << 0), BUS_PCI = (1 << 1), BUS_SBUS = (1 << 2), - BUS_PSAUX = (1 << 3), - BUS_SERIAL = (1 << 4), + BUS_SERIAL = (1 << 3), + BUS_PSAUX = (1 << 4), BUS_PARALLEL = (1 << 5), BUS_SCSI = (1 << 6), BUS_IDE = (1 << 7), /* Again, misnomer */ BUS_KEYBOARD = (1 << 8), -#ifdef _i_wanna_build_this_crap_ - BUS_ISAPNP = (1 << 9), -#endif + BUS_DDC = (1 << 9), + BUS_USB = (1 << 10), + BUS_ISAPNP = (1 << 11), + BUS_MISC = (1 << 12), + BUS_FIREWIRE = (1 << 13), + BUS_PCMCIA = (1 << 14), + BUS_ADB = (1 << 15), + BUS_MACIO = (1 << 16) }; struct device { @@ -50,7 +75,7 @@ struct device { struct device *next; /* Used for ordering, and for aliasing (modem0, modem1, etc.) */ int index; - enum deviceClass class; /* type */ + enum deviceClass type; /* type */ enum deviceBus bus; /* bus it's attached to */ char * device; /* device file associated with it */ char * driver; /* driver to load, if any */ @@ -76,5 +101,4 @@ struct device *readDevice(FILE *file); /* Stop at first device found */ #define PROBE_ONE (1<<2) - #endif diff --git a/tools/serial_probe/kudzu.h b/tools/serial_probe/kudzu.h new file mode 100644 index 000000000..f96565cca --- /dev/null +++ b/tools/serial_probe/kudzu.h @@ -0,0 +1,26 @@ +/* Copyright 1999-2003 Red Hat, Inc. + * + * This software may be freely redistributed under the terms of the GNU + * public license. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef _KUDZU_H_ +#define _KUDZU_H_ + +/* kudzu: it grows on you */ + +/* level of debugging output */ +#undef DEBUG_LEVEL + +#ifdef DEBUG_LEVEL +#define DEBUG(s...) fprintf(stderr,s) +#else +#define DEBUG(s...) ; +#endif + +#endif diff --git a/tools/serial_probe/serial.c b/tools/serial_probe/serial.c index 14b315817..5159c3dae 100644 --- a/tools/serial_probe/serial.c +++ b/tools/serial_probe/serial.c @@ -1,6 +1,4 @@ -/* probe serial port for PnP/Legacy devices - * - * Copyright 1999 Red Hat, Inc. +/* Copyright 1999-2003 Red Hat, Inc. * * This software may be freely redistributed under the terms of the GNU * public license. @@ -9,6 +7,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * + * probe serial port for PnP/Legacy devices */ @@ -26,9 +25,13 @@ #include <sys/types.h> #include <sys/stat.h> #include <sys/ioctl.h> +#include <sys/sysmacros.h> +#include <asm/types.h> #include <linux/serial.h> + #include "serial.h" +#include "kudzu.h" /* character strings ARE null-terminated in the following structure */ /* these elements are marked with a (string) in the comment */ @@ -76,10 +79,6 @@ struct pnp_com_id { #define PNP_COM_NOEXIST 8 /* no device seen */ #define PNP_COM_PNPDEV 512 /* its a PNP device */ -/* level of debugging output */ -/* current any value > 0 dumps all available debugging output */ -static int debug_level=0; - static void serialFreeDevice(struct serialDevice *dev) { if (dev->pnpmfr) free(dev->pnpmfr); if (dev->pnpmodel) free(dev->pnpmodel); @@ -90,111 +89,74 @@ static void serialFreeDevice(struct serialDevice *dev) { static void serialWriteDevice(FILE *file, struct serialDevice *dev) { - writeDevice(file, (struct device *) dev); - if (dev->pnpmfr) - fprintf(file,"pnpmfr: %s\n",dev->pnpmfr); - if (dev->pnpmodel) - fprintf(file,"pnpmodel: %s\n",dev->pnpmodel); - if (dev->pnpcompat) - fprintf(file,"pnpcompat: %s\n",dev->pnpcompat); - if (dev->pnpdesc) - fprintf(file,"pnpdesc: %s\n",dev->pnpdesc); + writeDevice(file, (struct device *) dev); + if (dev->pnpmfr) + fprintf(file,"pnpmfr: %s\n",dev->pnpmfr); + if (dev->pnpmodel) + fprintf(file,"pnpmodel: %s\n",dev->pnpmodel); + if (dev->pnpcompat) + fprintf(file,"pnpcompat: %s\n",dev->pnpcompat); + if (dev->pnpdesc) + fprintf(file,"pnpdesc: %s\n",dev->pnpdesc); } static int serialCompareDevice( struct serialDevice *dev1, struct serialDevice *dev2) { - int x; - - x = compareDevice((struct device *)dev1, (struct device *)dev2); - if (x && x!=2) return x; - if (dev1->pnpmfr && dev2->pnpmfr && strcmp(dev1->pnpmfr,dev2->pnpmfr)) - return 1; - if ((!dev1->pnpmfr || !dev2->pnpmfr) && (dev1->pnpmfr != dev2->pnpmfr)) - return 1; - if (dev1->pnpmodel && dev2->pnpmodel && strcmp(dev1->pnpmodel,dev2->pnpmodel)) - return 1; - if ((!dev1->pnpmodel || !dev2->pnpmodel) && (dev1->pnpmodel != dev2->pnpmodel)) - return 1; - if (dev1->pnpcompat && dev2->pnpcompat && strcmp(dev1->pnpcompat,dev2->pnpcompat)) - return 1; - if ((!dev1->pnpcompat || !dev2->pnpcompat) && (dev1->pnpcompat != dev2->pnpcompat)) - return 1; - if (dev1->pnpdesc && dev2->pnpdesc && strcmp(dev1->pnpdesc,dev2->pnpdesc)) - return 1; - if ((!dev1->pnpdesc || !dev2->pnpdesc) && (dev1->pnpdesc != dev2->pnpdesc)) - return 1; - return x; -} - - -struct serialDevice * serialNewDevice(struct serialDevice *dev) { - struct serialDevice *ret; - - ret = malloc(sizeof(struct serialDevice)); - memset(ret,'\0',sizeof(struct serialDevice)); - ret=(struct serialDevice *)newDevice((struct device *)dev,(struct device *)ret); - ret->bus = BUS_SERIAL; - ret->newDevice = serialNewDevice; - ret->freeDevice = serialFreeDevice; - ret->writeDevice = serialWriteDevice; - ret->compareDevice = serialCompareDevice; - if (dev && dev->bus == BUS_SERIAL) { - if (dev->pnpmfr) - ret->pnpmfr=strdup(dev->pnpmfr); - if (dev->pnpmodel) - ret->pnpmodel=strdup(dev->pnpmodel); - if (dev->pnpcompat) - ret->pnpcompat=strdup(dev->pnpcompat); - if (dev->pnpdesc) - ret->pnpdesc=strdup(dev->pnpdesc); - } - return ret; -} - -/* UNUSED */ -void print_status_lines( int fd ) { - int modem_lines; - - ioctl(fd, TIOCMGET, &modem_lines); - - printf("DTR : %s\n",(modem_lines & TIOCM_DTR ? "On" : "Off")); - printf("RTS : %s\n",(modem_lines & TIOCM_RTS ? "On" : "Off")); - printf("CTS : %s\n",(modem_lines & TIOCM_CTS ? "On" : "Off")); - printf("DSR : %s\n",(modem_lines & TIOCM_DSR ? "On" : "Off")); - printf("CD : %s\n",(modem_lines & TIOCM_CD ? "On" : "Off")); - printf("RI : %s\n",(modem_lines & TIOCM_RI ? "On" : "Off")); + int x; + x = compareDevice((struct device *)dev1, (struct device *)dev2); + if (x && x!=2) return x; + if (dev1->pnpmfr && dev2->pnpmfr && strcmp(dev1->pnpmfr,dev2->pnpmfr)) + return 1; + if ((!dev1->pnpmfr || !dev2->pnpmfr) && (dev1->pnpmfr != dev2->pnpmfr)) + return 1; + if (dev1->pnpmodel && dev2->pnpmodel && strcmp(dev1->pnpmodel,dev2->pnpmodel)) + return 1; + if ((!dev1->pnpmodel || !dev2->pnpmodel) && (dev1->pnpmodel != dev2->pnpmodel)) + return 1; + if (dev1->pnpcompat && dev2->pnpcompat && strcmp(dev1->pnpcompat,dev2->pnpcompat)) + return 1; + if ((!dev1->pnpcompat || !dev2->pnpcompat) && (dev1->pnpcompat != dev2->pnpcompat)) + return 1; + if (dev1->pnpdesc && dev2->pnpdesc && strcmp(dev1->pnpdesc,dev2->pnpdesc)) + return 1; + if ((!dev1->pnpdesc || !dev2->pnpdesc) && (dev1->pnpdesc != dev2->pnpdesc)) + return 1; + return x; } -/* UNUSED except in debug */ -/* outputs data in a hex table, 8 values per row */ -void print_hex_data( unsigned char *data, int len ) { - int i, j, pos; - - if (len == 0) { - printf("No data to print.\n"); - return; - } +struct serialDevice * serialNewDevice(struct serialDevice *dev) { + struct serialDevice *ret; - pos = 0; - for (i=0; i< len; i+=8) { - printf("0x%.4x ", i); - for (j=i; j < len && j < i+8; j++) { - printf("0x%.2x ",data[pos++]); - } - printf("\n"); - } + ret = malloc(sizeof(struct serialDevice)); + memset(ret,'\0',sizeof(struct serialDevice)); + ret=(struct serialDevice *)newDevice((struct device *)dev,(struct device *)ret); + ret->bus = BUS_SERIAL; + ret->newDevice = serialNewDevice; + ret->freeDevice = serialFreeDevice; + ret->writeDevice = serialWriteDevice; + ret->compareDevice = serialCompareDevice; + if (dev && dev->bus == BUS_SERIAL) { + if (dev->pnpmfr) + ret->pnpmfr=strdup(dev->pnpmfr); + if (dev->pnpmodel) + ret->pnpmodel=strdup(dev->pnpmodel); + if (dev->pnpcompat) + ret->pnpcompat=strdup(dev->pnpcompat); + if (dev->pnpdesc) + ret->pnpdesc=strdup(dev->pnpdesc); + } + return ret; } - /* * wait_input - wait until there is data available on fd, * for the length of time specified by *timo (indefinite * if timo is NULL). */ -int wait_for_input (int fd, struct timeval *timo) { +static int wait_for_input (int fd, struct timeval *timo) { fd_set ready; int n; @@ -205,72 +167,31 @@ int wait_for_input (int fd, struct timeval *timo) { return n; } -/* UNUSED */ -/* read characters into the buffer buf, until one of: */ -/* char_timeout expired before next character arrives */ -/* total_timeout expires */ -/* maxlen characters are retrieved */ -/* */ -/* returns < 0 if it fails */ -/* otherwise the # of characters received is returned */ -/* char_timeout is in microseconds (millionths of a sec) */ -/* total_timeout is in seconds */ -int timed_serial_read(int fd, int char_timeout, int total_timeout, - unsigned char *buf, int maxlen ) { - - int done, pos, starttime, temp; - struct timeval timo; - unsigned char intbuf[2]; - - /* start reading */ - done = 0; - pos = 0; - starttime=time(NULL); - memset(buf, 0, maxlen); - while (!done) { - timo.tv_sec=0; - timo.tv_usec=char_timeout; - if (wait_for_input(fd, &timo) > 0) { - temp = read( fd, intbuf, 1 ); - if (temp < 0) { - if (errno != EAGAIN) - return -1; - } else { - buf[pos++] = intbuf[0]; - buf[pos] = 0; - } - } else - done = 1; - - /* shouldnt run more than 5 seconds */ - if (time(NULL)-starttime > total_timeout ) - done = 1; - - if (pos > maxlen) - done = 1; - } - return pos; -} - - -int open_serial_port( char *port ) { +static int open_serial_port( char *port ) { int fd; + DEBUG("opening serial port %s...", port); + fd = open( port, O_RDWR | O_NONBLOCK); - if (fd < 0) + if (fd < 0) { + DEBUG("failed.\n"); return -1; - + } else { + DEBUG("successful.\n"); + } + /* reset file so it is no longer in non-blocking mode */ if (fcntl(fd, F_SETFL, 0) < 0) { close(fd); + DEBUG("Failed to set port to non-blocking mode\n"); return -1; } - + return fd; } /* <0 means ioctl error occurred */ -int get_serial_lines( int fd ) { +static int get_serial_lines( int fd ) { int modem_lines; ioctl(fd, TIOCMGET, &modem_lines); @@ -278,13 +199,15 @@ int get_serial_lines( int fd ) { } /* <0 means ioctl error occurred */ -int set_serial_lines( int fd, int modem_lines ) { +static int set_serial_lines( int fd, int modem_lines ) { return ioctl(fd, TIOCMSET, &modem_lines); } /* set serial port to 1200 baud, 'nbits' bits, 1 stop, no parity */ -int setup_serial_port( int fd, int nbits, struct termios *attr ) { - +static int setup_serial_port( int fd, int nbits, struct termios *attr ) { + + DEBUG("setting up serial port\n"); + attr->c_iflag = IGNBRK | IGNPAR; attr->c_cflag = 0; attr->c_cflag &= ~(CSIZE | CSTOPB | PARENB | PARODD | PARENB); @@ -299,8 +222,10 @@ int setup_serial_port( int fd, int nbits, struct termios *attr ) { attr->c_cc[VMIN] = 1; attr->c_cc[VTIME] = 5; - cfsetospeed( attr, B1200); - cfsetispeed( attr, B1200); + if (cfsetospeed( attr, B1200)) + return -1; + if (cfsetispeed( attr, B1200)) + return -1; return tcsetattr(fd, TCSANOW, attr); } @@ -309,19 +234,19 @@ int setup_serial_port( int fd, int nbits, struct termios *attr ) { * to respond to PnP probes after they've been opened by gpm or XFree. */ -int init_port(int fd) { - struct termios attr; - - if (tcgetattr(fd,&attr)) - return 1; - - cfsetospeed(&attr, B2400); - cfsetispeed(&attr, B2400); - attr.c_iflag = IXON | ICRNL; - attr.c_cflag = CLOCAL | HUPCL | CREAD | B9600 | CS8; - attr.c_oflag = 0; - attr.c_lflag = 0; - return tcsetattr(fd, TCSANOW, &attr); +static int init_port(int fd) { + struct termios attr; + + if (tcgetattr(fd,&attr)) + return 1; + + cfsetospeed(&attr, B2400); + cfsetispeed(&attr, B2400); + attr.c_iflag = IXON | ICRNL; + attr.c_cflag = CLOCAL | HUPCL | CREAD | B9600 | CS8; + attr.c_oflag = 0; + attr.c_lflag = 0; + return tcsetattr(fd, TCSANOW, &attr); } @@ -331,21 +256,23 @@ int init_port(int fd) { /* */ /* PNP_COM_FATAL - error, errno has reason */ /* PNP_COM_OK - probe initiated successfully */ -/* PNP_COM_FAIL - DSR never came on - try alterntives */ -/* means (ATI9?) to get PnP string */ -int init_pnp_com_seq1( int fd ) { +static int init_pnp_com_seq1( int fd ) { int modem_lines; int temp; int dsr_status; int rc = PNP_COM_OK; struct termios portattr; + DEBUG("initializing 1st PNP sequence\n"); if (init_port(fd)) - return PNP_COM_FATAL; + return PNP_COM_FATAL; modem_lines = get_serial_lines(fd); - /* turn off RTS */ + /* COM port initialization, check for device enumerate */ + + /* turn on DTR, turn off RTS */ + modem_lines |= TIOCM_DTR; modem_lines &= ~TIOCM_RTS; set_serial_lines(fd, modem_lines); @@ -356,18 +283,15 @@ int init_pnp_com_seq1( int fd ) { /* see if we got DSR coming up */ if (!dsr_status) { - /* turn DTR and RTS back on and try alternative methods */ - modem_lines |= TIOCM_DTR | TIOCM_RTS; - set_serial_lines(fd, modem_lines); - rc = PNP_COM_OK; + DEBUG("Device did not set DSR\n"); } /* COM port Setup, 1st phase */ - /* now we set port to be 1200 baud, 7 bits, no parity, 1 stop bit */ temp = tcgetattr(fd, &portattr); if (temp < 0) return PNP_COM_FATAL; - /* goto 1200 baud, etc etc as PnP requires */ + + /* now we set port to be 1200 baud, 7 bits, no parity, 1 stop bit */ temp = setup_serial_port( fd, 7, &portattr ); if (temp < 0) return PNP_COM_FATAL; @@ -382,16 +306,43 @@ int init_pnp_com_seq1( int fd ) { set_serial_lines(fd, modem_lines); usleep(200000); - /* now entering next phase */ + /* Wait for response, 1st phase */ modem_lines |= TIOCM_RTS; set_serial_lines(fd, modem_lines); - usleep(200000); + /* usleep(200000); => AQ: not valid as we should look to receive data during this time!! */ return rc; } /* Request for PnP info from serial device */ +/* See page 6 of the pnpcom doc from Microsoft */ +/* Always returns PNP_COM_OK */ +static int init_pnp_com_seq2( int fd ) { + int modem_lines; + int rc = PNP_COM_OK; + + DEBUG("initializing 2nd PNP sequence\n"); + + modem_lines = get_serial_lines(fd); + + /* COM port setup, 2nd phase */ + /* turn off DTR and RTS */ + modem_lines &= ~(TIOCM_DTR | TIOCM_RTS); + set_serial_lines(fd, modem_lines); + usleep(200000); + + /* wait for response, 2nd phase */ + /* turn on DTR and RTS */ + modem_lines |= (TIOCM_DTR | TIOCM_RTS); + set_serial_lines(fd, modem_lines); + /* usleep(200000); => AQ: not valid as we should look to receive data during this time!! */ + + return rc; +} + + +/* Request for PnP info from serial modem device */ /* Uses ATI9 code, may not do anything but return 'ERROR' */ /* Return code tells us what happened */ /* */ @@ -399,7 +350,7 @@ int init_pnp_com_seq1( int fd ) { /* PNP_COM_OK - probe initiated successfully */ /* PNP_COM_FAIL - DSR never came on - try alterntives */ /* means (ATI9?) to get PnP string */ -int init_pnp_com_ati9( int fd ) { +static int init_pnp_com_ati9( int fd ) { int modem_lines; int temp; int done; @@ -409,6 +360,7 @@ int init_pnp_com_ati9( int fd ) { struct timeval timo; struct termios portattr; + DEBUG("Querying ATI9 info from modem\n"); modem_lines = get_serial_lines(fd); /* turn off RTS */ @@ -441,8 +393,7 @@ int init_pnp_com_ati9( int fd ) { usleep(200000); /* send the 'AT' command */ - if (debug_level > 0) - printf("Sending ATI9 command to modem\n"); + DEBUG("Sending ATI9 command to modem\n"); write(fd, "ATI9\r", 5); @@ -476,8 +427,7 @@ int init_pnp_com_ati9( int fd ) { if (strstr(resp, "ATI9\r")) done = 1; - if (debug_level > 0) - printf("ATI9 probe ->%d \"%s\"\n",respindex, resp); + DEBUG("ATI9 probe ->%d \"%s\"\n",respindex, resp); } /* see if we saw the 'OK' response */ @@ -501,7 +451,7 @@ int init_pnp_com_ati9( int fd ) { /* PNP_COM_OK - probe saw 'M' */ /* PNP_COM_FAIL - Never saw the 'M' response */ -int find_legacy_mouse( int fd ) { +static int find_legacy_mouse( int fd ) { int modem_lines; int temp; int done; @@ -510,6 +460,8 @@ int find_legacy_mouse( int fd ) { struct timeval timo; struct termios portattr; + DEBUG("looking for a legacy mouse\n"); + /* now we set port to be 1200 baud, 7 bits, no parity, 1 stop bit */ temp = tcgetattr(fd, &portattr); if (temp < 0) @@ -552,9 +504,10 @@ int find_legacy_mouse( int fd ) { if (time(NULL)-starttime > 2 ) done = 1; } - if (*resp == 'M') + if (*resp == 'M') { + DEBUG("Found legacy mouse\n"); return PNP_COM_OK; - else + } else return PNP_COM_FAIL; } @@ -567,7 +520,7 @@ int find_legacy_mouse( int fd ) { /* PNP_COM_FATAL - error, errno has reason */ /* PNP_COM_OK - probe saw 'OK' */ /* PNP_COM_FAIL - Never saw the 'OK' response */ -int find_legacy_modem( int fd ) { +static int find_legacy_modem( int fd ) { int modem_lines; int temp; int done; @@ -577,6 +530,8 @@ int find_legacy_modem( int fd ) { struct timeval timo; struct termios portattr; + DEBUG("looking for a legacy modem\n"); + /* now we set port to be 1200 baud, 8 bits, no parity, 1 stop bit */ temp = tcgetattr(fd, &portattr); if (temp < 0) @@ -594,8 +549,7 @@ int find_legacy_modem( int fd ) { usleep(200000); /* send the 'AT' command */ - if (debug_level > 0) - printf("Sending AT command to modem\n"); + DEBUG("Sending AT command to modem\n"); write(fd, "AT\r", 3); @@ -637,7 +591,7 @@ int find_legacy_modem( int fd ) { /* timeout after 3 seconds */ /* should probably set a 200 msec timeout per char, as spec says */ /* if no char received, we're done */ -int read_pnp_string( int fd, unsigned char *pnp_string, int *pnp_len, int pnp_stringbuf_size ) { +static int read_pnp_string( int fd, unsigned char *pnp_string, int *pnp_len, int pnp_stringbuf_size ) { int pnp_index; int temp, done, counter; int seen_start; @@ -645,9 +599,11 @@ int read_pnp_string( int fd, unsigned char *pnp_string, int *pnp_len, int pnp_st struct timeval timo; unsigned char buf[80]; unsigned char end_char; + + DEBUG("Attempting to read PNP ID string\n"); /* see if we have any input waiting */ - pnp_index =0; + pnp_index = 0; seen_start = 0; done = 0; end_char = 0; @@ -659,7 +615,7 @@ int read_pnp_string( int fd, unsigned char *pnp_string, int *pnp_len, int pnp_st temp = read( fd, buf, 1 ); if (temp < 0) { if (errno != EAGAIN) - return PNP_COM_FATAL; + return PNP_COM_FAIL; } else { for (counter=0; counter < temp; counter++) { pnp_string[pnp_index++] = buf[counter]; @@ -682,30 +638,23 @@ int read_pnp_string( int fd, unsigned char *pnp_string, int *pnp_len, int pnp_st } else done = 1; - /* shouldnt run more than 4 seconds */ - if (time(NULL)-starttime > 4 ) + /* shouldnt run more than 3 seconds */ + if (time(NULL)-starttime > 3 ) done = 1; if (pnp_index >= pnp_stringbuf_size) done = 1; } pnp_string[pnp_index] = 0; - *pnp_len=pnp_index; - return 0; + *pnp_len=pnp_index; + if(*pnp_len > 0) + return PNP_COM_OK; + else /* allows to call seq2 to be conformant */ + return PNP_COM_FAIL; } -/* UNUSED */ -/* simple little helper function */ -void xlate_memcpy( void *dest, void *src, int len, int xlate_flag ) { - unsigned char *d, *s; - int i; - - for (i=0,d=dest,s=src; i<len; i++, d++, s++) - *d = (*s) + ((xlate_flag) ? 0x20 : 0 ); -} - /* parse the PnP ID string into components */ -int parse_pnp_string( unsigned char *pnp_id_string, int pnp_len, +static int parse_pnp_string( unsigned char *pnp_id_string, int pnp_len, struct pnp_com_id *pnp_id ) { unsigned char *p1, *p2; unsigned char *start; @@ -714,7 +663,6 @@ int parse_pnp_string( unsigned char *pnp_id_string, int pnp_len, unsigned char *endfield; unsigned char *temppos; unsigned char *pnp_string; - unsigned char end_char; int no_more_extensions=0; int stage; @@ -724,6 +672,8 @@ int parse_pnp_string( unsigned char *pnp_id_string, int pnp_len, char extension_delims[] = {EndPnP1, EndPnP2, ExtendPnP1, ExtendPnP2, 0}; char end_delims[] = {EndPnP1, EndPnP2, 0}; + unsigned char* p1end = NULL; + unsigned char* p2end = NULL; /* clear out pnp_id */ memset(pnp_id, 0, sizeof(*pnp_id)); @@ -736,13 +686,23 @@ int parse_pnp_string( unsigned char *pnp_id_string, int pnp_len, p1 = memchr( pnp_string, BeginPnP1, pnp_len ); p2 = memchr( pnp_string, BeginPnP2, pnp_len ); + + if (p1) { + int p_len = pnp_len - (p1 - pnp_string); + p1end = memchr(p1, EndPnP1, p_len); + } + if (p2) { + int p_len = pnp_len - (p2 - pnp_string); + p2end = memchr(p2, EndPnP2, p_len); + } + /* use the one which points nearest to start of the string */ /* and is actually defined */ - if ( p1 && p2 ) { + if ( p1 && p1end && p2 && p2end ) { start = (p1 < p2) ? p1 : p2; - } else if (p1) + } else if ( p1 && p1end ) start = p1; - else if (p2) + else if ( p2 && p2end ) start = p2; else start = NULL; @@ -758,7 +718,6 @@ int parse_pnp_string( unsigned char *pnp_id_string, int pnp_len, /* setup end character we are looking for based on the start character */ if (start == p2) { pnp_id->xlate_6bit = 1; - end_char = EndPnP2; /* we need to xlate data in PnP fields */ /* remember to skip the revision fields (bytes 1 and 2 after start) */ temppos=start; @@ -773,7 +732,6 @@ int parse_pnp_string( unsigned char *pnp_id_string, int pnp_len, } } else { pnp_id->xlate_6bit = 0; - end_char = EndPnP1; } /* move everything before the start of the PnP block */ @@ -867,85 +825,43 @@ int parse_pnp_string( unsigned char *pnp_id_string, int pnp_len, return 0; } -/* UNUSED except for debugging */ -void print_pnp_id( struct pnp_com_id id ) { - int i; - int extensions_exist; - int revision_temp; - - if (id.other_len != 0) { - printf("Detected non-PnP data stream at start.\n"); - printf(" Length = 0x%x\n",id.other_len); - printf(" Contents ="); - for (i=0; i<id.other_len; i++) - printf(" 0x%x",id.other_id[i]); - printf("\n"); - } else - printf("Non-PnP data stream not detected at start.\n"); - - - /* parse PnP revision bytes into a string values (eg. "1.00") */ - revision_temp = ((id.pnp_rev[0]&0x3f) << 6)+(id.pnp_rev[1]&0x3f); - sprintf(id.pnp_rev_str, "%d.%d",revision_temp/100,revision_temp % 100); - - printf("\nPnP Required fields:\n"); - printf(" Revision = %s\n",id.pnp_rev_str); - printf(" Manufacturer = %s\n",id.eisa_id); - printf(" Product ID = %s\n",id.product_id); - - extensions_exist = id.serial_number[0] || id.class_name[0] || - id.driver_id[0] || id.user_name[0]; - - if (extensions_exist) { - printf("\nPnP extension field(s) exist:\n"); - if (id.serial_number[0]) - printf(" Serial Number = %s\n",id.serial_number); - if (id.class_name[0]) - printf(" PnP class name = %s\n",id.class_name); - if (id.driver_id[0]) - printf(" PnP Compatible = %s\n",id.driver_id); - if (id.user_name[0]) - printf(" PnP Description = %s\n",id.user_name); - } -} - -int attempt_pnp_retrieve(int fd, char *pnp_string, int *pnp_strlen, int pnp_stringbuf_size) { +static int attempt_pnp_retrieve(int fd, char *pnp_string, int *pnp_strlen, int pnp_stringbuf_size) { int pnp_probe_status; - int tried_at_prodding; - int give_up; struct pnp_com_id pnp_id; - - tried_at_prodding=0; - give_up=0; + int tried_at_prodding=0, give_up=0; + + DEBUG("Attempting PNP information retrieval\n"); while (!give_up) { pnp_probe_status = init_pnp_com_seq1(fd); - if (pnp_probe_status == PNP_COM_FATAL) { - return(PNP_COM_FATAL); - } else if (pnp_probe_status == PNP_COM_OK) { - read_pnp_string(fd, pnp_string, pnp_strlen, pnp_stringbuf_size ); - - if (debug_level > 0) { - printf("\nPNP string = |%s|\n\n",pnp_string); - print_hex_data(pnp_string, *pnp_strlen); - } - - if (*pnp_strlen == 1 && pnp_string[0] == 'M') /* legacy mouse */ - return PNP_COM_OK; - /* see if we got anything useful, if not try at command */ - /* to prod device into correct serial params */ - if (parse_pnp_string( pnp_string, *pnp_strlen, &pnp_id )<0) - if (!tried_at_prodding) { - write(fd, "AT\r", 3); - tried_at_prodding=1; - } else - give_up = 1; - else - return PNP_COM_OK; + if (pnp_probe_status == PNP_COM_FATAL) + return PNP_COM_FATAL; + pnp_probe_status = read_pnp_string(fd, pnp_string, pnp_strlen, + pnp_stringbuf_size); + if (pnp_probe_status == PNP_COM_FAIL) { + init_pnp_com_seq2(fd); /* always succeeds */ + + pnp_probe_status = read_pnp_string(fd, pnp_string, pnp_strlen, + pnp_stringbuf_size); + } + + if (*pnp_strlen == 1 && pnp_string[0] == 'M') /* legacy mouse */ + return PNP_COM_OK; + /* see if we got anything useful, if not try AT command */ + /* to prod device into correct serial params */ + if (parse_pnp_string( pnp_string, *pnp_strlen, &pnp_id )<0) { + DEBUG("That failed.\n"); + if (!tried_at_prodding) { + DEBUG("Prod modem with AT command.\n"); + write(fd, "AT\r", 3); + tried_at_prodding=1; + } else + give_up = 1; } else - give_up = 1; - } + return PNP_COM_OK; + } + /* normal PNP detection has failed. */ /* try sending a ATI9 code to the modem to see if we get PnP id back */ init_pnp_com_ati9(fd); read_pnp_string(fd, pnp_string, pnp_strlen, pnp_stringbuf_size ); @@ -962,7 +878,6 @@ struct device *serialProbe(enum deviceClass probeClass, int probeFlags, int fd; int temp; int pnp_strlen; - int devicetype=-1; unsigned char pnp_string[100]; char port[20]; struct termios origattr; @@ -973,57 +888,51 @@ struct device *serialProbe(enum deviceClass probeClass, int probeFlags, int console=-1; int stdin_line=-1; struct serial_struct si; - + + DEBUG("Probing for serial ports\n"); + if (probeFlags & PROBE_SAFE) return devlist; /* Are we on a serial console? */ fstat(0,&sb); maj = major(sb.st_rdev); if (maj != 4 && (maj < 136 || maj > 143)) { - if (ioctl (0, TIOCLINUX, &twelve) < 0) { - if (ioctl (0, TIOCGSERIAL, &si) >= 0) { - if (si.line > 0) { - stdin_line = 1 << si.line; - } else { - stdin_line = 0; - } - } else stdin_line = 0; - } + if (ioctl (0, TIOCLINUX, &twelve) < 0) { + if (ioctl (0, TIOCGSERIAL, &si) >= 0) { + if (si.line > 0) { + stdin_line = 1 << si.line; + } else { + stdin_line = 0; + } + } else stdin_line = 0; + } } fd=open("/dev/console",O_RDWR); if (fd != -1) { - fstat(fd,&sb); - maj = major(sb.st_rdev); - if (maj != 4 && (maj < 136 || maj > 143)) { - if (ioctl (fd, TIOCLINUX, &twelve) < 0) { - #ifdef __powerpc__ - // we could have gotten an error for another reason - like EINVAL - // skipping ttyS0 on PPC - which is where most modems reside - if (errno == ENOTTY) { - #endif - if (ioctl (fd, TIOCGSERIAL, &si) >= 0) { - if (si.line > 0) { - console = 1 << si.line; - } else { - console = 0; - } - } else console = 0; - #ifdef __powerpc__ - } - #endif + fstat(fd,&sb); + maj = major(sb.st_rdev); + if (maj != 4 && (maj < 136 || maj > 143)) { + if (ioctl (fd, TIOCLINUX, &twelve) < 0) { + if (ioctl (fd, TIOCGSERIAL, &si) >= 0) { + if (si.line > 0) { + console = 1 << si.line; + } else { + console = 0; } + } else console = 0; } - close(fd); + } + close(fd); } - - + + if ( - (probeClass == CLASS_UNSPEC) || - (probeClass == CLASS_OTHER) || - (probeClass == CLASS_MOUSE) || - (probeClass == CLASS_MODEM) || - (probeClass == CLASS_PRINTER) + (probeClass & CLASS_UNSPEC) || + (probeClass & CLASS_OTHER) || + (probeClass & CLASS_MOUSE) || + (probeClass & CLASS_MODEM) || + (probeClass & CLASS_PRINTER) ) { int x; @@ -1035,82 +944,77 @@ struct device *serialProbe(enum deviceClass probeClass, int probeFlags, /* Make sure it's not in use */ snprintf(lockfile,32,"/var/lock/LCK..ttyS%d",x); - if (!stat(lockfile,&sbuf)) - continue; + if (!stat(lockfile,&sbuf)) { + DEBUG("Port %s in use, skipping probe.\n", + port); + continue; + } memset(lockfile,'\0',32); if (readlink("/dev/modem",lockfile,32)>0) { if (!strcmp(basename(port),basename(lockfile))) { - snprintf(lockfile,32,"/var/lock/LCK..modem"); - if (!stat(lockfile,&sbuf)) - continue; + snprintf(lockfile,32,"/var/lock/LCK..modem"); + if (!stat(lockfile,&sbuf)) { + DEBUG("Port %s in use, skipping probe.\n", + port); + continue; + } } } if ((fd=open_serial_port(port)) < 0) { - continue; + continue; } /* save the current state of the port */ temp = tcgetattr(fd, &origattr); if (temp < 0) { - close(fd); - continue; + DEBUG("unable to retrieve port attributes...no port present?\n"); + close(fd); + continue; } + /* try twiddling RS232 control lines and see if it talks to us */ - devicetype=-1; pnp_strlen = 0; - attempt_pnp_retrieve( fd, pnp_string, &pnp_strlen, sizeof(pnp_string) - 1 ); - + if (attempt_pnp_retrieve( fd, pnp_string, &pnp_strlen, + sizeof(pnp_string) - 1 ) == PNP_COM_FATAL) + goto endprobe; + /* see if we found any PnP signature */ - if (pnp_strlen != 0) { - if (*pnp_string == 'M') { /* Legacy mouse */ - if (probeClass == CLASS_MOUSE || probeClass == CLASS_UNSPEC) { - serdev = serialNewDevice(NULL); - serdev->class=CLASS_MOUSE; - serdev->device=strdup(port+5); - serdev->desc=strdup("Generic Serial Mouse"); - serdev->driver=strdup("generic"); - if (devlist) - serdev->next = devlist; - devlist = (struct device *)serdev; - if (probeFlags & PROBE_ONE) { - tcsetattr(fd, TCSANOW, &origattr); - tcflush(fd, TCIOFLUSH); - close(fd); - return devlist; - } - } - tcsetattr(fd, TCSANOW, &origattr); - close(fd); - continue; - } + if (pnp_strlen != 0 && (pnp_strlen != 1 || pnp_string[0] != 'M')) { + /* fill in the PnP com structure */ if (parse_pnp_string( pnp_string, pnp_strlen, &pnp_id )<0) { - goto endprobe; + DEBUG("Got PNP data back, but failed to parse. Aborting\n"); + goto endprobe; } else { char *foo; int len; - if (debug_level > 0) { - printf("PnP ID string for serial device on port %s\n",port); - print_pnp_id( pnp_id ); - } + DEBUG("PNP data parsed.\n"); serdev = serialNewDevice(NULL); + if (pnp_id.user_name[0]) { - serdev->pnpdesc = strdup(pnp_id.user_name); - len = strlen(pnp_id.eisa_id)+strlen(pnp_id.product_id)+strlen(pnp_id.user_name)+3; + serdev->pnpdesc = strdup(pnp_id.user_name); + len = strlen(pnp_id.eisa_id) + + strlen(pnp_id.product_id) + + strlen(pnp_id.user_name) + 3; foo = malloc(len); - snprintf(foo,len,"%s|%s %s",pnp_id.eisa_id,pnp_id.product_id,pnp_id.user_name); + snprintf(foo,len,"%s|%s %s",pnp_id.eisa_id, + pnp_id.product_id,pnp_id.user_name); } else { - len = strlen(pnp_id.eisa_id)+strlen(pnp_id.product_id)+3; + len = strlen(pnp_id.eisa_id) + + strlen(pnp_id.product_id) + 3; foo = malloc(len); - snprintf(foo,len,"%s|%s",pnp_id.eisa_id,pnp_id.product_id); + snprintf(foo,len,"%s|%s",pnp_id.eisa_id, + pnp_id.product_id); } + if (serdev->desc) free(serdev->desc); serdev->desc=strdup(foo); serdev->device=strdup(port+5); + if (serdev->driver) free(serdev->driver); serdev->driver=strdup("ignore"); - serdev->pnpmfr = strdup(pnp_id.eisa_id); - serdev->pnpmodel = strdup(pnp_id.product_id); + serdev->pnpmfr = strdup(pnp_id.eisa_id); + serdev->pnpmodel = strdup(pnp_id.product_id); free(foo); foo=pnp_id.product_id; @@ -1119,87 +1023,97 @@ struct device *serialProbe(enum deviceClass probeClass, int probeFlags, foo = strstr(pnp_id.driver_id,"PNP")+3; serdev->pnpcompat = strdup(pnp_id.driver_id); } - if (!strncmp(foo, "0F", 2)) - serdev->class = CLASS_MOUSE; - else if (!strncmp(foo, "C", 1)) - serdev->class = CLASS_MODEM; - else if (!strncmp(pnp_id.class_name, "Modem", 5)) - serdev->class = CLASS_MODEM; + + if (*pnp_id.other_id == 'M' || + !strncmp(pnp_id.class_name, "MOUSE", 5) || + !strncmp(foo, "0F", 2)) { + serdev->type = CLASS_MOUSE; + if (!strncmp(serdev->desc, "|", 1)) { + free(serdev->desc); + serdev->desc=strdup("Generic Serial Mouse"); + } + if (serdev->driver) free(serdev->driver); + serdev->driver = strdup("generic"); + } + else if (!strncmp(pnp_id.class_name, "MODEM", 5) || + !strncmp(foo, "C", 1)) + serdev->type = CLASS_MODEM; + else if (!strncmp(pnp_id.class_name, "PRINTER", 7)) + serdev->type = CLASS_PRINTER; else - serdev->class = CLASS_OTHER; - if (serdev->class == probeClass || probeClass == CLASS_UNSPEC) { - if (devlist) - serdev->next = devlist; - devlist = (struct device *)serdev; - if (probeFlags & PROBE_ONE) { - tcsetattr(fd, TCSANOW, &origattr); - tcflush(fd, TCIOFLUSH); - close(fd); - return devlist; - } + serdev->type = CLASS_OTHER; + if (serdev->type & probeClass) { + if (devlist) + serdev->next = devlist; + devlist = (struct device *)serdev; + if (probeFlags & PROBE_ONE) { + tcsetattr(fd, TCSANOW, &origattr); + tcflush(fd, TCIOFLUSH); + close(fd); + return devlist; + } } else { - serdev->freeDevice(serdev); + serdev->freeDevice(serdev); } goto endprobe; } } else { + DEBUG("No PNP data received.\n"); /* try to find a legacy device */ temp = find_legacy_mouse(fd); if (temp == PNP_COM_FATAL) { goto endprobe; } else if (temp == PNP_COM_OK) { - if (probeClass == CLASS_UNSPEC || probeClass == CLASS_MOUSE) { - serdev=serialNewDevice(NULL); - serdev->class = CLASS_MOUSE; - serdev->device = strdup(port+5); - serdev->driver= strdup("generic"); - serdev->desc = strdup("Generic Serial Mouse"); - if (devlist) - serdev->next = devlist; - devlist = (struct device *)serdev; - if (probeFlags & PROBE_ONE) { - tcsetattr(fd, TCSANOW, &origattr); - tcflush(fd, TCIOFLUSH); - close(fd); - return devlist; - } + if (probeClass & CLASS_MOUSE) { + serdev=serialNewDevice(NULL); + serdev->type = CLASS_MOUSE; + serdev->device = strdup(port+5); + serdev->driver= strdup("generic"); + serdev->desc = strdup("Generic Serial Mouse"); + if (devlist) + serdev->next = devlist; + devlist = (struct device *)serdev; + if (probeFlags & PROBE_ONE) { + tcsetattr(fd, TCSANOW, &origattr); + tcflush(fd, TCIOFLUSH); + close(fd); + return devlist; } - goto endprobe; + } + goto endprobe; } else { - if (debug_level > 0) - printf("Didnt see a legacy mouse, need to ATI it now.\n"); - + DEBUG("Didn't see a legacy mouse.\n"); + temp = find_legacy_modem(fd); if (temp == PNP_COM_FATAL) { - goto endprobe; + goto endprobe; } else if (temp == PNP_COM_OK) { - if (debug_level > 0) - printf("\nLegacy modem signature seen.\n\n"); - if (probeClass == CLASS_UNSPEC || probeClass == CLASS_MODEM) { - serdev=serialNewDevice(NULL); - serdev->class = CLASS_MODEM; - serdev->device = strdup(port+5); - serdev->driver= strdup("ignore"); - serdev->desc = strdup("Generic Serial Modem"); - if (devlist) - serdev->next = devlist; - devlist = (struct device *)serdev; - if (probeFlags & PROBE_ONE) { - tcsetattr(fd, TCSANOW, &origattr); - tcflush(fd, TCIOFLUSH); - close(fd); - return devlist; - } + DEBUG("Legacy modem signature seen.\n"); + if (probeClass & CLASS_MODEM) { + serdev=serialNewDevice(NULL); + serdev->type = CLASS_MODEM; + serdev->device = strdup(port+5); + serdev->driver= strdup("ignore"); + serdev->desc = strdup("Generic Serial Modem"); + if (devlist) + serdev->next = devlist; + devlist = (struct device *)serdev; + if (probeFlags & PROBE_ONE) { + tcsetattr(fd, TCSANOW, &origattr); + tcflush(fd, TCIOFLUSH); + close(fd); + return devlist; + } } - goto endprobe; + goto endprobe; } else { - if (debug_level > 0) - printf("Didnt see a legacy modem, game over.\n"); + DEBUG("Didnt see a legacy modem, game over.\n"); } } } -endprobe: + endprobe: + DEBUG("Restoring original port attributes\n"); tcsetattr(fd, TCSANOW, &origattr); tcflush(fd, TCIOFLUSH); close(fd); diff --git a/tools/serial_probe/serial.h b/tools/serial_probe/serial.h index 75d178ce9..691abeb26 100644 --- a/tools/serial_probe/serial.h +++ b/tools/serial_probe/serial.h @@ -1,4 +1,4 @@ -/* Copyright 1999 Red Hat, Inc. +/* Copyright 1999-2003 Red Hat, Inc. * * This software may be freely redistributed under the terms of the GNU * public license. @@ -18,7 +18,7 @@ struct serialDevice { /* common fields */ struct device *next; /* next device in list */ int index; - enum deviceClass class; /* type */ + enum deviceClass type; /* type */ enum deviceBus bus; /* bus it's attached to */ char * device; /* device file associated with it */ char * driver; /* driver to load, if any */ diff --git a/tools/serial_probe/serial_probe.c b/tools/serial_probe/serial_probe.c index b8abb6917..a9aae52e5 100644 --- a/tools/serial_probe/serial_probe.c +++ b/tools/serial_probe/serial_probe.c @@ -1,4 +1,4 @@ -/* Copyright 1999 MandrakeSoft <fpons@mandrakesoft.com> +/* Copyright 1999 Mandrakesoft <fpons@mandrakesoft.com> * * The following file used by this one are copyrighted by RedHat and * are taken from kudzu : @@ -39,9 +39,9 @@ struct device *newDevice(struct device *old, struct device *new) { new = malloc(sizeof(struct device)); memset(new,'\0',sizeof(struct device)); } - new->class = CLASS_UNSPEC; + new->type = CLASS_UNSPEC; } else { - new->class = old->class; + new->type = old->type; if (old->device) new->device = strdup(old->device); if (old->driver) new->driver = strdup(old->driver); if (old->desc) new->desc = strdup(old->desc); @@ -74,7 +74,29 @@ int main () { while (devices) { serialDevice = (struct serialDevice*)devices; - printf("CLASS=%s\n", classStrings[serialDevice->class]); + printf("CLASS="); + if (serialDevice->type == CLASS_UNSPEC) puts("UNSPEC"); else + if (serialDevice->type == CLASS_OTHER) puts("OTHER"); else + if (serialDevice->type == CLASS_NETWORK) puts("NETWORK"); else + if (serialDevice->type == CLASS_SCSI) puts("SCSI"); else + if (serialDevice->type == CLASS_MOUSE) puts("MOUSE"); else + if (serialDevice->type == CLASS_AUDIO) puts("AUDIO"); else + if (serialDevice->type == CLASS_CDROM) puts("CDROM"); else + if (serialDevice->type == CLASS_MODEM) puts("MODEM"); else + if (serialDevice->type == CLASS_VIDEO) puts("VIDEO"); else + if (serialDevice->type == CLASS_TAPE) puts("TAPE"); else + if (serialDevice->type == CLASS_FLOPPY) puts("FLOPPY"); else + if (serialDevice->type == CLASS_SCANNER) puts("SCANNER"); else + if (serialDevice->type == CLASS_HD) puts("HD"); else + if (serialDevice->type == CLASS_RAID) puts("RAID"); else + if (serialDevice->type == CLASS_PRINTER) puts("PRINTER"); else + if (serialDevice->type == CLASS_CAPTURE) puts("CAPTURE"); else + if (serialDevice->type == CLASS_KEYBOARD) puts("KEYBOARD"); else + if (serialDevice->type == CLASS_MONITOR) puts("MONITOR"); else + if (serialDevice->type == CLASS_USB) puts("USB"); else + if (serialDevice->type == CLASS_SOCKET) puts("SOCKET"); else + if (serialDevice->type == CLASS_FIREWIRE) puts("FIREWIRE"); else + if (serialDevice->type == CLASS_IDE) puts("IDE"); printf("BUS=SERIAL\n"); printf("DEVICE=/dev/%s\n", serialDevice->device); printf("DRIVER=%s\n", serialDevice->driver); diff --git a/tools/shift_all.pl b/tools/shift_all.pl new file mode 100644 index 000000000..88abfa0e1 --- /dev/null +++ b/tools/shift_all.pl @@ -0,0 +1,113 @@ +use MDK::Common; + +my %shifts = ( +'af' => 1, +'am' => 1, +'ar' => 0, +'az' => 1, +'be' => 2, +'bg' => 2, +'bn' => 1, +'br' => 2, +'bs' => 2, +'ca' => 2, +'cs' => 2, +'cy' => 2, +'da' => 2, +'de' => 2, +'el' => 2, +'en_GB' => 2, +'en_US' => 2, +'eo' => 2, +'es' => 2, +'et' => 2, +'eu' => 2, +'fa' => 0, +'fi' => 1, +'fo' => 2, +'fr' => 2, +'ga' => 2, +'gd' => 2, +'gl' => 2, +'gv' => 2, +'he' => 0, +'hi' => 1, +'hr' => 2, +'hu' => 2, +'hy' => 1, +'ia' => 2, +'id' => 1, +'is' => 1, +'it' => 1, +'iu' => 1, +'ja' => 3, +'ka' => 1, +'kn' => 1, +'ko' => 1, +'kw' => 0, +'lo' => 0, +'lt' => 0, +'lv' => 0, +'mi' => 0, +'mk' => 0, +'mn' => 0, +'mr' => 0, +'ms' => 0, +'mt' => 0, +'nb' => 0, +'nl' => 0, +'nn' => 0, +'no' => 0, +'oc' => 0, +'pl' => 0, +'pt_BR' => 0, +'pt' => 0, +'ro' => 0, +'ru' => 0, +'sk' => 0, +'sl' => 0, +'sp' => 0, +'sq' => 0, +'sr' => 0, +'sv' => 0, +'ta' => 1, +'te' => 1, +'tg' => 0, +'th' => 0, +'tr' => 0, +'tt' => 1, +'uk' => 0, +'ur' => 1, +'uz' => 0, +'vi' => 0, +'wa' => 0, +'yi' => 0, +'zh_CN' => 0, +'zh_TW' => 0, +); + +foreach (glob("lang*.png")) { + /lang-(.*)\.png/; + exists $shifts{$1} or die "doesn't exist for $_"; + $shifts{$1} or next; + print "./a.out $_ l.png $shifts{$1}\n"; + system("./a.out $_ l.png $shifts{$1}"); + renamef('l.png', $_); +} + + + + + + + + + + + + + + + + + diff --git a/tools/shift_img.c b/tools/shift_img.c new file mode 100644 index 000000000..36cb53e48 --- /dev/null +++ b/tools/shift_img.c @@ -0,0 +1,165 @@ +/* + * Guillaume Cottenceau (gc at mandriva.com) + * + * Copyright 2002-2005 Mandriva + * + * This software may be freely redistributed under the terms of the GNU + * public license. + * + */ + +#include <unistd.h> +#include <stdio.h> +#include <string.h> +#include <stdarg.h> + +#define PNG_DEBUG 3 +#include <png.h> + +void abort_(const char * s, ...) +{ + va_list args; + va_start(args, s); + vfprintf(stderr, s, args); + fprintf(stderr, "\n"); + va_end(args); + abort(); +} + +int x, y; + +int width, height; +png_byte color_type; +png_byte bit_depth; + +png_structp png_ptr; +png_infop info_ptr; +int number_of_passes; +png_bytep * row_pointers; + +void read_png_file(char* file_name) +{ + char header[8]; // 8 is the maximum size that can be checked + + /* open file and test for it being a png */ + FILE *fp = fopen(file_name, "rb"); + if (!fp) + abort_("[read_png_file] File %s could not be opened for reading", file_name); + fread(header, 1, 8, fp); + if (png_sig_cmp(header, 0, 8)) + abort_("[read_png_file] File %s is not recognized as a PNG file", file_name); + + + /* initialize stuff */ + png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); + + if (!png_ptr) + abort_("[read_png_file] png_create_read_struct failed"); + + info_ptr = png_create_info_struct(png_ptr); + if (!info_ptr) + abort_("[read_png_file] png_create_info_struct failed"); + + if (setjmp(png_jmpbuf(png_ptr))) + abort_("[read_png_file] Error during init_io"); + + png_init_io(png_ptr, fp); + png_set_sig_bytes(png_ptr, 8); + + png_read_info(png_ptr, info_ptr); + + width = info_ptr->width; + height = info_ptr->height; + color_type = info_ptr->color_type; + bit_depth = info_ptr->bit_depth; + + number_of_passes = png_set_interlace_handling(png_ptr); + png_read_update_info(png_ptr, info_ptr); + + + /* read file */ + if (setjmp(png_jmpbuf(png_ptr))) + abort_("[read_png_file] Error during read_image"); + + row_pointers = (png_bytep*) malloc(sizeof(png_bytep) * height); + for (y=0; y<height; y++) + row_pointers[y] = (png_byte*) malloc(info_ptr->rowbytes); + + png_read_image(png_ptr, row_pointers); +} + + +void write_png_file(char* file_name) +{ + /* create file */ + FILE *fp = fopen(file_name, "wb"); + if (!fp) + abort_("[write_png_file] File %s could not be opened for writing", file_name); + + + /* initialize stuff */ + png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); + + if (!png_ptr) + abort_("[write_png_file] png_create_write_struct failed"); + + info_ptr = png_create_info_struct(png_ptr); + if (!info_ptr) + abort_("[write_png_file] png_create_info_struct failed"); + + if (setjmp(png_jmpbuf(png_ptr))) + abort_("[write_png_file] Error during init_io"); + + png_init_io(png_ptr, fp); + + + /* write header */ + if (setjmp(png_jmpbuf(png_ptr))) + abort_("[write_png_file] Error during writing header"); + + png_set_IHDR(png_ptr, info_ptr, width, height, + bit_depth, color_type, PNG_INTERLACE_NONE, + PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE); + + png_write_info(png_ptr, info_ptr); + + + /* write bytes */ + if (setjmp(png_jmpbuf(png_ptr))) + abort_("[write_png_file] Error during writing bytes"); + + png_write_image(png_ptr, row_pointers); + + + /* end write */ + if (setjmp(png_jmpbuf(png_ptr))) + abort_("[write_png_file] Error during end of write"); + + png_write_end(png_ptr, NULL); + +} + +void process_file(char* shift) +{ + int shift_ = atoi(shift); + + if (info_ptr->color_type != PNG_COLOR_TYPE_RGBA) + abort_("[process_file] color_type of input file must be PNG_COLOR_TYPE_RGBA (is %d)", info_ptr->color_type); + + width -= shift_; + for (y=0; y<height; y++) { + row_pointers[y] += 4 * shift_; + } + +} + + +int main(int argc, char **argv) +{ + if (argc != 4) + abort_("Usage: program_name <file_in> <file_out> <shift>"); + + read_png_file(argv[1]); + process_file(argv[3]); + write_png_file(argv[2]); +} diff --git a/tools/simplify-drakx-modules b/tools/simplify-drakx-modules new file mode 100755 index 000000000..ec8df1e76 --- /dev/null +++ b/tools/simplify-drakx-modules @@ -0,0 +1,5 @@ +#!/usr/bin/perl -pi + +s/^\s*use\s+(diagnostics|strict|vars|warnings).*//g; + +/^__END__/ and $_ = '', close ARGV; diff --git a/tools/sparc/e2fsck.shared b/tools/sparc/e2fsck.shared Binary files differdeleted file mode 100755 index b423986e5..000000000 --- a/tools/sparc/e2fsck.shared +++ /dev/null diff --git a/tools/specific_arch b/tools/specific_arch index 006b17446..a86b7bc43 100755 --- a/tools/specific_arch +++ b/tools/specific_arch @@ -5,5 +5,5 @@ use MDK::Common; print join(' ', map { my $arch = arch(); $arch = $compat_arch{$arch} while $arch && !-e "$_.$arch"; - -e "$_.$arch" ? "$_.$arch" : $_; + -e "$_.$arch" ? "$_.$arch" : (); } @ARGV), "\n"; diff --git a/tools/syncrpms b/tools/syncrpms deleted file mode 100755 index df3ddfaed..000000000 --- a/tools/syncrpms +++ /dev/null @@ -1,261 +0,0 @@ -#!/usr/bin/perl - -#- Synchronize mulitple RPMS/SRPMS directories. -#- Copyright (C) 1999 MandrakeSoft (fpons@mandrakesoft.com) -#- -#- 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, 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. - - -use strict qw(subs vars refs); - -#- compare a version string. -use URPM; - -#- get basename for a file. -sub basename { $_[0] =~ /([^\/]*)$/ ? $1 : $_[0]; } - -#- system functions. -sub cp { - my $pid; - if ($pid = fork()) { - waitpid($pid, 0); - } else { - exec '/bin/cp', @_; - } -} -sub mv { - my $pid; - if ($pid = fork()) { - waitpid($pid, 0); - } else { - exec '/bin/mv', @_; - } -} -sub rm { - my $pid; - if ($pid = fork()) { - waitpid($pid, 0); - } else { - exec '/bin/rm', '-f', @_; - } -} - -#- get a hash on name of srpms/rpms in a directory. -sub get_rpms { - my ($dir, $rpms, $flag, $modifiable) = @_; - - opendir D, $dir or die "cannot open directory $dir\n"; - map { - if (/([^\/]*?)-([^-]*)-([^-]*)\.([^-\.]*)\.rpm$/) { - my $key = "$1 $4"; #- get name including architecture. - if ($rpms->{$key}) { - if (URPM::ranges_overlap("== $2-$3", "> $rpms->{$key}{version}-$rpms->{$key}{release}")) { - if ($modifiable) { - if ($flag->{sorted}) { - print "you said rpms directory is sorted, so I keep obsoleted $rpms->{$key}{file} by $_ in $rpms->{$key}{dir}\n" if $flag->{verbose}; - } else { - if (-d $flag->{conflict}) { - print "moving obsoleted $rpms->{$key}{file} by $_ in $rpms->{$key}{dir}\n" if $flag->{verbose}; - mv("$rpms->{$key}{dir}/$rpms->{$key}{file}", $flag->{conflict}); - } elsif ($flag->{clean}) { - print "removing obsoleted $rpms->{$key}{file} by $_ in $rpms->{$key}{dir}\n" if $flag->{verbose}; - rm("$rpms->{$key}{dir}/$rpms->{$key}{file}"); - } - } - } - $rpms->{$key} = { key => $key, - name => $1, - version => $2, - release => $3, - arch => $4, - dir => $dir, - file => $_, - }; - } else { - if ($modifiable) { - if (-d $flag->{conflict}) { - print "copying older or equal $_ by $rpms->{$key}{file} in $flag->{conflict}\n" if $flag->{verbose}; - cp("$dir/$_", $flag->{conflict}); - chmod 0644, "$flag->{conflict}/$_"; - } elsif ($flag->{clean}) { - print "removing older or equal $_ by $rpms->{$key}{file} in $dir\n" if $flag->{verbose}; - rm("$dir/$_"); - } - } - } - } else { - $rpms->{$key} = { key => $key, - name => $1, - version => $2, - release => $3, - arch => $4, - dir => $dir, - file => $_, - }; - } - } else { - print STDERR "unable to parse filename $_\n"; - } - } grep { /\.rpm$/ } readdir D; - closedir D; -} - -#- sync packages list according to hashes of rpms. -sub sync_medium { - my ($rpmsdirs, $list, $rpms, $flag) = @_; - my %pkg2dir; - - #- build a hash according to rpmsdirs and list for package name. - my $i = 0; - foreach (@$list) { - local *F; - open F, $_ or die "unable to open packages list file \"$_\"\n"; - foreach (<F>) { - chomp; - print STDERR "package \"$_\" is listed in mulitple list files!\n" if $pkg2dir{$_}; - $pkg2dir{$_} = $rpmsdirs->[$i]; - print "package \"$_\" listed in list files does not exists in rpms directory\n" if $flag->{verbose} && !$rpms->{$_}; - } - close F; - - ++$i; - } - - #- check for right directory, and move if necessary. - foreach (values %$rpms) { - unless ($pkg2dir{$_->{key}}) { - print "file $_->{file} in $_->{dir} define package \"$_->{name}\" not listed in list files\n" if $flag->{verbose}; - } elsif ($_->{dir} ne $pkg2dir{$_->{key}}) { - print "moving file $_->{file} in $_->{dir} to $pkg2dir{$_->{key}}\n" if $flag->{verbose}; - mv("$_->{dir}/$_->{file}", $pkg2dir{$_->{key}}); - $_->{dir} = $pkg2dir{$_->{key}}; - } - } -} - -#- sync two hashes of rpms, update rpms and printer newer version that are not taken into account. -sub sync_rpms { - my ($source, $target, $flag) = @_; - - #- search in source part. - foreach (keys %$source) { - unless ($target->{$_}) { - if ($flag->{verbose}) { - print "adding $source->{$_}{file}" . (-d $flag->{add} ? " to $flag->{add}\n" : " is neccessary!\n"); - } - if (-d $flag->{add}) { - cp("$source->{$_}{dir}/$source->{$_}{file}", $flag->{add}); - chmod 0644, "$flag->{add}/$source->{$_}{file}"; - } - } - } - - #- search in both part. - foreach (keys %$source) { - if ($target->{$_}) { - if (URPM::ranges_overlap("== $source->{$_}{version}-$source->{$_}{release}", - ">= $target->{$_}{version}-$target->{$_}{release}")) { - if ("$source->{$_}{version}-$source->{$_}{release}" eq "$target->{$_}{version}-$target->{$_}{release}") { - -s "$source->{$_}{dir}/$source->{$_}{file}" == -s "$target->{$_}{dir}/$target->{$_}{file}" and next; - } - if ($flag->{verbose}) { - print "updating $target->{$_}{dir}/$target->{$_}{file} with newer version $source->{$_}{file}\n"; - } - if ($flag->{update}) { - cp("$source->{$_}{dir}/$source->{$_}{file}", $target->{$_}{dir}); - chmod 0644, "$target->{$_}{dir}/$source->{$_}{file}"; - unless (-e "$target->{$_}{dir}/$source->{$_}{file}") { - die "unable to copy $source->{$_}{file} from $source->{$_}{dir} into $target->{$_}{dir}\n"; - } - rm("$target->{$_}{dir}/$target->{$_}{file}") unless $source->{$_}{file} eq $target->{$_}{file}; #- copy on eq - } - } elsif ($source->{$_}{version} ne $target->{$_}{version} || $source->{$_}{release} ne $target->{$_}{release}) { - if ($flag->{verbose}) { - print STDERR "keeping more up-to-date version $target->{$_}{dir}/$target->{$_}{file} against $source->{$_}{dir}/$source->{$_}{file}, check your repository !\n"; - } - } #- say nothing if source is equal to target. - } - } - - #- search in target part. - foreach (keys %$target) { - unless ($source->{$_}) { - if ($flag->{verbose}) { - print "removing $target->{$_}{file}" . ($flag->{remove} ? " from $target->{$_}{dir}\n" : " is neccessary!\n"); - my $k = $_; - } - if ($flag->{remove}) { - rm("$target->{$_}{dir}/$target->{$_}{file}"); - } - } - } -} - -#- main program. -sub main { - my @from_rpms; - my @to_rpms; - my @list; - my $target; - my %flag; - my %source; - my %target; - - foreach (@_) { - if (/^--(\w*)$/) { - if ($1 eq 'verbose' || $1 eq 'update' || $1 eq 'remove' || $1 eq 'clean' || $1 eq 'sorted') { - $flag{$1} = 1; - } elsif ($1 eq 'add' || $1 eq 'conflict') { - $flag{$1} = undef; - } elsif ($1 eq 'from') { - $target = \@from_rpms; - } elsif ($1 eq 'to') { - $target = \@to_rpms; - } elsif ($1 eq 'list') { - $target = \@list; - } else { - die "unknown option: $1\n"; - } - } else { - if (exists $flag{add} && ! $flag{add}) { - $flag{add} = $_; - die "cannot add to non-directory: $_\n" unless -d $flag{add}; - } elsif (exists $flag{conflict} && ! $flag{conflict}) { - $flag{conflict} = $_; - die "cannot add to non-directory: $_\n" unless -d $flag{conflict}; - } else { - die "unknown parameter: $_\n" unless $target; - push @$target, $_; - } - } - } - - die "usage: syncrpms [--update] [--remove] [--clean] [--sorted] [--add <dir>] [--conflict <dir>] --from <dir_sources> --to <dir_targets> [--list <files>]\n" - unless scalar(@from_rpms) > 0 || scalar(@to_rpms) > 0; - - #- parse directory structures. - get_rpms($_, \%source, \%flag, 0) foreach @from_rpms; - print STDERR "reading " . scalar(keys %source) . " packages as source rpms from\n"; - print STDERR " $_\n" foreach @from_rpms; - - get_rpms($_, \%target, \%flag, 1) foreach @to_rpms; - print STDERR "reading " . scalar(keys %target) . " packages as target rpms from\n"; - print STDERR " $_\n" foreach @to_rpms; - - sync_medium(\@to_rpms, \@list, \%target, \%flag) if scalar(@list) > 0 && scalar(@to_rpms) > 0; - sync_rpms(\%source, \%target, \%flag) if scalar(@from_rpms) > 0 && scalar(@to_rpms) > 0; -} - -main(@ARGV); diff --git a/tools/updatehdlist b/tools/updatehdlist deleted file mode 100755 index aa59d3f83..000000000 --- a/tools/updatehdlist +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -topdir=$1 -[ -d "$topdir" ] || topdir=/export -[ -d "$topdir" ] || exit 1 -add=$topdir/Mandrake/RPMS2 -[ -d "$add" ] || add=$topdir/Mandrake/RPMS - -./syncrpms --verbose --clean --update --remove --add $add --from /RPMS --to $topdir/Mandrake/RPMS* -gendistrib --noclean --distrib $topdir |
