From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=50.245.10.177; helo=microway.com; envelope-from=rick@microway.com; receiver=edk2-devel@lists.01.org Received: from microway.com (mail1.microway.com [50.245.10.177]) by ml01.01.org (Postfix) with ESMTP id D1EFD22135D40 for ; Tue, 6 Mar 2018 11:35:04 -0800 (PST) Received: from [10.200.120.6] (openvpn.microway.com [192.168.200.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by microway.com (Postfix) with ESMTPSA id 2D56E9F4B2; Tue, 6 Mar 2018 14:41:18 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microway.com; s=verified; t=1520365278; bh=X2k9akVpRSDOj/CFB0sfbWcj7ylmo36oHW0kxsjXPU0=; h=Subject:To:Cc:References:From:Date:In-Reply-To; b=Ng5dYAVYYR/03W5yeK/iUZvwdhbPtlDSIt4eYDhOnTrkkVxWVBLsrkgP+JaWKpKqu LlCHPamCavdq2u9MhG3cYsD8TXKpNUeKAr6M9/hv+0Zqqxg3RP/cMenoto67xsaPtg lyS8hwajWZMU3287rVo2L33/HOrQZ4T9deKX+xvI= To: "Wu, Hao A" , Andrew Fish Cc: "edk2-devel@lists.01.org" References: <2da85898-914a-8a2e-6269-349c3fe5d713@microway.com> From: Rick Warner Message-ID: <4dd36463-0f73-4850-9bd6-d09740634cd0@microway.com> Date: Tue, 6 Mar 2018 14:41:12 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: Subject: Re: how do I use RamDiskDxe? X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Mar 2018 19:35:06 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Language: en-US On 02/13/18 19:48, Wu, Hao A wrote: >> -----Original Message----- >> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Rick >> Warner >> Sent: Wednesday, February 14, 2018 12:33 AM >> To: Wu, Hao A; Andrew Fish >> Cc: edk2-devel@lists.01.org >> Subject: Re: [edk2] how do I use RamDiskDxe? >> >> On 02/12/2018 10:05 PM, Wu, Hao A wrote: >>>> -----Original Message----- >>>> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of >>>> Andrew Fish >>>> Sent: Tuesday, February 13, 2018 8:40 AM >>>> To: Rick Warner >>>> Cc: edk2-devel@lists.01.org >>>> Subject: Re: [edk2] how do I use RamDiskDxe? >>>> >>>> >>>> >>>>> On Feb 12, 2018, at 1:07 PM, Rick Warner wrote: >>>>> >>>>> Hi All, >>>>> >>>>> I'm trying to develop a tool for automated BIOS flashing from the EFI shell >>>> using IPMI serial over lan to drive it. To accomplish this, my plan is to use a >>>> network booted EFI shell with a tftp client and a ramdisk to download the >> flash >>>> tools and ROM into as a workspace and then run the flash commands from >> that >>>> ram disk. >>>>> I've been able to successfully build and boot an efi shell from the edk 2 >>>> sources including the tftp client. I've also been able to separately build the >>>> RamDiskDxe driver from the MdeModulePkg. Loading the RamDiskDxe.efi >>>> driver file results in a successful message, but I do not get any usable ram >> disk >>>> made available to me? >>>>> How do I get a usable drive letter/name (ie blk0: or any other name) from >> the >>>> RamDiskDxe driver? >>>> Looks like when you load the RamDiskDxe it registers >> gEfiRamDiskProtocolGuid >> https://github.com/tianocore/edk2/blob/master/MdePkg/Include/Protocol/Ra >>>> mDisk.h >>>> >> >>> mDisk.h> which notes this API was added in UEFI 2.6 so you can read up on it >> in >>>> that version of the EFI Spec. >>>> >>>> From a quick site read of the code it looks like the driver just produces a >>>> Protocol that lets you create a RAM disk and VRF (Setup Pages) that let you >>>> configure one. Seems like you still need to call it and give the raw disk >> image. >>> >>>>> Once I've done that, will it be possible to include the RamDiskDxe driver as >>>> part of the network bootable efi shell image? I assume I'll need to modify >>>> the .dsc file for the ShellPkg to include the MdeModulePkg pieces. >>>>> If anyone has any other suggestions for this, I'm open to ideas. The only >> way >>>> I've been successful in network booting EFI shell is using just that file directly. >> I >>>> tried creating a dos filesystem image with the efi shell file in it just like >> would >>>> work with a USB key, but that would not boot over the network stack. If >> there is >>>> some way of creating a network bootable EFI shell filesystem image (similar >> to >>>> how Linux can network boot a separate vmlinuz kernel and initrd image)? >>>>> Are there any docs that I've missed (I've tried looking in the user docs and >> on >>>> the wiki) regarding setting up RamDiskDxe? >>>> Traditionally network booting has involved loading a single file over the >>>> network (like an OS Loader) and that file uses the UEFI networking stack to >>>> download (TFTP read) more images (like the Kernel) from a location implied >> by >>>> the location used to download the single file (OS Loader). >>>> >>> Hi, >>> >>> For the RamDiskDxe part: >>> >>> Just as the previous reply, the RamDiskDxe driver provides: >>> a). A protocol to (un)register a range of memory to a Ram disk >>> b). A setup page for user to create: >>> a raw Ram disk (no data on the created one) or, >>> from a selected file (the file will be the content in the Ram disk, >>> no file system though) >>> >>> If you want to place the flash tools in the Ram disk and use it, I think >>> you also need to format the Ram disk and create file system on it first >>> (e.g. FAT). >>> >>> Best Regards, >>> Hao Wu >>> >>>> Thanks, >>>> >>>> Andrew Fish >> Thank you both very much! >> >> How do I use the setup page to create either a raw (empty) or filled w/ >> a file ramdisk?  How do I call that?  I assume the file to create it >> from would need to already be local to the system.  Is that correct? Or >> would I be able to directly pull a filesystem image from tftp into the >> ramdisk upon creation? > For example, on OVMF, you can enter the setup page by executing 'exit' > under shell. Then navigate through: > 'Device Manager' -> > 'RAM Disk Configuration' > > If you create a Ram disk from a file, the whole content of the file will > be copied to the memory range when creating the Ram disk. The file can be > an ISO image ,for example. In such case, after creating the Ram disk, a > file system can be accessed on the Ram disk. > > Best Regards, > Hao Wu > >> Thanks, >> Rick Warner >> >> >> _______________________________________________ >> edk2-devel mailing list >> edk2-devel@lists.01.org >> https://lists.01.org/mailman/listinfo/edk2-devel Thanks for the help on this.  I've achieved success.  My final solution was to include the contents of RamDiskDxe.efi in an array and then use a modified version of the load command (shell builtin) to load that memory region as a driver image with LoadImage.  Once that is loaded, I created another shell builtin that gets the Hii handle for it, works it's way to the ConfigAccess method and then calls it to set the size and type.  Finally, I modified the RamDiskDxe driver itself to initialize a raw ramdisk with a FAT16 table. I can now network boot my custom EFI shell and create a ram disk with no other storage present in the system and then use that ramdisk to store data/apps downloaded with tftp. Thanks for getting me in the right direction with the Hii form stuff. Rick