Ignore:
Timestamp:
Nov 6, 2007, 11:01:53 AM (12 years ago)
Author:
Bruno Cornec
Message:
  • Better output for mindi-busybox revision
  • Remove dummy file created on NFS - report from Arnaud Tiger <arnaud.tiger_at_hp.com>
  • strace useful for debug
  • fix new versions for pb (2.0.0 for mindi and 1.7.2 for mindi-busybox)
  • fix build process for mindi-busybox + options used in that version (dd for label-partitions-as-necessary)
  • fix typo in label-partitions-as-necessary which doesn't seem to work
  • Update to busybox 1.7.2
  • perl is now required at restore time to support uuid swap partitions (and will be used for many other thigs

in the future for sure)

  • next mindi version will be 2.0.0 due to all the changes made in it (udev may break working distros)
  • small optimization in mindi on keyboard handling (one single find instead of multiple)
  • better interaction for USB device when launching mindi manually
  • attempt to automatically guess block disk size for ramdisk
  • fix typos in bkphw
  • Fix the remaining problem with UUID support for swap partitions
  • Updates mondoarchive man page for USB support
  • Adds preliminary Hardware support to mindi (Proliant SSSTK)
  • Tries to add udev support also for rhel4
  • Fix UUID support which was still broken.
  • Be conservative in test for the start-nfs script
  • Update config file for mindi-busybox for 1.7.2 migration
  • Try to run around a busybox bug (1.2.2 pb on inexistant links)
  • Add build content for mindi-busybox in pb
  • Remove distributions content for mindi-busybox
  • Fix a warning on inexistant raidtab
  • Solve problem on tmpfs in restore init (Problem of inexistant symlink and busybox)
  • Create MONDO_CACHE and use it everywhere + creation at start
  • Really never try to eject a USB device
  • Fix a issue with &> usage (replaced with 1> and 2>)
  • Adds magic file to depllist in order to have file working + ldd which helps for debugging issues
  • tty modes correct to avoid sh error messages
  • Use ext3 normally and not ext2 instead
  • USB device should be corrected after reading (take 1st part)
  • Adds a mount_USB_here function derived from mount_CDROM_here
  • usb detection place before /dev detection in device name at restore time
  • Fix when restoring from USB: media is asked in interactive mode
  • Adds USB support for mondorestore
  • mount_cdrom => mount_media
  • elilo.efi is now searched throughout /boot/efi and not in a fixed place as there is no standard
  • untar-and-softlink => untar (+ interface change)
  • suppress useless softlinks creation/removal in boot process
  • avoids udevd messages on groups
  • Increase # of disks to 99 as in mindi at restore time (should be a conf file parameter)
  • skip existing big file creation
  • seems to work correctly for USB mindi boot
  • Adds group and tty link to udev conf
  • Always load usb-torage (even 2.6) to initiate USB bus discovery
  • Better printing of messages
  • Attempt to fix a bug in supporting OpenSusE 10.3 kernel for initramfs (mindi may now use multiple regex for kernel initrd detection)
  • Links were not correctly done as non relative for modules in mindi
  • exclusion of modules denied now works
  • Also create modules in their ordinary place, so that classical modprobe works + copy modules.dep
  • Fix bugs for DENY_MODS handling
  • Add device /dev/console for udev
  • ide-generic should now really be excluded
  • Fix a bug in major number for tty
  • If udev then adds modprobe/insmod to rootfs
  • tty0 is also cretaed with udev
  • ide-generic put rather in DENY_MODS
  • udevd remove from deplist s handled in mindi directly
  • better default for mindi when using --usb
  • Handles dynamically linked busybox (in case we want to use it soon ;-)
  • Adds fixed devices to create for udev
  • ide-generic should not be part of the initrd when using libata v2
  • support a dynamically linked udev (case on Ubuntu 7.10 and Mandriva 2008.0 so should be quite generic) This will give incitation to move to dyn. linked binaries in the initrd which will help for other tasks (ia6 4)
  • Improvement in udev support (do not use cl options not available in busybox)
  • Udev in mindi
    • auto creation of the right links at boot time with udev-links.conf(from Mandriva 2008.0)
    • rework startup of udev as current makes kernel crash (from Mandriva 2008.0)
    • add support for 64 bits udev
  • Try to render MyInsmod? silent at boot time
  • Adds udev support (mandatory for newest distributions to avoid remapping of devices in a different way as on the original system)
  • We also need vaft format support for USB boot
  • Adds libusual support (Ubuntu 7.10 needs it for USB)
  • Improve Ubuntu/Debian? keyboard detection and support
  • pbinit adapted to new pb (0.8.10). Filtering of docs done in it
  • Suppress some mondo warnings and errors on USB again
  • Tries to fix lack of files in deb mindi package
  • Verify should now work for USB devices
  • More log/mesages improvement for USB support
  • - Supress g_erase_tmpdir_and_scratchdir
  • Improve some log messages for USB support
  • Try to improve install in mindi to avoid issues with isolinux.cfg not installed vene if in the pkg :-(
  • Improve mindi-busybox build
  • In conformity with pb 0.8.9
  • Add support for Ubuntu 7.10 in build process
  • Add USB Key button to Menu UI (CD streamer removed)
  • Attempt to fix error messages on tmp/scratch files at the end by removing those dir at the latest possible.
  • Fix a bug linked to the size of the -E param which could be used (Arnaud Tiger/René? Ribaud).
  • Integrate ~/.pbrc content into mondorescue.pb (required project-builder >= 0.8.7)
  • Put mondorescue in conformity with new pb filtering rules
  • Add USB support at restore time (no test done yet). New start-usb script PB varibale added where useful
  • Unmounting USB device before removal of temporary scratchdir
  • Stil refining USB copy back to mondo (one command was not executed)
  • No need to have the image subdor in the csratchdir when USB.
  • umount the USB partition before attempting to use it
  • Remove useless copy from mindi to mondo at end of USB handling

(risky merge, we are raising the limits of 2 diverging branches. The status of stable is not completely sure as such. Will need lots of tests, but it's not yet done :-()
(merge -r1692:1769 $SVN_M/branches/2.2.5)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/stable/mindi-busybox/console-tools/loadfont.c

    r821 r1770  
    88 * (Adapted for busybox by Matej Vela.)
    99 */
    10 #include <stdio.h>
    11 #include <string.h>
    12 #include <fcntl.h>
    13 #include <stdlib.h>
    14 #include <unistd.h>
    15 #include <sys/types.h>
    16 #include <dirent.h>
    17 #include <errno.h>
    18 #include <sys/ioctl.h>
     10#include "libbb.h"
    1911#include <sys/kd.h>
    20 #include <endian.h>
    21 #include "busybox.h"
    2212
    23 enum{
     13enum {
    2414    PSF_MAGIC1 = 0x36,
    2515    PSF_MAGIC2 = 0x04,
     
    3222
    3323struct psf_header {
    34     unsigned char magic1, magic2;   /* Magic number */
    35     unsigned char mode;         /* PSF font mode */
    36     unsigned char charsize;     /* Character size */
     24    unsigned char magic1, magic2;   /* Magic number */
     25    unsigned char mode;             /* PSF font mode */
     26    unsigned char charsize;         /* Character size */
    3727};
    3828
    3929#define PSF_MAGIC_OK(x) ((x).magic1 == PSF_MAGIC1 && (x).magic2 == PSF_MAGIC2)
    4030
    41 static void loadnewfont(int fd);
    42 
    43 int loadfont_main(int argc, char **argv)
    44 {
    45     int fd;
    46 
    47     if (argc != 1)
    48         bb_show_usage();
    49 
    50     fd = bb_xopen(CURRENT_VC, O_RDWR);
    51     loadnewfont(fd);
    52 
    53     return EXIT_SUCCESS;
    54 }
    55 
    5631static void do_loadfont(int fd, unsigned char *inbuf, int unit, int fontsize)
    5732{
    58     char buf[16384];
     33    char *buf;
    5934    int i;
    6035
    61     memset(buf, 0, sizeof(buf));
     36    if (unit < 1 || unit > 32)
     37        bb_error_msg_and_die("bad character size %d", unit);
    6238
    63     if (unit < 1 || unit > 32)
    64         bb_error_msg_and_die("Bad character size %d", unit);
    65 
     39    buf = xzalloc(16 * 1024);
     40    /*memset(buf, 0, 16 * 1024);*/
    6641    for (i = 0; i < fontsize; i++)
    6742        memcpy(buf + (32 * i), inbuf + (unit * i), unit);
    6843
    69 #if defined( PIO_FONTX ) && !defined( __sparc__ )
     44#if defined(PIO_FONTX) && !defined(__sparc__)
    7045    {
    7146        struct consolefontdesc cfd;
     
    7550        cfd.chardata = buf;
    7651
    77         if (ioctl(fd, PIO_FONTX, &cfd) == 0)
    78             return;             /* success */
    79         bb_perror_msg("PIO_FONTX ioctl error (trying PIO_FONT)");
     52        if (!ioctl_or_perror(fd, PIO_FONTX, &cfd, "PIO_FONTX ioctl failed (will try PIO_FONT)"))
     53            goto ret;           /* success */
    8054    }
    8155#endif
    82     if (ioctl(fd, PIO_FONT, buf))
    83         bb_perror_msg_and_die("PIO_FONT ioctl error");
     56    xioctl(fd, PIO_FONT, buf);
     57 ret:
     58    free(buf);
    8459}
    8560
     
    9267    int ct = 0, maxct;
    9368    int glyph;
    94     u_short unicode;
     69    uint16_t unicode;
    9570
    9671    maxct = tailsz;             /* more than enough */
    97     up = (struct unipair *) xmalloc(maxct * sizeof(struct unipair));
     72    up = xmalloc(maxct * sizeof(struct unipair));
    9873
    9974    for (glyph = 0; glyph < fontsize; glyph++) {
    10075        while (tailsz >= 2) {
    101             unicode = (((u_short) inbuf[1]) << 8) + inbuf[0];
     76            unicode = (((uint16_t) inbuf[1]) << 8) + inbuf[0];
    10277            tailsz -= 2;
    10378            inbuf += 2;
     
    11691    advice.advised_hashstep = 0;
    11792    advice.advised_hashlevel = 0;
    118     if (ioctl(fd, PIO_UNIMAPCLR, &advice)) {
    119 #ifdef ENOIOCTLCMD
    120         if (errno == ENOIOCTLCMD) {
    121             bb_error_msg("It seems this kernel is older than 1.1.92");
    122             bb_error_msg_and_die("No Unicode mapping table loaded.");
    123         } else
    124 #endif
    125             bb_perror_msg_and_die("PIO_UNIMAPCLR");
    126     }
     93    xioctl(fd, PIO_UNIMAPCLR, &advice);
    12794    ud.entry_ct = ct;
    12895    ud.entries = up;
    129     if (ioctl(fd, PIO_UNIMAP, &ud)) {
    130 #if 0
    131         if (errno == ENOMEM) {
    132             /* change advice parameters */
    133         }
    134 #endif
    135         bb_perror_msg_and_die("PIO_UNIMAP");
    136     }
     96    xioctl(fd, PIO_UNIMAP, &ud);
    13797}
    13898
    13999static void loadnewfont(int fd)
    140100{
     101    enum { INBUF_SIZE = 32*1024 + 1 };
     102
    141103    int unit;
    142     unsigned char inbuf[32768];         /* primitive */
    143     unsigned int inputlth, offset;
     104    unsigned inputlth, offset;
     105    /* Was on stack, but 32k is a bit too much: */
     106    unsigned char *inbuf = xmalloc(INBUF_SIZE);
    144107
    145108    /*
     
    148111     * just read the entire file.
    149112     */
    150     inputlth = fread(inbuf, 1, sizeof(inbuf), stdin);
    151     if (ferror(stdin))
    152         bb_perror_msg_and_die("Error reading input font");
    153     /* use malloc/realloc in case of giant files;
    154        maybe these do not occur: 16kB for the font,
    155        and 16kB for the map leaves 32 unicode values
    156        for each font position */
    157     if (!feof(stdin))
    158         bb_perror_msg_and_die("Font too large");
     113    inputlth = full_read(STDIN_FILENO, inbuf, INBUF_SIZE);
     114    if (inputlth < 0)
     115        bb_perror_msg_and_die("error reading input font");
     116    if (inputlth >= INBUF_SIZE)
     117        bb_error_msg_and_die("font too large");
    159118
    160119    /* test for psf first */
     
    163122        int fontsize;
    164123        int hastable;
    165         unsigned int head0, head;
     124        unsigned head0, head;
    166125
    167126        if (inputlth < sizeof(struct psf_header))
     
    174133
    175134        if (psfhdr.mode > PSF_MAXMODE)
    176             bb_error_msg_and_die("Unsupported psf file mode");
     135            bb_error_msg_and_die("unsupported psf file mode");
    177136        fontsize = ((psfhdr.mode & PSF_MODE512) ? 512 : 256);
    178 #if !defined( PIO_FONTX ) || defined( __sparc__ )
     137#if !defined(PIO_FONTX) || defined(__sparc__)
    179138        if (fontsize != 256)
    180             bb_error_msg_and_die("Only fontsize 256 supported");
     139            bb_error_msg_and_die("only fontsize 256 supported");
    181140#endif
    182141        hastable = (psfhdr.mode & PSF_MODEHASTAB);
     
    186145        head = head0 + fontsize * unit;
    187146        if (head > inputlth || (!hastable && head != inputlth))
    188             bb_error_msg_and_die("Input file: bad length");
     147            bb_error_msg_and_die("input file: bad length");
    189148        do_loadfont(fd, inbuf + head0, unit, fontsize);
    190149        if (hastable)
     
    192151        return;
    193152    }
    194   no_psf:
    195153
     154 no_psf:
    196155    /* file with three code pages? */
    197156    if (inputlth == 9780) {
     
    201160        /* bare font */
    202161        if (inputlth & 0377)
    203             bb_error_msg_and_die("Bad input file size");
     162            bb_error_msg_and_die("bad input file size");
    204163        offset = 0;
    205164        unit = inputlth / 256;
     
    207166    do_loadfont(fd, inbuf + offset, unit, 256);
    208167}
     168
     169int loadfont_main(int argc, char **argv);
     170int loadfont_main(int argc, char **argv)
     171{
     172    int fd;
     173
     174    if (argc != 1)
     175        bb_show_usage();
     176
     177    fd = xopen(CURRENT_VC, O_RDWR);
     178    loadnewfont(fd);
     179
     180    return EXIT_SUCCESS;
     181}
Note: See TracChangeset for help on using the changeset viewer.