Jump to content

Exploring "SETUP /P I;S=detectbus" and Grub4Dos: 8½ times Win98se on USB-drive


Recommended Posts

Posted (edited)
22 minutes ago, deomsh said:

Only thing I changed: renaming copyFF.bat to copyFF.g4b to make batch file working.

 

Yep, only FYI:

http://reboot.pro/topic/18644-grub4dos-batch-file-extension/

particularly:

http://reboot.pro/topic/18644-grub4dos-batch-file-extension/?p=178627

i.e., if I recall correctly, both  /copyFF.bat or copyFF.g4b should work, as the initial !BAT is parsed and means "executable batch", while if the command --set-ext is set properly, also /copyFF and copyFF will work

jaclaz

Edited by jaclaz

Posted

Thanks for the links, command --set-ext=.g4b in MENU.LST just before commandline saves time during testing :D (in my case the "4" easily becomes a "r"). 

In the post from 18 October 2013 - 01:27 PM you asked for an EDIT tool in Grub4Dos. Exists such a tool? Would be great, testing / correcting a longer Grub4Dos batch-file is very time consuming without. :(

Posted (edited)
52 minutes ago, deomsh said:

In the post from 18 October 2013 - 01:27 PM you asked for an EDIT tool in Grub4Dos. Exists such a tool? Would be great, testing / correcting a longer Grub4Dos batch-file is very time consuming without. :(

Not that I know of, unfortunately.

The problem AFAICU with such an editor isn't in the editor itself (after all you can already edit on-the-fly menu.lst entries, even inserting or deleting lines) but rather with saving it as file.

The good news :) are that grub4dos in itself doesn't "lock" volumes, while - say - VirtualBox does lock it, BUT IF before starting VirtualBox you mount a floppy image in IMDISK, the floppy won't be "locked" by IMDISK, so you can have the floppy mounted (by IMDISK) to a drive letter in the "external" Windows that is also inserted as media in the VirtualBox VM.

I.e. you can edit a given .g4b on the floppy image with - say - Notepad in Windows and saves are (instantly)  taken in the running VM and can be executed by grub4dos without rebooting.

About the extension, though it is easy to add the extension to the command, remember that grub4dos has [TAB] autocompletion, thus typing:

/<a couple of initial letters of the batch filename>[TAB]

is very handy.

jaclaz

Edited by jaclaz
Posted (edited)
On 4/26/2020 at 4:33 PM, jaclaz said:

i.e., if I recall correctly, both  /copyFF.bat or copyFF.g4b should work, as the initial !BAT is parsed and means "executable batch"

I was mistaken, copyFF.bat is parsed too.

But it's VERY dangerous, I run the file accidently without arguments and found the FAT of my (USB-)rootdrive rewritten, probably by the fat mkfs line in copyFF.bat :dubbio:

Luckily I made a full backup just before testing copyFF.g4b.

Better add some sort of validation.

Edited by deomsh
Correction
Posted
11 hours ago, deomsh said:

Better add some sort of validation.

Yep :yes:, ideally a command (or script) requiring parameters if run without parameters or with insufficient/incorrect ones should print to screen some usage info and do nothing else (or "switch" to interactive mode).

jaclaz

Posted

It was more ment as a warning. The creator of copyFF.bat is absolutely a genius. :yes:

I did some more tests, using my old MSYS USB1.1 16MB pendrive.

It appears that fat mkfs and fat mkfile are not fully-fully safe.

But 'a picture paints a thousand words', so here they are: http://imgur.com/a/5cZHjdG

Posted
On 4/27/2020 at 2:48 PM, jaclaz said:

The good news :) are that grub4dos in itself doesn't "lock" volumes, while - say - VirtualBox does lock it, BUT IF before starting VirtualBox you mount a floppy image in IMDISK, the floppy won't be "locked" by IMDISK, so you can have the floppy mounted (by IMDISK) to a drive letter in the "external" Windows that is also inserted as media in the VirtualBox VM.

I.e. you can edit a given .g4b on the floppy image with - say - Notepad in Windows and saves are (instantly)  taken in the running VM and can be executed by grub4dos without rebooting.

This is really great! Works perfectly with a 2880KB floppy image in Virtual Box 6.018. :thumbup

Thanks a lot!

Only drawback: editing a g4b-file is more addictive now than using EDIT.COM on a (slow) USB-pendrive. :} 

A few month ago I tested Grub4dos with VBox, chainloader /io.sys didn't work. This time no problems,  whatsoever. :dubbio:

Posted
9 hours ago, deomsh said:

This is really great! Works perfectly with a 2880KB floppy image in Virtual Box 6.018. :thumbup

Thanks a lot!

Only drawback: editing a g4b-file is more addictive now than using EDIT.COM on a (slow) USB-pendrive. :} 

Yep :), I know, and since the documentation and examples, particularly for "advanced" features is scarce or scattered around (on reboot.pro, here and there, on Steve6375's site :thumbup, on Chenall's blog or this or that Chinese board - with the added difficulty of interpreting the Chinese google translations) it is also an entertaining treasure hunt,

9 hours ago, deomsh said:

A few month ago I tested Grub4dos with VBox, chainloader /io.sys didn't work. This time no problems,  whatsoever. :dubbio:

This is "queer",

Older versions of grub4dos (around good ol' 0.4.4) had issues with DOS <=6.22 but always worked with DOS >6.22 AFAICR, a more common issue (in VM's) is that the newish versions (0.4.5+) need "a lot" of memory, 32 MB and if I recall correctly  it already happened that the issue was a "too small" amount of memory.

As a side note, when (if) you will have had enough fun and starting to get bored, an approach that may interest you:

http://reboot.pro/topic/17807-release-cosmias-a-new-approach-to-g4d-images/

jaclaz

  

  • 1 month later...
Posted (edited)

FATUTILS I: FATCOPY.G4B

This tool is an extension of Grubutil FAT.

My Grub4Dos batch-file is based on CopyFF.BAT. The originator of the file seems to be Chenall (18 Februari  2012 - 01:52 AM): http://reboot.pro/topic/16288-question-mount-a-folder-as-a-drive-in-ram/page-2 . Further I have used the Command Primer, the Tutorials 71, 21 and 65 on rmprepusb and the e-book of Steve6375 "Getting started with Grub4Dos."

I took special attention to verification, apart from typo's in the switches, especially existence and filesystem of Source and Target Devices are checked. I restored the Error messages of FAT; I found no other way to check if he Target Device has not enough free space.

I will paste the HELP-part to give an idea of the possibilities of FATCOPY.G4B. The file is far too big, the download is at the end below.

-------------------------------------------------------------------------------
grub>FATCOPY.G4B HELP
-------------------------------------------------------------------------------
fatcopy.g4b DEVICE1/PATH1/FILE1 DEVICE2/PATH2/FILE2 switches
fatcopy.g4b HELP (this screen)
Copy files on DEVICE1 to DEVICE2; if omitted DEVICE1/DEVICE2: from root
Copy from/to hidden FAT-partitions !
File-names 8+3 only! 0-byte files are not copied. LFN copied as SFN (default)
Arguments space-separated! Lower/Uppercase free - except DEVICE1 and/or DEVICE2
More convenient => insmod (bd)/fatutils/fatcopy.g4b copy

(source) DEVICE1 = (fd#) & (hd#,#) & (0x#) & (#); with ISO/UDF (CD/DVD too!)
(target) DEVICE2 = (fd#) & (hd#,#) & (0x#) & (#); FAT only

/PATH1/ = source directory => without DEVICE1 => on root (PATH1/ too)
/PATH2/ = target directory => without DEVICE2 => on root (PATH2/ too)
if PATH2 does not exist, all PATH2 directories will be created

FILE1 = copy specified file => on root without DEVICE1 and/or /PATH1/ 
FILE1 accepts wildcard: * in Name / Extension (NOT: ? ) 
Without FILE1 full directory will be copied (*.* is NOT needed)
FILE2 = copy/rename FILE1 to FILE2 => on root without DEVICE2 and/or /PATH2/

File versions: Grubutil FAT 15/02/2015 and Grub4Dos 0.4.6a 09/09/2019 
Found not compatible with Grub4Dos 0.4.5b / Grub4Dos 0.4.5c
Grubutil FAT needed, searched in (bd) or ()/ (=root) or /grub/ or /grubutil/

General Switches: [/d] [/[-]o] [/p] [/q] [/v] [/t] [/x:[-]~] [/w:n]
/d = set PATH2 == PATH1
/[-]o = [never]overwrite files BTW: [-] means choice, type /-o !
/p = pause after each screen
/q = quiet copying: error messages & last file-count message only*
/v = verify with message of status - not with /t (try /v if copying stops)
/t = trial without actual copying (can used as simple DIR)
/x:[-]~ = only SFN-equivalent of LFN/real shortened LFN will [not] be copied**
/w:n = waiting time making directory: n=0 - n=t seconds (default = auto)
* default verbose copying: mkdir & copy & output messages too
** instead of ~ ONE other character can be used too (special feature)

FAT Directory Parser Switches: [[/s] [/a:[-]darsh] [/m:x]] *
/s = copy subdirectories (LFN to SFN) too. With /a:d directory-tree only
/a:[-]d[-]a[-]r[-]s[-]h = [not] copy files/directories with attribute(s)**
/m:x = changes (md)-startsector in use (default=min x=3000 uses 0x3000-0x3FFF)
* default - no copying of ISO-9660 & UDF! If found will auto-switch to /ls-mode
* about max 35 000 files AND max 3 000 subdirectories in one directory
** attributes are not copied by FAT - all copied files get archive-attribute

LS Directory Parser Switches: [[/ls] [/s] [/e]] *
/ls = ls-based directory parsing - can copy from ISO-9660 (NOT Joliet) & UDF
/s = copy subdirectories (try /x:| to make directory-tree)
/e = copy empty subdirectories (zero-byte file will become subdirectory!)
* shows skipped 'dirty' LFN (NO copying of LFN as shortened SFN) 
* about max 10 000 files OR max 10 000 subdirectories in one directory
-------------------------------------------------------------------------------

FATCOPY.G4B.ZIP

Edited by deomsh
Corrections
Posted

FATCOPY.G4B 0.2

I wondered since FAT could copy from ISO-9660/UDF, if NTFS would be possible too.

Experiments in this direction gave no problems, so i added NTFS to the list of admissible filesystems (source device only!). See picture below.

VirtualBox_FATCOPY_NTFS-to-FAT32.png.4051f0eb8a5365e7b61f35f9e7630625.png

Just out of curiosity I tried EXT2. Although copying with FAT is possible, the LS directory-parser doesn't open directories, so I left EXT2 out. See picture below.

VirtualBox_FATCOPY_EXT2-to-FAT32.png.c0591a2c0e94c4df952211c718f17229.png

I made FATCOPY.G4B version 0.2 - with following changes:

  • Copy from NTFS (with auto-switching to LS directory-parser (switch /ls can be left out)
  • Added filesize copied in the output message after copying a single file
  • FAT error handling in case of making (sub)directories too (will end copying!)
  • More understandable error message if the (sub)directory to make already exists as a filename
  • Three bugs fixed
  • Better alignment of messages
  • Added visibility of omitted directories during file-only copying (without /s), especially to improve the DIR capabilities of Copy trial mode. See picture below.

91156124_VirtualBox_FATCOPY_DirtestNTFS.png.20a42c728b5d9ad8e0879b04ed499b53.png

As the picture above shows, the NTFS meta-files and the $MFT will be copied too (if >= 1 byte). If not wanted: files containing $ can easily omitted with the /x-switch: /x:-$

In case of directories I didn't made such a switch. I saw no use, but I will think about it. I don't know how big the NTFS directory $Extend can grow. :dubbio:

FATCOPY2.ZIP

Posted

Nice. :thumbup

I don't understand this:

11 hours ago, deomsh said:

Just out of curiosity I tried EXT2. Although copying with FAT is possible, the LS directory-parser doesn't open directories, so I left EXT2 out. See picture below.

VirtualBox_FATCOPY_EXT2-to-FAT32.png.c0591a2c0e94c4df952211c718f17229.png

FATCOPY2.ZIP 8.77 kB · 0 downloads

Can you explain more?

About NTFS, with all due respect, the logic should be inverted, i.e. NEVER copy (nor list) $* files unless a specific switch is provided, the "average" user has nothing to do with NTFS filesystem structures and having them copied on a FAT volume accidentally might be common.

jaclaz

Posted (edited)

@jaclaz

About EXT2: today I did some more tests, there are two different issues.

First issue: Grub4Dos ls doesn't highlight directories in case of EXT2. Because opening a directory on EXT2 with ls and copying from that directory didn't work for me, I thought ls was the culprit. But the problem lies elsewhere. Today I vaguely remembered EXT2 is fully case-sensitive, while FAT and NTFS are in fact not. In the picture below I illustrated this with a NTFS (hd2,0) and an EXT2 (hd3,0) partition. Line 1-3: root of (hd2,0) with ls, copying from NTFS with FAT is case-insensitive. Line 7-8: root of (hd3,0) with ls, copying from EXT2 with FAT is case-sensitive. Same for viewing a directory, NTFS in line 13-14 and EXT2: lines 16-22

1434256133_VirtualBox_LS_NTFS_HighlightCase-insensitive_Ext2-No-HighlightCase-sensitive.png.1e704aeaa356ecb50fbe01c0ee3a7c11.png

With a few changes FATCOPY.G4B can be adjusted to EXT2, as long source path/file are written in the right case.

One of my changes in version 0.2: "Added visibility of omitted directories during file-only copying (without /s), especially to improve the DIR capabilities of Copy trial mode" will identify directories on EXT2 too (but not if they are empty!). Great news for the Linux community:buehehe:  See picture below of copying with version 0.2 but with  adjustments for EXT2 (line 8, second "omit").

494228254_VirtualBox_FATCOPY-modEXT2.png.2ba6062974b4a493ff2b693ef7ad0260.png

Although I find a way to identify empty directories on the target (always FAT), on the source this still doesn't seem to be possible with help of ls (my FAT directory-parser has no problems in this respect, but can only be used on FAT volumes. Redirecting the ls error message never worked for me. Any idea's?

About NTFS and the average (Grub4Dos-as-an-OS) user... :roll1:

Good point, I will try to add some silent skip's and adding a /$-switch for the non-average user.

A question about EXT: is there an easy-going way to identify EXT2/3? Is there something specific in a sector anywhere? I can't find anything, not on the internet and not with CAT. But I have never been a serious Linux user. :ph34r:

 

Edited by deomsh
Posted
10 hours ago, deomsh said:

 

Although I find a way to identify empty directories on the target (always FAT), on the source this still doesn't seem to be possible with help of ls (my FAT directory-parser has no problems in this respect, but can only be used on FAT volumes. Redirecting the ls error message never worked for me. Any idea's?

 

A question about EXT: is there an easy-going way to identify EXT2/3? Is there something specific in a sector anywhere? I can't find anything, not on the internet and not with CAT.

But I have never been a serious Linux user. :ph34r:

 

I am a laughable Linux user :w00t:, so I have little to say on the matter of EXT2/3, but why is it needed to distinguish between them?

Anyway, I am still The Finder ;), should be this :unsure::
https://www.redhat.com/archives/ext3-users/2001-August/msg00214.html

About the ls "error message" post a sample of what doesn't work, maybe there is some of the in-memory tricks or "particular" varaibles that can be used.

BUT (random thought) in practice how big a problem (time/inconvenience) would be to copy on FAT target empty directories as well and then post-process the target removing (optionally) the empty ones?

About CaSe SeNsItIvEnEsS, remember (if needed) that also CDFS is case sensitive, but on command line one[1] would use [TAB] autocompletion when writing the copy command, so it is (IMHO) not such an issue.

jaclaz

 

 

[1] please read as myself or one that is familiar with the features of grub4dos (similar to the cmd.exe) and uses them, for *some* reason I always have to remind other people about how useful this is.

Posted

Hi Deomsh. If you mean checking for ext2 file systems within GNU/Linux, either of these commands will get what you need, probably other commands too. Optionally 'grep' with -i switch (ignore case) or whatever to get specifics. The ext2 partition does not need to be mounted just to check.
sudo blkid | grep -i ext2
cat /etc/fstab | grep -i ext2

If you don't care whether it's ext2, ext3 or ext4:
sudo blkid | grep -i ext[2-4]

If this is for a script, to narrow down the exact partition just use something like (note space between double quotes):
sudo blkid | grep -i ext2 | cut -d" " -f1 | cut -d/ -f3 | sed 's|:||g'

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...