wok-current rev 18140
syslinux/taziso: add floppyset
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Mon Jun 15 16:28:54 2015 +0200 (2015-06-15) |
parents | f3e78a86c67b |
children | d58afc905764 |
files | chkrootkit/stuff/chkrootkit.u syslinux/stuff/iso2exe/Makefile syslinux/stuff/iso2exe/bootloader.S syslinux/stuff/iso2exe/taziso |
line diff
1.1 --- a/chkrootkit/stuff/chkrootkit.u Mon Jun 15 09:25:34 2015 +0200 1.2 +++ b/chkrootkit/stuff/chkrootkit.u Mon Jun 15 16:28:54 2015 +0200 1.3 @@ -1,5 +1,5 @@ 1.4 ---- chkrootkit-0.48/chkrootkit 1.5 -+++ chkrootkit-0.48/chkrootkit 1.6 +--- chkrootkit-0.50/chkrootkit 1.7 ++++ chkrootkit-0.50/chkrootkit 1.8 @@ -591,8 +591,13 @@ 1.9 if [ ! -z "${SHELL}" -a ! -z "${HOME}" ]; then 1.10 expertmode_output "${find} ${ROOTDIR}${HOME} ${findargs} -name .*history \ 1.11 @@ -15,7 +15,7 @@ 1.12 fi 1.13 1.14 return 5 1.15 -@@ -991,7 +996,9 @@ 1.16 +@@ -986,7 +991,9 @@ 1.17 ### Suckit 1.18 if [ -f ${ROOTDIR}sbin/init ]; then 1.19 if [ "${QUIET}" != "t" ];then printn "Searching for Suckit rootkit... "; fi 1.20 @@ -26,7 +26,7 @@ 1.21 cat ${ROOTDIR}/proc/1/maps | ${egrep} "init." ) >/dev/null 2>&1 1.22 then 1.23 echo "Warning: ${ROOTDIR}sbin/init INFECTED" 1.24 -@@ -1190,7 +1195,12 @@ 1.25 +@@ -1190,7 +1197,12 @@ 1.26 files=`${find} ${ROOTDIR}${HOME} ${findargs} -name '.*history' -size 0` 1.27 [ ! -z "${files}" ] && \ 1.28 echo "Warning: \`${files}' file size is zero" 1.29 @@ -38,9 +38,9 @@ 1.30 + fi 1.31 + files1=`eval ${find} ${ROOTDIR}${HOME} ${findargs} -name '.*history' $files1` 1.32 [ ! -z "${files1}" ] && \ 1.33 - echo "Warning: \`${files}' is linked to another file" 1.34 + echo "Warning: \`${files1}' is linked to another file" 1.35 fi 1.36 -@@ -1600,6 +1610,9 @@ 1.37 +@@ -1600,6 +1612,9 @@ 1.38 chk_netstat () { 1.39 STATUS=${NOT_INFECTED} 1.40 NETSTAT_I_L="/dev/hdl0/dev/xdta|/dev/ttyoa|/dev/pty[pqrsx]|/dev/cui|/dev/hdn0|/dev/cui221|/dev/dszy|/dev/ddth3|/dev/caca|^/prof|/dev/tux|grep|addr\.h|__bzero"
2.1 --- a/syslinux/stuff/iso2exe/Makefile Mon Jun 15 09:25:34 2015 +0200 2.2 +++ b/syslinux/stuff/iso2exe/Makefile Mon Jun 15 16:28:54 2015 +0200 2.3 @@ -2,7 +2,11 @@ 2.4 BCC=bcc -ansi -O -0 -C-t 2.5 BCCFLAGS=-D__MSDOS__ -Md 2.6 2.7 -all: isohybrid.exe iso2exe meminfo.exe tazboot.exe 2.8 +all: isohybrid.exe iso2exe meminfo.exe tazboot.exe taziso.built 2.9 + 2.10 +taziso.built: bootloader.bin 2.11 + ./taziso --build 2.12 + touch taziso.built 2.13 2.14 meminfo.exe: meminfo.S 2.15 cc -o meminfo.o -Wa,-a=meminfo.lst -c meminfo.S
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/syslinux/stuff/iso2exe/bootloader.S Mon Jun 15 16:28:54 2015 +0200 3.3 @@ -0,0 +1,514 @@ 3.4 +BOOTSEG = 0x07C0 /* original address of boot-sector */ 3.5 +SYSSEG = 0x1000 /* historical load address >> 4 */ 3.6 +INITSEG = 0x9000 /* boot address >> 4 */ 3.7 +SETUPSEG = 0x9020 /* setup address >> 4 */ 3.8 +ASK_VGA = -3 3.9 + 3.10 +#ifndef SVGA_MODE 3.11 +#define SVGA_MODE ASK_VGA 3.12 +#endif 3.13 + 3.14 +#ifndef RAMDISK 3.15 +#define RAMDISK 0 3.16 +#endif 3.17 + 3.18 +#ifndef ROOT_RDONLY 3.19 +#define ROOT_RDONLY 1 3.20 +#endif 3.21 + 3.22 +/* some extra features */ 3.23 +#define CMDLINE kernel >= 2.4 3.24 +#define OLDCMDLINE kernel < 2.4 3.25 +#define HELP display version for ? argument 3.26 +#define MORETHAN16M up to 4Gb RAM, not 16Mb 3.27 +#define KEYBOARDLESS_SUPPORT scan floppy swap each 5 seconds 3.28 + 3.29 +#define EDIT_CMDLINE 3.30 +#define CMDLINE_SUPPORT 3.31 +#define MOVE_CMDLINE 3.32 +#define INITRD_SUPPORT 3.33 +#define INITRD_AUTOADDR 3.34 +#define MULTI_INITRD many in one support 3.35 + 3.36 + .code16 3.37 + .org 0 3.38 + 3.39 +bootsect_start: 3.40 + 3.41 +cur_initrd_size_ofs = 494 3.42 +ramdisk_image_ofs = 0x218 3.43 +ramdisk_image = bootsect_start+ramdisk_image_ofs 3.44 +ramdisk_size_ofs = 0x21C 3.45 +ramdisk_size = bootsect_start+ramdisk_size_ofs 3.46 +cmd_line_ptr_ofs = 0x228 3.47 +cmd_line_ptr = bootsect_start+cmd_line_ptr_ofs 3.48 +setup_sects = bootsect_start+497 3.49 +syssize = bootsect_start+500 3.50 +boot_flag_ofs = 510 3.51 +boot_flag = bootsect_start+boot_flag_ofs 3.52 + 3.53 + 3.54 +stacktop = 0x9E00 # in 0x8000 .. 0xA000 3.55 +zeroed = 48+10 # gdt + zeroed registers 3.56 +.macro INIT_REGS 3.57 + movw $stacktop-zeroed, %di # stacktop is an arbitrary value >= 3.58 + # length of bootsect + length of 3.59 + # setup + room for stack; 3.60 + # 12 is disk parm size. 3.61 + pushw $INITSEG 3.62 + popw %ss # %ss contain INITSEG 3.63 + movw %di, %sp # put stack at INITSEG:stacktop-... 3.64 + pushw %ss 3.65 + popw %es # %es = %ss = INITSEG 3.66 + xorw %ax, %ax # %ax = 0 3.67 +#if defined(CMDLINE) 3.68 + movw $zeroed+1, %cx # clear gdt + offset, %ds, limits, cmdline="" 3.69 + rep # don't worry about cld 3.70 + stosb # already done above 3.71 + decw %di 3.72 +#else 3.73 + movw $zeroed/2, %cx # clear gdt + offset, %ds, limits 3.74 + rep # don't worry about cld 3.75 + stosw # already done above 3.76 +#endif 3.77 + popw %bx # offset = 0 3.78 +.endm 3.79 + 3.80 +LOADSEG = 0x8000 # 0x1000 multiple, up to 512K zImage 3.81 +LOADSZ = 0x10000 3.82 + 3.83 +# bootsect_start: 3.84 + INIT_REGS 3.85 + popw %ds # %ds = 0 3.86 + movb setup_sects+0x7C00, %al # read bootsector + setup 3.87 + incw %ax # %ax = setup_sects+bootsect 3.88 + popw %fs # %fs = 0 3.89 + 3.90 +# Many BIOS's default disk parameter tables will not recognize 3.91 +# multi-sector reads beyond the maximum sector number specified 3.92 +# in the default diskette parameter tables - this may mean 7 3.93 +# sectors in some cases. 3.94 +# 3.95 +# Since single sector reads are slow and out of the question, 3.96 +# we must take care of this by creating new parameter tables 3.97 +# (for the first disk) in RAM. We can set the maximum sector 3.98 +# count to 36 - the most we will encounter on an ED 2.88. 3.99 +# 3.100 +# High doesn't hurt. Low does. Let's use the max: 63 3.101 + 3.102 + ldsw 0x78(%bx), %si # %ds:%bx+0x78 is parameter table address 3.103 + popw %di 3.104 + pushw %es 3.105 + pushw %di 3.106 +#ifdef CMDLINE_SUPPORT 3.107 + movw $0, %bp # patched by installer (7C22) 3.108 +skipcmdline: 3.109 +#define cmd_line_ptr 0x22 3.110 +#endif 3.111 + movb $6, %cl # copy 12 bytes 3.112 + rep # don't worry about cld 3.113 + movsw # already done above 3.114 + pushw %ss 3.115 + popw %ds # now %ds = %es = %ss = INITSEG 3.116 + popl %fs:0x78(%bx) # update parameter table address 3.117 + movb $63, 0x4-12(%di) # patch sector count, %di = stacktop 3.118 + cli 3.119 + 3.120 + xchg %ax, %di # sector count 3.121 + popw %ax # limits = 0 3.122 + incw %cx # cylinder 0, sector 1, clear Z 3.123 + call read_first_sectors # read setup 3.124 +loadsys: 3.125 + movw $0x200,%si 3.126 +type_of_loader = 0x10 3.127 +loadflags = 0x11 3.128 +heap_end_ptr = 0x24 3.129 + orw $0x8020, type_of_loader(%si) # loader type = 0x20 = bootsect-loader 3.130 + movb $(stacktop-0x300)/256, heap_end_ptr+1(%si) 3.131 + call puts_version # show which kernel we are loading 3.132 + 3.133 +#ifdef CMDLINE_SUPPORT 3.134 +# The cmdline can be entered and modifed at boot time. 3.135 +# Only characters before the cursor are passed to the kernel. 3.136 + 3.137 + xorw %si, %si 3.138 + orw cmd_line_ptr-7(%bx), %si 3.139 + jz nocmdline 3.140 +#ifdef OLDCMDLINE 3.141 + movw $0xA33F, cmd_line_ptr-2-7(%bx) 3.142 +#endif 3.143 + call puts 3.144 +#if defined(MOVE_CMDLINE) || (defined(EDIT_CMDLINE) && defined(KEYBOARDLESS_SUPPORT)) 3.145 + pushw %di 3.146 +#endif 3.147 +#ifdef EDIT_CMDLINE 3.148 +cmdlp: 3.149 + movb $0x20, %al # clear end of line 3.150 +cmdlpz: 3.151 + call putc # with Space 3.152 + subb $0x18, %al # and BackSpace 3.153 + jnc cmdlpz 3.154 + decw %si 3.155 +cmdget: 3.156 +#ifdef KEYBOARDLESS_SUPPORT 3.157 + call wait4key 3.158 +#else 3.159 + int $0x16 3.160 +#endif 3.161 + cbw # %ah = 0, get keyboard character 3.162 + cmpb $8, %al # BackSpace ? 3.163 + je cmdbs 3.164 + movb %al, (%si) # store char 3.165 + lodsw # %si += 2 3.166 +cmdbs: 3.167 + cmpw %si, cmd_line_ptr-7(%bx) 3.168 + je cmdget 3.169 + call putc 3.170 + cmpb $10, %al # Enter/linefeed ? 3.171 + jne cmdlp 3.172 + movb %bh,-2(%si) # set end of string and remove CR 3.173 +endcmdline: 3.174 +#endif 3.175 +#ifdef MOVE_CMDLINE 3.176 + pushw %ss 3.177 + popw %es 3.178 + movw $0x8000, %di 3.179 + movw %di, %si 3.180 + xchgw %si, cmd_line_ptr-7(%bx) 3.181 + movb $0x2, %ch 3.182 + rep 3.183 + movsb 3.184 +#endif 3.185 +#if defined(EDIT_CMDLINE) || (defined(MOVE_CMDLINE) && defined(KEYBOARD_TIMEOUT)) 3.186 + popw %di 3.187 +#endif 3.188 +nocmdline: 3.189 +#endif 3.190 + 3.191 +# This routine loads the system at address LOADSEG, making sure 3.192 +# no 64kB boundaries are crossed. We try to load it as fast as 3.193 +# possible, loading whole tracks whenever we can. 3.194 + 3.195 +.macro autoaddr base 3.196 +#ifdef INITRD_AUTOADDR 3.197 + movb $0x88, %ah 3.198 + int $0x15 3.199 + //jc NeedMoreRAM # error code 80 or 86 3.200 + cmpw $0xC000, %ax # more than 49M ? 3.201 + jb NeedMoreRAM 3.202 + movb %ch, bootsect_dst_base_hi(%si) # initramfs @ 32M 3.203 + movb %ch, ramdisk_image_ofs+3-\base 3.204 +NeedMoreRAM: 3.205 +#endif 3.206 +.endm 3.207 + 3.208 +bootsect_src_limit = 16 3.209 +bootsect_dst_limit = 24 3.210 +bootsect_src_base = 18 3.211 +bootsect_dst_base = 26 # bits 0..23 3.212 +bootsect_dst_base_hi = 31 # bits 24..31 3.213 + popw %bx # clear %bx 3.214 + movw %sp, %si # for bootsect_gdt 3.215 +init_gdt: 3.216 + decw bootsect_src_limit(%bx,%si) # max 64Kb 3.217 + movw $0x9300+(LOADSEG/0x1000), bootsect_src_base+2(%bx,%si) 3.218 + xorb $bootsect_dst_limit-bootsect_src_limit, %bl 3.219 + jne init_gdt 3.220 +#ifdef INITRD_SUPPORT 3.221 + movw $syssize, %bx 3.222 + movb $5, %cl 3.223 +code32_start = 0x214 3.224 + movw code32_start+1, %ax # destination = 0x00100000 or 0x00010000 3.225 +initrdlp: 3.226 + movl (%bx), %ebx 3.227 + decl %ebx 3.228 + shrl %cl, %ebx 3.229 +#else 3.230 +code32_start = 0x214 3.231 + movw code32_start+1, %ax # destination = 0x00100000 or 0x00010000 3.232 + movl syssize, %ebx 3.233 + decl %ebx 3.234 + shrl $5, %ebx 3.235 +#endif 3.236 +#ifdef MORETHAN16M 3.237 + incl %ebx 3.238 +#else 3.239 + incw %bx 3.240 +#endif 3.241 +syslp: 3.242 + movw %ax, bootsect_dst_base+1(%si) 3.243 +#ifdef MORETHAN16M 3.244 + movl $LOADSZ/512, %edi # size in sectors 3.245 + subl %edi, %ebx 3.246 +#else 3.247 + movw $LOADSZ/512, %di # size in sectors 3.248 + subw %di, %bx 3.249 +#endif 3.250 + pushf 3.251 + jnc not_last 3.252 + addw %bx, %di 3.253 +not_last: 3.254 +#ifdef MULTI_INITRD 3.255 + pushw %di 3.256 +#endif 3.257 + pushw %ax 3.258 + pushw %bx 3.259 + pushw %si 3.260 + xorw %bx,%bx 3.261 + pushw $LOADSEG 3.262 + popw %es 3.263 +patchcall: 3.264 + call read_sectors # update %bp 3.265 + popw %si 3.266 + popw %bx 3.267 + movw %es, %cx # word count = LOADSZ/2 (= LOADSEG) 3.268 + movb $0x87, %ah 3.269 + pushw %ss 3.270 + popw %es # restore es 3.271 + int $0x15 # max 16M, maybe more... 3.272 + popw %ax 3.273 +#ifdef MULTI_INITRD 3.274 + popw %di 3.275 + shlw $1,%di # sectors to pages 3.276 + addw %di, %ax 3.277 +#ifdef MORETHAN16M 3.278 + adcb %cl, bootsect_dst_base_hi(%si) # breaks 16M limit ? 3.279 +#endif 3.280 +#else 3.281 +#ifdef MORETHAN16M 3.282 + addw $0x100, %ax # next dest (ax+=LOADSZ/256) 3.283 + adcb %cl, bootsect_dst_base_hi(%si) # breaks 16M limit ? 3.284 +#else 3.285 + incb %ah # next dest (ax+=LOADSZ/256) 3.286 +#endif 3.287 +#endif 3.288 + popf 3.289 + ja syslp 3.290 +#ifdef INITRD_SUPPORT 3.291 +initrdlp2: 3.292 +#ifdef INITRD_AUTOADDR 3.293 + movw $0x209, %cx 3.294 +#else 3.295 + movb $9, %cl 3.296 +#endif 3.297 +#ifdef MULTI_INITRD 3.298 + movw $cur_initrd_size_ofs, %di 3.299 + movw (%di), %bx 3.300 + addw $4, (%di) 3.301 + shrw %cl, boot_flag_ofs-cur_initrd_size_ofs(%di) 3.302 + je nextInitrd 3.303 + orw %bx, %bx 3.304 + je bootit # no initrd 3.305 + autoaddr cur_initrd_size_ofs(%di) 3.306 + movw ramdisk_image+1,%ax 3.307 + jmp initrdlp 3.308 +nextInitrd: 3.309 + pushw %bx 3.310 + movl -4(%bx), %ebx 3.311 + addl %ebx, ramdisk_size_ofs-cur_initrd_size_ofs(%di) 3.312 + popw %bx 3.313 + cmpb 2(%di), %bl 3.314 + jb initrdlp 3.315 +#else 3.316 + movw $ramdisk_size, %bx 3.317 + autoaddr ramdisk_size_ofs(%bx) 3.318 + movw ramdisk_image+1,%ax 3.319 +#ifdef MORETHAN16M 3.320 + cmpb %cl, ramdisk_image+2-ramdisk_size(%bx) 3.321 + jb bootit 3.322 + shrw %cl, boot_flag-ramdisk_size(%bx) 3.323 + jne initrdlp 3.324 +#else 3.325 + cmpw %ax, bootsect_dst_base+1(%si) 3.326 + jb initrdlp 3.327 +#endif 3.328 +#endif 3.329 +#endif 3.330 +#ifdef MULTI_INITRD 3.331 +bootit: 3.332 + jcxz read_sectorslp 3.333 +#endif 3.334 + 3.335 +# This procedure turns off the floppy drive motor, so 3.336 +# that we enter the kernel in a known state, and 3.337 +# don't have to worry about it later. 3.338 + 3.339 +kill_motor: 3.340 + xchgw %ax, %di # reset FDC (%di < 128) 3.341 + int $0x13 3.342 + 3.343 +# After that (everything loaded), we jump to the setup-routine 3.344 +# loaded directly after the bootblock: 3.345 +# Segments are as follows: %ds = %ss = INITSEG 3.346 + 3.347 + ljmp $SETUPSEG, $0 3.348 + 3.349 +# read_sectors reads %di sectors into %es:0 buffer. 3.350 +# %es:0 is updated to the next memory location. 3.351 +# First, sectors are read sector by sector until 3.352 +# sector per track count is known. Then they are 3.353 +# read track by track. 3.354 +# Assume no error on first track. 3.355 + 3.356 +#define FLOPPY_CYLINDERS 80 3.357 +#define FLOPPY_HEADS 2 3.358 + 3.359 +check_limits: 3.360 + popw %dx 3.361 + cmpb %al, %cl # max sector known ? 3.362 + ja next_head # no -> store it 3.363 + pushaw 3.364 + int $0x13 # reset controler 3.365 + stc 3.366 + call putcdot # print '-' 3.367 +read_sectorslp: 3.368 + popaw 3.369 +bdendlp: 3.370 + pushw %dx # some bios break dx... 3.371 + pushw %ax # limits 3.372 + subb %cl, %al # sectors remaining in track 3.373 + ja tolastsect 3.374 + movb $1, %al # 1 sector mini 3.375 +tolastsect: 3.376 + cmpw %di, %ax 3.377 + jb more1trk 3.378 + movw %di, %ax # sectors to read 3.379 +more1trk: 3.380 + pushw %ax # save context 3.381 + movb $2, %ah # cmd: read chs 3.382 + int $0x13 3.383 + popw %dx # save %ax 3.384 + popw %ax # limits 3.385 + jc check_limits 3.386 + xchgw %ax, %bp 3.387 + addw %dx,%cx # next sector 3.388 + movw %cx, %gs 3.389 + addb %dl,%bh 3.390 + addb %dl,%bh # next location 3.391 + subw %dx,%di # update sector counter 3.392 + popw %dx 3.393 + jz putcdot 3.394 +read_sectors: 3.395 + movw %gs, %cx 3.396 +# al is last sector+1 3.397 +# ah is 0 3.398 + xchgw %ax, %bp 3.399 + cmpb %al,%cl # reach sector limit ? 3.400 + jne bdendlp 3.401 +next_head: 3.402 + movb %cl,%al 3.403 + movb $1, %cl # first sector 3.404 +inc_head: 3.405 + xorb %cl, %dh # next head 3.406 + jne bdendlp # reach head limit ? 3.407 + incb %ch # next cylinder 3.408 +read_first_sectors: 3.409 + cmpb $FLOPPY_CYLINDERS,%ch # reach cylinder limit ? 3.410 + jne bdendlp 3.411 +next_floppy: 3.412 + movb $0,%ch # first cylinder 3.413 + pushaw 3.414 + movw $swap_floppy,%si 3.415 +#ifdef KEYBOARDLESS_SUPPORT 3.416 + pushw %bx 3.417 + call puts 3.418 + popw %bx 3.419 + movw %si, %bp 3.420 +waitfloppy: 3.421 + call wait 3.422 + jne waitfloppydone 3.423 +#ifdef MULTI_INITRD 3.424 + decb (%si) # max_timeouts 3.425 + jz gobootit 3.426 +#endif 3.427 + pushw %dx # some bios break dx... 3.428 + cbw 3.429 + int $0x13 # reset FDC 3.430 + movw $0x201,%ax 3.431 + int $0x13 # read first sector 3.432 + popw %dx 3.433 + rclb $1,%ah # floppy changed 06=>0D no error 00 3.434 + cmpb -2(%bp), %ah # 0D then 00 3.435 + jne waitfloppy # no => try again 3.436 + incw %bp 3.437 + decw %ax # was 0001 ? 3.438 + jne waitfloppy 3.439 +waitfloppydone: 3.440 +#else 3.441 + call puts 3.442 + cbw # %ah = 0, get keyboard character 3.443 + int $0x16 3.444 +#endif 3.445 +#ifdef MULTI_INITRD 3.446 + orb $0x20, %al 3.447 + cmp $'b', %al 3.448 + jnz read_sectorslp 3.449 +gobootit: 3.450 + //movw ramdisk_size+2-max_timeouts(%si), %cx 3.451 + .byte 0x8B, 0x4C, ramdisk_size+2-max_timeouts 3.452 + jmp bootit 3.453 +#else 3.454 + jmp read_sectorslp 3.455 +#endif 3.456 + 3.457 +putcdot: 3.458 + movb $'.'+3, %al // . = success, - = failure 3.459 +putclf: 3.460 + sbbb $3, %al 3.461 +putc: 3.462 + movb $0xe, %ah 3.463 + movw $7, %bx # one dot each 64k 3.464 + int $0x10 3.465 + cmp $0xd, %al # CR ? 3.466 + je putclf 3.467 + ret 3.468 + 3.469 +#ifdef KEYBOARDLESS_SUPPORT 3.470 +clock = 0x46C 3.471 +wait: 3.472 +wait4key: 3.473 + movw $clock, %di 3.474 +#define DELAY 5 3.475 + movb $257-(DELAY*182)/10, %fs:(%di) 3.476 +waitkbd: 3.477 + movw $0x10D, %ax # test keyboard, timeout => CR 3.478 + cmpb %fs:(%di),%ah 3.479 + je waitdone 3.480 + int $0x16 3.481 + jz waitkbd 3.482 + cbw 3.483 + int $0x16 # eat char 3.484 + movw %di, %fs # disable timeout 3.485 + incw %di # clear Z 3.486 +waitdone: 3.487 + ret 3.488 +#endif 3.489 + 3.490 +#define kernel_version_offset 0xE 3.491 +puts_version: 3.492 + addw kernel_version_offset(%si),%si # starting protocol 2.00, Kernel 1.3.73 3.493 +puts: 3.494 + movb $0xd, %al # CR 3.495 +putcs: 3.496 + call putc 3.497 + lodsb 3.498 + cmpb $0, %al # end of string is any byte <= 0 3.499 + jg putcs 3.500 + ret 3.501 + 3.502 +swap_floppy: 3.503 +#ifdef MULTI_INITRD 3.504 + .ascii "B or " 3.505 +#endif 3.506 + .ascii "Next!" 3.507 + .byte 7,13,0 # swap detection needs 13, 0 3.508 +#ifdef MULTI_INITRD 3.509 +max_timeouts: 3.510 + .byte 20 3.511 +table: 3.512 + .org cur_initrd_size_ofs 3.513 +cur_initrd_size: 3.514 + .word table 3.515 + .byte table+4-256 3.516 +#endif 3.517 + .org 0x1F1
4.1 --- a/syslinux/stuff/iso2exe/taziso Mon Jun 15 09:25:34 2015 +0200 4.2 +++ b/syslinux/stuff/iso2exe/taziso Mon Jun 15 16:28:54 2015 +0200 4.3 @@ -32,18 +32,14 @@ 4.4 gettazboot() 4.5 { 4.6 echo "Creating $(basename $1) ..." 4.7 - if [ $(get 0 "$ISO") -eq 23117 ]; then 4.8 - O=$(($(get 64 "$ISO") - 0xC0)) 4.9 - L=$(($(get 20 "$ISO") - 0xC0 - $(get 24 "$ISO") - $O)) 4.10 - S=$((32+$L)) 4.11 - P=$((($S+511)/512)) 4.12 - E=$((4096-(32*$P))) 4.13 - words2bin 0x5A4D $(($S%512)) $P 0 2 $E -1 $((${2:-0}-16)) \ 4.14 - -2 0 256 -16 28 0x6C53 0x5469 0x7A61 > $1 4.15 - ddq bs=1 count=$L skip=$(echo $O) if="$ISO" >> $1 4.16 - else 4.17 - wget -O $1 http://mirror.slitaz.org/boot/tazboot.exe 4.18 - fi 4.19 + O=$(($(get 64 $ISO) - 0xC0)) 4.20 + L=$(($(get 20 $ISO) - 0xC0 - $(get 24 $ISO) - $O)) 4.21 + S=$((32+$L)) 4.22 + P=$((($S+511)/512)) 4.23 + E=$((4096-(32*$P))) 4.24 + words2bin 0x5A4D $(($S%512)) $P 0 2 $E -1 $((${2:-0}-16)) \ 4.25 + -2 0 256 -16 28 0x6C53 0x5469 0x7A61 > $1 4.26 + ddq bs=1 count=$L skip=$(echo $O) if=$ISO >> $1 4.27 } 4.28 4.29 uncpio() 4.30 @@ -415,7 +411,9 @@ 4.31 mnt=/tmp/mnt$$ 4.32 mkdir -p $mnt 4.33 $1 $2 || return 4.34 - wget -O $mnt/slitaz/boot/grldr http://mirror.slitaz.org/boot/grldr 4.35 + for i in bootlace.com grubinst.exe grldr ; do 4.36 + wget -O $mnt/slitaz/boot/$i http://mirror.slitaz.org/boot/$i 4.37 + done 4.38 readtazbootconf 4.39 cat > $mnt/slitaz/boot/menu.lst <<EOT 4.40 title SliTaz 4.41 @@ -461,11 +459,13 @@ 4.42 C:\\> attrib +r +h +s boot.ini 4.43 4.44 See http://diddy.boot-land.net/grub4dos/files/README_GRUB4DOS.txt 4.45 +and http://xpt.sourceforge.net/techdocs/nix/disk/boot/boot07-GrubForDosInfo/ar01s03.html 4.46 EOT 4.47 - ( cd $mnt ; zip -r9 $(basename "$ISO" .iso).zip slitaz ) 4.48 + ( cd $mnt ; echo 'See \slitaz\boot\install.txt to launch SliTaz.' | \ 4.49 + zip -zr9 $(basename $ISO .iso).zip slitaz ) 4.50 [ "$(which advzip)" ] && advzip -z4 $mnt/*.zip 4.51 mv $mnt/*.zip . 4.52 - ls -l $PWD/$(basename "$ISO" .iso).zip 4.53 + ls -l $PWD/$(basename $ISO .iso).zip 4.54 umount $mnt 4.55 rm -rf $mnt 4.56 } 4.57 @@ -805,17 +805,22 @@ 4.58 4.59 ishybrid() 4.60 { 4.61 - [ $(get 510 "$ISO") -eq 43605 ] || return 4.62 - C=$((2048*$(get $(((17*2048) + 71)) "$ISO" 4))) 4.63 - [ $(get $C "$ISO" 4) -eq 1 ] || return 4.64 - [ $(get $(($C+30)) "$ISO" 4) -eq $((0x88AA55)) ] || return 4.65 - C=$((2048*$(get $(($C+40)) "$ISO" 4))) 4.66 - [ $(get $(($C+64)) "$ISO" 4) -eq 1886961915 ] && menuitem "$@" 4.67 + [ $(get 510 $ISO) -eq 43605 ] || return 4.68 + C=$((2048*$(get $(((17*2048) + 71)) $ISO 4))) 4.69 + [ $(get $C $ISO 4) -eq 1 ] || return 4.70 + [ $(get $(($C+30)) $ISO 4) -eq $((0x88AA55)) ] || return 4.71 + C=$((2048*$(get $(($C+40)) $ISO 4))) 4.72 + [ $(get $(($C+64)) $ISO 4) -eq 1886961915 ] && menuitem "$@" 4.73 } 4.74 4.75 isiso() 4.76 { 4.77 - [ $(get 32769 "$ISO" 4) -eq 808469571 ] && menuitem "$@" 4.78 + [ $(get 32769 $ISO 4) -eq 808469571 ] && menuitem "$@" 4.79 +} 4.80 + 4.81 +hastazboot() 4.82 +{ 4.83 + [ $(get 0 $ISO) -eq 23117 ] && menuitem "$@" 4.84 } 4.85 4.86 burnable() 4.87 @@ -842,22 +847,22 @@ 4.88 gotisomd5() 4.89 { 4.90 [ "$(which md5sum 2> /dev/null)" ] && 4.91 - [ $(get 0 "$ISO") -eq 23117 ] && 4.92 - [ $(get 18 "$ISO") -ne 0 ] && menuitem "$@" 4.93 + [ $(get 0 $ISO) -eq 23117 ] && 4.94 + [ $(get 18 $ISO) -ne 0 ] && menuitem "$@" 4.95 } 4.96 4.97 isomd5() 4.98 { 4.99 dotwait "Checking iso image" 4.100 - [ "$(ddq if="$ISO" bs=2k skip=16 \ 4.101 - count=$(echo $(get 32848 "$ISO" 4)) | md5sum)" == \ 4.102 - "$(ddq if="$ISO" bs=16 count=1 skip=2047 | od -N 16 -t x1 -An | \ 4.103 + [ "$(ddq if=$ISO bs=2k skip=16 \ 4.104 + count=$(echo $(get 32848 $ISO 4)) | md5sum)" == \ 4.105 + "$(ddq if=$ISO bs=16 count=1 skip=2047 | od -N 16 -t x1 -An | \ 4.106 sed 's/ //g') -" ] && echo "OK" || echo "ERROR" 4.107 echo -en "\rChecking iso hybrid boot..." 4.108 - n=$(($(get 2 "$ISO")-1+($(get 4 "$ISO")-1)*512)) 4.109 + n=$(($(get 2 $ISO)-1+($(get 4 $ISO)-1)*512)) 4.110 if [ $n -lt 40000 -a $n -gt 32768 ]; then 4.111 - s=$(get 0 "$ISO" 2 $n | awk '{ i+= $0 } END { print i }') 4.112 - [ $(((1+$s+$(get $(($n+1)) "$ISO" 1)) % 65536)) -eq 0 ] && 4.113 + s=$(get 0 $ISO 2 $n | awk '{ i+= $0 } END { print i }') 4.114 + [ $(((1+$s+$(get $(($n+1)) $ISO 1)) % 65536)) -eq 0 ] && 4.115 echo "OK" || echo "ERROR" 4.116 fi 4.117 rm -f /tmp/wait 4.118 @@ -921,8 +926,8 @@ 4.119 usbdev || return 4.120 4.121 # perform dd in progress bar 4.122 - max=$(($(stat -c %s "$ISO")/2048)) 4.123 - i=0; ddq if="$ISO" bs=1024k | ( 4.124 + max=$(($(stat -c %s $ISO)/2048)) 4.125 + i=0; ddq if=$ISO bs=1024k | ( 4.126 while ddq bs=1024k count=1 ; do 4.127 i=$(($i + 1)) 4.128 [ $i -gt $max ] && break 4.129 @@ -992,7 +997,7 @@ 4.130 exec 3>&- 4.131 [ $retval -eq 0 ] || return 4.132 [ "$format" != "none" ] && tazusb format $device "SliTaz" $format 4.133 - tazusb gen-iso2usb "$ISO" $device 4.134 + tazusb gen-iso2usb $ISO $device 4.135 } 4.136 4.137 dokexec() 4.138 @@ -1014,8 +1019,8 @@ 4.139 4.140 flavdata() 4.141 { 4.142 - [ $(get 512 "$ISO") -eq 35615 ] && n=1 || n=$((1+$(get 417 "$ISO" 1))) 4.143 - dd if="$ISO" bs=512 skip=$n count=20 2>/dev/null | zcat 2>/dev/null 4.144 + [ $(get 1024 $ISO) -eq 35615 ] && n=2 || n=$((1+$(get 417 $ISO 1))) 4.145 + dd if=$ISO bs=512 skip=$n count=20 2>/dev/null | zcat 2>/dev/null 4.146 } 4.147 4.148 hasflavinfo() 4.149 @@ -1044,6 +1049,135 @@ 4.150 rm -rf /tmp/data 4.151 } 4.152 4.153 +if [ "$1" == "--build" ]; then #install-begin 4.154 + uuencode -m - < bootloader.bin | sed -e '/^bootloader$/r/dev/stdin' \ 4.155 + -e '/^bootloader$/d' -e '/install-begin$/,/install-end$/d' -i $0 4.156 + exit 4.157 +fi #install-end 4.158 +parse_isolinux() 4.159 +{ 4.160 + awk 'BEGIN { IGNORECASE=1 } 4.161 +{ 4.162 + if ($1 == "LABEL") { 4.163 + label=$2 4.164 + if (auto == "") auto=label 4.165 + } 4.166 + if ($1 == "KERNEL" || $1 == "COM32") kernel[label]=$2 4.167 + if ($1 == "INITRD") initrd[label]=$2 4.168 + if ($1 == "APPEND") { 4.169 + i=2 4.170 + if (kernel[label] ~ "ifmem.c32") { 4.171 + auto=$3 4.172 + next 4.173 + } 4.174 + if (kernel[label] ~ "c32box.c32") { 4.175 + if ($2 == "linux") { kernel[label]=$3; i=4 } 4.176 + if ($2 == "ifmem") { auto=$4; next } 4.177 + } 4.178 + if (kernel[label] ~ "ifcpu64.c32") { auto=$4; next } 4.179 + while (i <= NF) { 4.180 + if ($i ~ "^initrd=") initrd[label]=substr($i,8) 4.181 + else cmdline[label]=cmdline[label] " " $i 4.182 + i++ 4.183 + } 4.184 + } 4.185 +} 4.186 +END { 4.187 + print "KERNEL=\"" kernel[auto] "\"" 4.188 + print "INITRD=\"" initrd[auto] "\"" 4.189 + print "CMDLINE=\"" substr(cmdline[auto],2) "\"" 4.190 +}' 4.191 +} 4.192 + 4.193 +locase() 4.194 +{ 4.195 + echo "$1" | tr [A-Z] [a-z] 4.196 +} 4.197 + 4.198 +floppyset() 4.199 +{ 4.200 + gotcdfile isolinux.cfg 4.201 + parse_isolinux < $file > /tmp/var$$ 4.202 + . /tmp/var$$ 4.203 + rm -f /tmp/var$$ 4.204 + [ -e /media/cdrom/$KERNEL ] || KERNEL=$(locase $KERNEL) 4.205 + [ $(get 514 /media/cdrom/$KERNEL 4) -eq 1400005704 ] || return 4.206 + n=$(($(get 497 /media/cdrom/$KERNEL 1)+1)) 4.207 + ddq bs=512 count=$n if=/media/cdrom/$KERNEL of=/tmp/fd$$ 4.208 + uudecode <<EOT | ddq of=/tmp/fd$$ conv=notrunc 4.209 +bootloader 4.210 +EOT 4.211 + pos=$(($n*512)) 4.212 + if [ -n "$CMDLINE" ]; then 4.213 + echo -n "$CMDLINE" | ddq bs=512 count=1 conv=sync >> /tmp/fd$$ 4.214 + bytes2bin $n | ddq conv=notrunc \ 4.215 + bs=1 seek=497 count=1 of=/tmp/fd$$ 4.216 + words2bin $pos | ddq conv=notrunc \ 4.217 + bs=1 seek=34 count=2 of=/tmp/fd$$ 4.218 + [ $(get 518 /media/cdrom/$KERNEL 4) -ge 514 ] && 4.219 + words2bin $pos 9 | ddq conv=notrunc \ 4.220 + bs=1 seek=552 count=4 of=/tmp/fd$$ 4.221 + fi 4.222 + syssize=$(echo $(get 500 /tmp/fd$$ 4)) 4.223 + ddq bs=512 skip=$n if=/media/cdrom/$KERNEL | cat - /dev/zero | \ 4.224 + ddq bs=512 count=$((($syssize+31)/32)) >> /tmp/fd$$ 4.225 + base=$(stat -c %s /tmp/fd$$) 4.226 + len= 4.227 + if [ "$INITRD" ]; then 4.228 + l=0 4.229 + tot=0 4.230 + for i in ${INITRD//,/ }; do 4.231 + [ -e /media/cdrom/$i ] || i=$(locase $i) 4.232 + ddq if=/media/cdrom/$i >> /tmp/fd$$ 4.233 + l=$(($l+$(stat -c %s /media/cdrom/$i))) 4.234 + r=$((4 - ($l % 4))) 4.235 + if [ $r -ne 4 ]; then 4.236 + ddq if=/dev/zero bs=1 count=$r >> /tmp/fd$$ 4.237 + l=$(($l + $r)) 4.238 + fi 4.239 + [ "$i" == "rootfs.gz" ] && case "$INITRD" in 4.240 + rootfs.gz,rootfs*) continue # loram 4.241 + esac 4.242 + len="$len $l"; l=0 4.243 + tot=$(($tot+$l)) 4.244 + done 4.245 + page=4096 4.246 + rdadrs=$(((($syssize*16)+0x1F0000) & -$page)) 4.247 + words2bin $(($rdadrs & 0xFFFF)) $(($rdadrs >> 16)) | ddq \ 4.248 + conv=notrunc bs=1 seek=536 count=4 of=/tmp/fd$$ 4.249 + fi 4.250 + n=$(echo $len | wc -w) 4.251 + if [ $((494 - $(get 494 /tmp/fd$$))) -ge $(($n * 4)) ]; then 4.252 + i=$(($(get 494 /tmp/fd$$))) 4.253 + bytes2bin $(($i + ($n*4) - 256)) | ddq bs=1 conv=notrunc \ 4.254 + seek=496 count=1 of=/tmp/fd$$ 4.255 + else 4.256 + i=$(($pos + 0x1FC - ($n*4))) 4.257 + bytes2bin $(($i % 256)) $((i / 256)) 252 | ddq bs=1 \ 4.258 + conv=notrunc seek=494 count=3 of=/tmp/fd$$ 4.259 + fi 4.260 + for r in $len ; do 4.261 + words2bin $(($r & 0xFFFF)) $(($r >> 16)) | ddq conv=notrunc \ 4.262 + bs=1 seek=$i count=4 of=/tmp/fd$$ 4.263 + i=$(($i + 4)) 4.264 + done 4.265 + split -b 1440k /tmp/fd$$ fd$$ 4.266 + rm -f /tmp/fd$$ 4.267 + n=1; i=0; r=0 4.268 + set -- $len 4.269 + ls fd$$* | while read file ; do 4.270 + if [ $i -gt $(($1+$base)) ]; then 4.271 + shift 4.272 + r=$(($r+100)); n=0; i=0; base=0 4.273 + fi 4.274 + ddq of=$file bs=18k seek=80 count=0 4.275 + i=$(($i+1474560)) 4.276 + printf "mv %s fd%03d.img\n" $file $(($r+$n)) 4.277 + n=$(($n+1)) 4.278 + done | sh 4.279 + ls fd???.img 4.280 +} 4.281 + 4.282 quit() 4.283 { 4.284 umount -d /media/cdrom 4.285 @@ -1052,7 +1186,7 @@ 4.286 4.287 ISO="${1:-/dev/null}" 4.288 [ -z "$(isiso 2> /dev/null)" ] && echo "Usage : $0 file.iso" && exit 1 4.289 -mount -o loop,ro "$ISO" /media/cdrom 4.290 +mount -o loop,ro $ISO /media/cdrom 4.291 4.292 if [ "$2" == "list" ]; then 4.293 sed '/^\$(.*") \\/!d;s/^\$(\(.*\)").*/\1"/' $0 | while read line; do 4.294 @@ -1064,9 +1198,10 @@ 4.295 if grep -q "^$2()" $0; then 4.296 exe=$2 4.297 shift 2 4.298 - if [ "$(eval $(grep "\"$exe\"" $0 | \ 4.299 - sed '/^\$/!d;s/.(\(.*\)[\t ]*".*"[\t ]*".*/\1/'))" ]; then 4.300 + if [ -n "$(eval $(grep "\"$exe\"" $0 | sed \ 4.301 + '/^\$/!d;s/.(\(.*\)[\t ]*".*"[\t ]*".*/\1/'))" ]; then 4.302 grep "\"$exe\"" $0 | sed '/^\$/!d;s/.*"[\t ]*"\(.*\)".*/\1/' 4.303 + echo ---- 4.304 $exe "$@" 4.305 fi 4.306 quit 4.307 @@ -1091,7 +1226,8 @@ 4.308 $(xfile tazusb "usbkey" "USB key read/write installation") \ 4.309 $(ishybrid "usbbootkey" "USB boot key (read only)") \ 4.310 $(hasflavinfo "showfavinfo" "Show flavor extra info") \ 4.311 -$(menuitem "tazboot" "Get tazboot.exe Linux loader") \ 4.312 +$(cdfile isolinux.cfg "floppyset" "Boot floppy set") \ 4.313 +$(hastazboot "tazboot" "Get tazboot.exe Linux loader") \ 4.314 $(cdexe boot/bzImage "bzimage" "Get linux DOS/EXE file") \ 4.315 $(cdexe 'memtest*' "memtest" "Get Memtest86 DOS/EXE file") \ 4.316 $(cdfilef 'memtest*' "fdmemtest" "Create a Memtest86 boot floppy") \ 4.317 @@ -1107,6 +1243,6 @@ 4.318 retval=$? 4.319 exec 3>&- 4.320 rm -f /tmp/dialog$$ 4.321 - [ $retval -eq 0 ] || continue 4.322 + [ $retval -eq 0 ] || break 4.323 $value 4.324 done