From owner-freebsd-hackers@FreeBSD.ORG Sun Apr 10 07:49:49 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C9809106564A; Sun, 10 Apr 2011 07:49:49 +0000 (UTC) (envelope-from Devin.Teske@fisglobal.com) Received: from mx1.fisglobal.com (mx1.fisglobal.com [199.200.24.190]) by mx1.freebsd.org (Postfix) with ESMTP id 8CB298FC1A; Sun, 10 Apr 2011 07:49:49 +0000 (UTC) Received: from sbhfislrext01.fnfis.com ([192.168.249.167]) by SCSFISLTC02 (8.14.3/8.14.3) with ESMTP id p3A7SnvB023344; Sun, 10 Apr 2011 02:28:49 -0500 Received: from SBHFISLTCGW04.FNFIS.COM (Not Verified[10.132.248.123]) by sbhfislrext01.fnfis.com with MailMarshal (v6, 5, 4, 7535) id ; Sun, 10 Apr 2011 02:29:00 -0500 Received: from SBHFISLTCGW04.FNFIS.COM ([10.132.248.123]) by SBHFISLTCGW04.FNFIS.COM with Microsoft SMTPSVC(6.0.3790.4675); Sun, 10 Apr 2011 02:28:49 -0500 Received: from [127.0.0.1] ([10.132.254.135]) by SBHFISLTCGW04.FNFIS.COM over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Sun, 10 Apr 2011 02:28:48 -0500 References: <4DA13620.7060407@freebsd.org> In-Reply-To: <4DA13620.7060407@freebsd.org> Mime-Version: 1.0 (iPad Mail 8G4) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Message-Id: X-Mailer: iPad Mail (8G4) From: Devin Teske Date: Sun, 10 Apr 2011 00:28:51 -0700 To: Julian Elischer X-OriginalArrivalTime: 10 Apr 2011 07:28:48.0742 (UTC) FILETIME=[EEE1F060:01CBF750] Cc: "freebsd-hackers@freebsd.org" , Chris Richardson , "freebsd-current@freebsd.org" , "freebsd-emulation@freebsd.org" Subject: Re: Kernel Tracking Question.. regarding kernel and boot files X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Apr 2011 07:49:49 -0000 On Apr 9, 2011, at 9:46 PM, Julian Elischer wrote: > On 4/9/11 2:51 PM, Chris Richardson wrote: >> On Sat, Apr 9, 2011 at 10:34 PM, Chuck Swiger wrote: >>=20 >>> Hi, Chris-- >>>=20 >>> [ ...Reply-to: set to direct towards the most appropriate list... ] >>>=20 >>> On Apr 9, 2011, at 8:31 AM, Chris Richardson wrote: >>>> I am totally new to FreeBSD. I was involved within project which will >>>> trace the kernel. I used ktrace but I could not get appropriate results >>>> about the files being opened. I don't see any of the boot files boot0-1 >>> or 2 >>>> in the ktrace.out file. Where did they go? >>> The bootstrap loader stages are what loads and runs the kernel. >>> ktrace isn't available until afterwards, when the kernel is running. >>>=20 >>>> Is ktrace the best "trace suite" for freebsd kernel? >>> Kinda depends on what you are doing. Setting up good logging and making >>> userland >>> interfaces for getting to useful information (cf vmstat, ps, iostat, et= c) >>> is >>> more likely to be useful over the longer run. >>>=20 >>>=20 >> What about if I wanna see the interaction between boot process and kernel >> loading. >=20 > either you run it under an emulator that allows you to single step it. > or you just add a lot of printf() to the boot loader. > (some parts are required to fit in small code sizes to adding prints will= cause overflow..) > best to read the docs and then the sources. then it wil become apparent t= o you > what you want to find out. You also have the option of writing Forth modules for the boot-loader. Even= dropping to the "ok" prompt is enough to give you full access to the built= -in Forth interpreter. You can query the variables that are set in the "env= ironment" (which are different depending whether you've booted via pxeboot,= cdboot, or other method). You can even do some limited device poking and f= ile-io (both read and write). The benefit of the forth modules is that you can use it to produce the nece= ssary debug output whilst avoiding the overflow issue. That is to say, that= one technique I've used is to add code to the loader to export some string= or value of interest to a variable in the environment that I would then ad= d something like 'echo "debug =3D=3D $debug"' to loader.rc. Keeps the loade= r small and the human fluff off to the interpreter. >=20 >>=20 >>>> What about going through source code .. Is it better to >>>> use Combination of Ecllipse/Qemu and FreeBSD Source tree? >>> Eclipse is an editor. If you like it in particular, free free to use i= t, >>> otherwise pick something else you'd prefer to use for C code. I use a combination of vim (as my editor) and CVSweb (URL is in the handboo= k) for historical research as necessary. Just my "tuppence." --=20 Devin >>>=20 >>>> Does this method will provide us with someway to see how booting proce= ss >>> invokes >>>> the kernel to memory ? Any help will be appreciated. >>> You're asking about the process here: >>>=20 >>>=20 >>> http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/boot-blocks.h= tml >>>=20 >>> ...? Frankly, none of these are especially big, start by reviewing the >>> source >>> code for 'em. >>>=20 >>>=20 >> Yeah. this file provides me with the stages in theoretical way. How about >> implementing it using qemu to emulate livecd to see what is going on boo= t0. >> Do you have an idea about that ? >>=20 >> Good Luck, >>=20 >>=20 >>> Regards, >>> -- >>> -Chuck >>>=20 >>>=20 >>>=20 >> _______________________________________________ >> freebsd-current@freebsd.org mailing list >> http://lists.freebsd.org/mailman/listinfo/freebsd-current >> To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.or= g" >>=20 >=20 > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" _____________ The information contained in this message is proprietary and/or confidentia= l. If you are not the intended recipient, please: (i) delete the message an= d all copies; (ii) do not disclose, distribute or use the message in any ma= nner; and (iii) notify the sender immediately. In addition, please be aware= that any message addressed to our domain is subject to archiving and revie= w by persons other than the intended recipient. Thank you. _____________