From patchwork Tue Apr 4 16:22:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 746885 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 3vyDm74n0bz9sDB for ; Wed, 5 Apr 2017 02:23:03 +1000 (AEST) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3vyDm73CmJzDqHW for ; Wed, 5 Apr 2017 02:23:03 +1000 (AEST) X-Original-To: slof@lists.ozlabs.org Delivered-To: slof@lists.ozlabs.org Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3vyDm46DhvzDq7c for ; Wed, 5 Apr 2017 02:23:00 +1000 (AEST) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E73E4C059725; Tue, 4 Apr 2017 16:22:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com E73E4C059725 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=thuth@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com E73E4C059725 Received: from thh440s.str.redhat.com (dhcp-192-189.str.redhat.com [10.33.192.189]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6CA8259D25; Tue, 4 Apr 2017 16:22:58 +0000 (UTC) From: Thomas Huth To: slof@lists.ozlabs.org Date: Tue, 4 Apr 2017 18:22:57 +0200 Message-Id: <1491322977-27353-1-git-send-email-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Tue, 04 Apr 2017 16:22:59 +0000 (UTC) Subject: [SLOF] [PATCH] Fix ugly boot menu if devices have been specified with bootindex X-BeenThere: slof@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Patches for https://github.com/aik/SLOF" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: slof-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "SLOF" If the user has started with some devices that have the bootindex parameter set, these devices show up in a very ugly way in the boot menu of SLOF. For example, if you start QEMU with: qemu-system-ppc64 ... -boot menu=on -device spapr-vscsi,id=scsi0 \ -drive file=distro.iso,if=none,media=cdrom,readonly=on,id=img0 \ -device scsi-cd,drive=img0,bootindex=1 and press F12 for the boot menu during boot, the first entry of the menu looks like this: 1. /vdevice/v-scsi@71000003/disk@8000000000000000: /vdevice/v-scsi@71000003/disk@8000000000000000 So the device tree path is printed twice here. Normally, the first part before the colon should be the short-hand alias of the device instead. This happens because QEMU passes the full device path to SLOF here, so SLOF does not add the boot device via an alias in this case. Fix this issue by looking up the alias for the device tree node if the boot device in the list starts with a "/" (i.e. it is not an alias yet). Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1429832 Signed-off-by: Thomas Huth --- slof/fs/start-up.fs | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/slof/fs/start-up.fs b/slof/fs/start-up.fs index dc5d1ed..7186482 100644 --- a/slof/fs/start-up.fs +++ b/slof/fs/start-up.fs @@ -90,10 +90,42 @@ TRUE VALUE use-load-watchdog? (boot) ; +\ Try to get the alias for a given device tree node path +: get-alias ( dstr dlen -- astr alen ) + over c@ [char] / <> IF EXIT THEN + s" /aliases" find-node ( dstr dlen phandle ) + dup >r + node>properties @ cell+ @ BEGIN + dup + WHILE + ( dstr dlen lfa R: phandle ) + dup link> >name name>string + ( dstr dlen lfa astr alen R: phandle ) + 2dup r@ get-property ABORT" alias not available" + ( dstr dlen lfa astr alen propdata proplen R: phandle ) + 1- + 6 pick 6 pick + str= IF ( dstr dlen lfa astr alen R: phandle ) + r> drop + >r >r 3drop r> r> + ( astr alen ) + EXIT + ELSE + 2drop + THEN + @ + REPEAT + ( dstr dlen lfa R: phandle ) + r> + 2drop +; + : boot-start decimal BEGIN parse-word dup WHILE - my-boot-dev (u.) s" . " $cat type 2dup type ." : " de-alias type cr + my-boot-dev (u.) s" . " $cat type + 2dup get-alias type + ." : " de-alias type cr my-boot-dev 1 + to my-boot-dev REPEAT 2drop 0 0 load-list 2!