H. Peter Anvin
2010-Oct-13 21:30 UTC
[syslinux] [syslinux:disklib] disklib: make CHS calculation match core/fs/diskio.c
On 10/13/2010 08:36 AM, syslinux-bot for Michal Soltys wrote:> Commit-ID: 9c8db7560e2dc83d1191bb2f90b4d4d0ae3d37d6 > Gitweb: http://syslinux.zytor.com/commit/9c8db7560e2dc83d1191bb2f90b4d4d0ae3d37d6 > Author: Michal Soltys <soltys at ziu.info> > AuthorDate: Wed, 13 Oct 2010 10:57:36 +0200 > Committer: Michal Soltys <soltys at ziu.info> > CommitDate: Wed, 13 Oct 2010 10:57:36 +0200 > > disklib: make CHS calculation match core/fs/diskio.c > > Signed-off-by: Michal Soltys <soltys at ziu.info> >I note that this code still: a) duplicates the code between read and write, and b) doesn't check for CHS overflow. This is particularly critical for write, obviously, since we could corrupt a disk. -hpa
Michal Soltys
2010-Oct-13 21:44 UTC
[syslinux] [syslinux:disklib] disklib: make CHS calculation match core/fs/diskio.c
On 10-10-13 23:30, H. Peter Anvin wrote:> On 10/13/2010 08:36 AM, syslinux-bot for Michal Soltys wrote: >> Commit-ID: 9c8db7560e2dc83d1191bb2f90b4d4d0ae3d37d6 >> Gitweb: http://syslinux.zytor.com/commit/9c8db7560e2dc83d1191bb2f90b4d4d0ae3d37d6 >> Author: Michal Soltys<soltys at ziu.info> >> AuthorDate: Wed, 13 Oct 2010 10:57:36 +0200 >> Committer: Michal Soltys<soltys at ziu.info> >> CommitDate: Wed, 13 Oct 2010 10:57:36 +0200 >> >> disklib: make CHS calculation match core/fs/diskio.c >> >> Signed-off-by: Michal Soltys<soltys at ziu.info> >> > > I note that this code still: > > a) duplicates the code between read and write, andOki, I'll shrink it.> b) doesn't check for CHS overflow. >lbacnt set in disk_get_params() is always valid (if function is successful), and it's checked at the very begining of read/write functions (along with other sanity checks). CHS check is no longer necessary, as CHS is used only if ebios == 0, and that implies that lbacnt is calculated from valid geometry (cbios == 1) or faked (1/1/1) in which lbacnt == 1. I'll update the comments to make it more clear.
Pierre-Alexandre Meyer
2010-Oct-16 15:19 UTC
[syslinux] [syslinux:disklib] disklib: make CHS calculation match core/fs/diskio.c
On Thu, Oct 14, 2010 at 9:08 AM, Shao Miller <Shao.Miller at yrdsb.edu.on.ca> wrote:> Somewhat unrelated: Some day in the far, far future, it might be nice to > "re-image"[1] computers using INT 13h via one or more COMBOOT32 programs. ?- > Shao > > [1] Apply a disk or filesystem snapshot/saved-state.I did something similar for the resume usecase, i.e. I wrote a resume.c32 module which resumes a computer from a hibernate image (swsusp or TuxOnIce). This was used to boot an appliance from a known state (the root filesystem being a read-only squashfs). Blog entry here: http://pub.mouraf.org/blog/2010/09/resume-c32-resume-linux-from-the-bootloader/ Code on github: http://github.com/pierre/syslinux-fastboot -- Pierre-Alexandre Meyer http://pub.mouraf.org/blog
Andrew Bobulsky
2010-Oct-17 21:27 UTC
[syslinux] [syslinux:disklib] disklib: make CHS calculation match core/fs/diskio.c
Hello Shao, hpa, I thought it was really ironic that you guys mentioned this. I remember back when I was imaging XP, I was trying to work out specifically what I'd want to do to get gPXE/PXELINUX/COMBOOT to simplify our imaging process which at the time was using a very clunky XP live CD that took forever to boot up... I ultimately ended up booting DOS from iSCSI and imaging via INT13 with Ghost 8, which worked pretty well. Still, while I was wrapping my head around the concepts I was trying to exploit, I was browsing through all of these com32 modules in the SYSLINUX package then hopped on IRC and said, "Hey guys, is there a COM32 module for imaging disks? Something like DD.c32?" While several people (you guys included I think) remarked that it was an interesting idea, I never found anything... Hence the Ghost 8 use :-D I do think it would be really nifty to have a DVD with ISOLINUX that boots to a menu and images all via COM32... no HAL issues or hardware compatibility issues, no need to wait for a "thick" protected mode OS to load. Making modern operating systems easier to deploy by exploiting the ubiquity of the "modern" BIOS implementations has a high geek-sexiness factor to it ;) Cheers, Andrew Bobulsy On Oct 16, 2010, at 3:00 PM, syslinux-request at zytor.com wrote:> > Message: 2 > Date: Fri, 15 Oct 2010 16:09:04 -0700 > From: "H. Peter Anvin" <hpa at zytor.com> > To: For discussion of Syslinux and tftp-hpa <syslinux at zytor.com> > Subject: Re: [syslinux] [syslinux:disklib] disklib: make CHS > calculation match core/fs/diskio.c > Message-ID: <4CB8DF10.7030807 at zytor.com> > Content-Type: text/plain; charset=ISO-8859-1 > > On 10/14/2010 09:08 AM, Shao Miller wrote: >> >> Somewhat unrelated: Some day in the far, far future, it might be nice to >> "re-image"[1] computers using INT 13h via one or more COMBOOT32 >> programs. - Shao >> >> [1] Apply a disk or filesystem snapshot/saved-state. > > That's not even very hard at all, at least not for the whole-disk case. > > -hpa