# HG changeset patch # User Pascal Bellard # Date 1247215827 -7200 # Node ID d5f670b086704ff68252da77ed3d4d0afb5d93f1 # Parent fd3a74d77594d0e468848a4a2f841ad43d61b371 Up syslinux (3.82) + add ifmem.c32 diff -r fd3a74d77594 -r d5f670b08670 syslinux-extra/receipt --- a/syslinux-extra/receipt Thu Jul 09 10:12:42 2009 +0200 +++ b/syslinux-extra/receipt Fri Jul 10 10:50:27 2009 +0200 @@ -1,7 +1,7 @@ # SliTaz package receipt. PACKAGE="syslinux-extra" -VERSION="3.73" +VERSION="3.82" CATEGORY="system-tools" SHORT_DESC="MBR/FAT/EXT3/PXE bootloader files" MAINTAINER="pankso@slitaz.org" diff -r fd3a74d77594 -r d5f670b08670 syslinux-modules/receipt --- a/syslinux-modules/receipt Thu Jul 09 10:12:42 2009 +0200 +++ b/syslinux-modules/receipt Fri Jul 10 10:50:27 2009 +0200 @@ -1,9 +1,9 @@ # SliTaz package receipt. PACKAGE="syslinux-modules" -VERSION="3.73" +VERSION="3.82" CATEGORY="system-tools" -SHORT_DESC="C32 modules for syslinux" +SHORT_DESC="modules for syslinux" MAINTAINER="pankso@slitaz.org" WANTED="syslinux" WEB_SITE="http://syslinux.zytor.com/" @@ -13,7 +13,16 @@ genpkg_rules() { mkdir -p $fs/usr/share/boot - for i in mboot sanboot chain elf reboot ifcpu64 linux sdi menu vesamenu; do - lzma e $src/com32/*/$i.c32 $fs/usr/share/boot/$i.c32.lzma 2> /dev/null + for i in $src/com32/*/*.c32 ; do + case "$i" in + */reboot.c32|*/ifmem.c32) continue;; + esac + lzma e $i $fs/usr/share/boot/$(basename $i).lzma 2> /dev/null + done + for i in $src/modules/*.com ; do + case "$i" in + */poweroff.com) continue;; + esac + cp $i $fs/usr/share/boot/$(basename $i) 2> /dev/null done } diff -r fd3a74d77594 -r d5f670b08670 syslinux-tools/receipt --- a/syslinux-tools/receipt Thu Jul 09 10:12:42 2009 +0200 +++ b/syslinux-tools/receipt Fri Jul 10 10:50:27 2009 +0200 @@ -1,7 +1,7 @@ # SliTaz package receipt. PACKAGE="syslinux-tools" -VERSION="3.73" +VERSION="3.82" CATEGORY="system-tools" SHORT_DESC="Misc perl tools" MAINTAINER="pascal.bellard@slitaz.org" diff -r fd3a74d77594 -r d5f670b08670 syslinux/receipt --- a/syslinux/receipt Thu Jul 09 10:12:42 2009 +0200 +++ b/syslinux/receipt Fri Jul 10 10:50:27 2009 +0200 @@ -1,7 +1,7 @@ # SliTaz package receipt. PACKAGE="syslinux" -VERSION="3.73" +VERSION="3.82" CATEGORY="base-system" SHORT_DESC="LiveCD ISO bootloader (isolinux)" MAINTAINER="pankso@slitaz.org" @@ -17,6 +17,10 @@ { cd $src cp ../stuff/tools/keytab-lilo.pl . + cp ../stuff/extra/ifmem.c com32/modules + grep -q ifmem.c32 com32/modules/Makefile || + sed -i 's/ifcpu64.c32/ifcpu64.c32 ifmem.c32/' com32/modules/Makefile + make -C com32 for i in /usr/share/kbd/keymaps/i386/*/*.map.gz; do [ "$(basename $(dirname $i))" = "include" ] && continue j=$(basename $i) @@ -31,6 +35,8 @@ mkdir -p $fs/boot/isolinux cp -a $src/core/isolinux.bin $fs/boot/isolinux cp -a $src/com32/modules/reboot.c32 $fs/boot/isolinux + cp -a $src/com32/modules/ifmem.c32 $fs/boot/isolinux + cp -a $src/modules/poweroff.com $fs/boot/isolinux cp stuff/*.* $fs/boot/isolinux while read cfg kbd loc ; do sed -e "s/^display/kbdmap $cfg.kbd\ndisplay/" \ diff -r fd3a74d77594 -r d5f670b08670 syslinux/stuff/extra/ifmem.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/syslinux/stuff/extra/ifmem.c Fri Jul 10 10:50:27 2009 +0200 @@ -0,0 +1,77 @@ +/* ----------------------------------------------------------------------- * + * + * Copyright 2009 Pascal Bellard - All Rights Reserved + * + * 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, Inc., 51 Franklin St, Fifth Floor, + * Boston MA 02110-1301, USA; either version 2 of the License, or + * (at your option) any later version; incorporated herein by reference. + * + * ----------------------------------------------------------------------- */ + +/* + * ifmem.c + * + * Run one command if the memory is large enought, and another if it isn't. + * + * Usage: + * + * label boot_kernel + * kernel ifmem.c + * append size_in_KB boot_large [size_in_KB boot_medium] boot_small + * + * label boot_large + * kernel vmlinuz_large_memory + * append ... + * + * label boot_small + * kernel vmlinuz_small_memory + * append ... + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +static long memory_size(void) +{ + com32sys_t ireg, oreg; + + memset(&ireg, 0, sizeof ireg); + + ireg.eax.w[0] = 0xe801; + __intcall(0x15, &ireg, &oreg); + + return oreg.ecx.w[0] + ( oreg.edx.w[0] << 6); +} + +int main(int argc, char *argv[]) +{ + char *s; + int i; + + for (s = argv[1]; *s && (*s < '0' || *s > '9'); s++); + + if (argc < 4 || !*s) { + openconsole(&dev_null_r, &dev_stdcon_w); + perror("\nUsage: ifmem.c32 size_KB boot_large_memory boot_small_memory\n"); + return 1; + } + + for (i = 1; i + 2 < argc; ) { + i++; // size + if (memory_size() >= strtoul(s, NULL, 0)) break; + s = argv[++i]; + } + if (argv[i]) + syslinux_run_command(argv[i]); + else + syslinux_run_default(); + return -1; +}