Received: from list by lists.gnu.org with archive (Exim 4.71) id 1ag8YV-00016e-Tj for mharc-grub-devel@gnu.org; Wed, 16 Mar 2016 06:19:55 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49268) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ag8YS-000138-Lb for grub-devel@gnu.org; Wed, 16 Mar 2016 06:19:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ag8YN-0000JL-Hw for grub-devel@gnu.org; Wed, 16 Mar 2016 06:19:52 -0400 Received: from e28smtp04.in.ibm.com ([125.16.236.4]:56718) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ag8YM-0000In-RS for grub-devel@gnu.org; Wed, 16 Mar 2016 06:19:47 -0400 Received: from localhost by e28smtp04.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 16 Mar 2016 15:49:41 +0530 Received: from d28relay02.in.ibm.com (9.184.220.59) by e28smtp04.in.ibm.com (192.168.1.134) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 16 Mar 2016 15:48:34 +0530 X-IBM-Helo: d28relay02.in.ibm.com X-IBM-MailFrom: nikunj@linux.vnet.ibm.com X-IBM-RcptTo: grub-devel@gnu.org Received: from d28av03.in.ibm.com (d28av03.in.ibm.com [9.184.220.65]) by d28relay02.in.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u2GAGV4x58785844 for ; Wed, 16 Mar 2016 15:46:32 +0530 Received: from d28av03.in.ibm.com (localhost [127.0.0.1]) by d28av03.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u2GAGpSV003199 for ; Wed, 16 Mar 2016 15:46:53 +0530 Received: from abhimanyu.in.ibm.com.vnet.linux.ibm.com (abhimanyu.in.ibm.com [9.124.35.126] (may be forged)) by d28av03.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id u2GAGopk003111 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 16 Mar 2016 15:46:51 +0530 From: Nikunj A Dadhania To: Andrei Borzenkov , The development of GNU GRUB Subject: Re: [PATCH] bootp: set is_def while processing dhcp ack In-Reply-To: References: <1458117324-5685-1-git-send-email-nikunj@linux.vnet.ibm.com> User-Agent: Notmuch/0.21 (http://notmuchmail.org) Emacs/24.5.1 (x86_64-redhat-linux-gnu) Date: Wed, 16 Mar 2016 15:46:50 +0530 Message-ID: <87h9g63ey5.fsf@abhimanyu.in.ibm.com> MIME-Version: 1.0 Content-Type: text/plain X-TM-AS-MML: disable x-cbid: 16031610-0013-0000-0000-00000AE92155 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 125.16.236.4 Cc: mpe@ellerman.id.au X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Mar 2016 10:19:53 -0000 Hi Andrei, Thanks for a quick review. Andrei Borzenkov writes: > On Wed, Mar 16, 2016 at 11:35 AM, Nikunj A Dadhania > wrote: >> While testing netboot on ppc64, found that the grub_net_default_server >> is not set even when the dhcp response has sent the server IP. This would >> result in a failure during netbooting with following error: >> >> error: no server is specified. >> >> This patch sets the is_def variable which would result in setting the >> grub_net_default_server and then netboot from the server. >> >> Signed-off-by: Nikunj A Dadhania >> --- >> grub-core/net/bootp.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c >> index a088244..74b8b79 100644 >> --- a/grub-core/net/bootp.c >> +++ b/grub-core/net/bootp.c >> @@ -278,7 +278,7 @@ grub_net_process_dhcp (struct grub_net_buff *nb, >> } >> grub_net_configure_by_dhcp_ack (name, card, >> 0, (const struct grub_net_bootp_packet *) nb->data, >> - (nb->tail - nb->data), 0, 0, 0); >> + (nb->tail - nb->data), 1, 0, 0); > > That's wrong, sorry. "is default" is intended to be used from initial > configuration based on information from firmware (i.e. - firmware does > PXE boot and we configure interface based on PXE packet firmware made > available for us). > If you call net_bootp manually, Thats what we are using in this current case, booting from the disk, and the grub.cfg has a netboot entry. menuentry 'Linux dev netboot' --class os { insmod net insmod ofnet insmod tftp net_bootp echo 'Network status: ' net_ls_cards net_ls_addr net_ls_routes echo 'Loading Linux ...' linux (tftp)/ubuntu-installer/ppc64el/vmlinux tasks=standard pkgsel/language-pack-patterns= pkgsel/install-language-support=false --- quiet initrd (tftp)/ubuntu-installer/ppc64el/initrd.gz } > server is stored in environment variable net__dhcp_server_name; > you are free to use it as needed, e.g. set $root and $prefix. > > Does your platform use PXE or some other protocol for netboot? Its not exactly same as PXE, below link explains that in detail: https://www.ibm.com/developerworks/community/wikis/home?lang=en#!/wiki/W51a7ffcf4dfd_4b40_9d82_446ebc23c550/page/Netbooting%20on%20POWER%20-%20An%20Introduction Basically, a DHCP request is sent and in the DHCP ACK, we get the details of client-ip, bootfile (core.elf of grub), server-ip, netmask, etc. Later tftp is used to get the kernel/initrd images. During this case everything else gets parsed properly except the server-ip. Which was under the is_def case. > We may need to provide platform-specific network configuration > function that understands how to fetch information from firmware. This information is not there in the firmware. Its there in the DHCP-ACK packet. When the firmware does the netboot, we have most of the information encoded in the device tree and is parsed fine in grub. In this case we have a disk and one of the entry is to netboot, thats when it fails. Regards, Nikunj