From patchwork Sat May 26 06:06:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 920926 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40tCL45Hq3z9s16 for ; Sat, 26 May 2018 16:06:20 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40tCL4392FzDqx2 for ; Sat, 26 May 2018 16:06:20 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=redhat.com X-Original-To: slof@lists.ozlabs.org Delivered-To: slof@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=redhat.com (client-ip=66.187.233.73; helo=mx1.redhat.com; envelope-from=thuth@redhat.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=redhat.com Received: from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40tCKy6XKyzDqL5 for ; Sat, 26 May 2018 16:06:13 +1000 (AEST) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 939FF10D43B; Sat, 26 May 2018 06:06:10 +0000 (UTC) Received: from thh440s.redhat.com (ovpn-116-22.ams2.redhat.com [10.36.116.22]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4559C2023433; Sat, 26 May 2018 06:06:09 +0000 (UTC) From: Thomas Huth To: slof@lists.ozlabs.org Date: Sat, 26 May 2018 08:06:00 +0200 Message-Id: <1527314768-4797-1-git-send-email-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Sat, 26 May 2018 06:06:10 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Sat, 26 May 2018 06:06:10 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'thuth@redhat.com' RCPT:'' Subject: [SLOF] [PATCH v3 0/8] Support network booting with pxelinux.cfg files X-BeenThere: slof@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: "Patches for https://github.com/aik/SLOF" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Greg Kurz MIME-Version: 1.0 Errors-To: slof-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "SLOF" When booting a Linux kernel via network, it's sometimes more convenient to load the kernel and initrd separately instead of having to create a joint kernel + initrd file. The most common "standard" for doing such network boots are the so-called pxelinux.cfg config files, initially introduced by the PXELINUX bootloader on x86, but nowadays also used on ppc64 by petitboot for example. So let's support booting via these config files in SLOF, too! v3: - Addressed Alexey's review feedback from v2 v2: - Added support for UUID-based file names (last two patches) - Addressed Greg's feedback from v1 Thomas Huth (8): libnet: Pass ip_version via struct filename_ip libc: Add the snprintf() function libnet: Put code for determing TFTP error strings into a separate function libnet: Add functions for downloading and parsing pxelinux.cfg files libnet: Wire up pxelinux.cfg network booting libnet: Add support for DHCPv4 options 209 and 210 slof: Add a helper function to get the contents of a property in C code libnet: Support UUID-based pxelinux.cfg file names include/helpers.h | 4 + lib/libc/include/stdio.h | 1 + lib/libc/stdio/Makefile.inc | 2 +- lib/libc/stdio/snprintf.c | 28 +++++ lib/libnet/Makefile | 2 +- lib/libnet/dhcp.c | 33 ++++++ lib/libnet/netload.c | 189 +++++++++++++++++++-------------- lib/libnet/ping.c | 14 ++- lib/libnet/pxelinux.c | 248 ++++++++++++++++++++++++++++++++++++++++++++ lib/libnet/pxelinux.h | 33 ++++++ lib/libnet/tftp.c | 105 ++++++++++++++++++- lib/libnet/tftp.h | 14 ++- slof/helpers.c | 30 +++++- 13 files changed, 608 insertions(+), 95 deletions(-) create mode 100644 lib/libc/stdio/snprintf.c create mode 100644 lib/libnet/pxelinux.c create mode 100644 lib/libnet/pxelinux.h