Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1iP2jG-0006jJ-QI for mharc-grub-devel@gnu.org; Mon, 28 Oct 2019 06:58:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42735) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iP2jE-0006aL-3P for grub-devel@gnu.org; Mon, 28 Oct 2019 06:58:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iP2jC-0004wG-5F for grub-devel@gnu.org; Mon, 28 Oct 2019 06:58:27 -0400 Received: from mx0b-00190b01.pphosted.com ([2620:100:9005:57f::1]:17314) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iP2jB-0004w1-Nh for grub-devel@gnu.org; Mon, 28 Oct 2019 06:58:26 -0400 Received: from pps.filterd (m0122331.ppops.net [127.0.0.1]) by mx0b-00190b01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x9SAvQaW020458 for ; Mon, 28 Oct 2019 10:58:23 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=akamai.com; h=date : from : to : subject : message-id : mime-version : content-type; s=jan2016.eng; bh=zfQ79eUrcOhf0rWOV3GfcNhNvTWl5dLXt5+Fzy+S36w=; b=jboDsAxR7G4Lc9cuhPyLFuoLH8C2SpVp6kUL/yfyF44ONo5qcRD4ZnNneUwMYSHhNtJ1 pwtD8FDFt/X6A0yT8lUM4gf9nWg7O9qNlUeJl5JbcmZ/MwqhcmmOc87jXlcfesc0UxNm qFMc+tdL2G4vd36TccFohB2IL5V1cwbxKc5mShVMDF68oArFPJaT4O/aKq/IWMnmUrT7 xUWiG4RoXJPFsN7TJ0N7RagzvlzYm7bWMQNYxT+PItExQytKaGJAExD7AsorI+MNMNB6 Sus0K6h0myNkpojt+YkBTBIJXumeopFTHgaUE5IeE5y4k5K3YHwDb3Ki2+lKujziPb+p 6A== Received: from prod-mail-ppoint5 (prod-mail-ppoint5.akamai.com [184.51.33.60] (may be forged)) by mx0b-00190b01.pphosted.com with ESMTP id 2vvb0u1wrh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 28 Oct 2019 10:58:22 +0000 Received: from pps.filterd (prod-mail-ppoint5.akamai.com [127.0.0.1]) by prod-mail-ppoint5.akamai.com (8.16.0.27/8.16.0.27) with SMTP id x9SAlY2q024744 for ; Mon, 28 Oct 2019 03:58:22 -0700 Received: from email.msg.corp.akamai.com ([172.27.123.34]) by prod-mail-ppoint5.akamai.com with ESMTP id 2vvm48abyj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Mon, 28 Oct 2019 03:58:22 -0700 Received: from USMA1EX-CAS3.msg.corp.akamai.com (172.27.123.32) by usma1ex-dag3mb1.msg.corp.akamai.com (172.27.123.60) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Mon, 28 Oct 2019 06:58:21 -0400 Received: from lon-lp55b.london.corp.akamai.com (172.29.67.77) by USMA1EX-CAS3.msg.corp.akamai.com (172.27.123.32) with Microsoft SMTP Server id 15.0.1473.3 via Frontend Transport; Mon, 28 Oct 2019 06:58:21 -0400 Received: by lon-lp55b.london.corp.akamai.com (Postfix, from userid 37336) id 1DA53DFEF8; Mon, 28 Oct 2019 10:58:21 +0000 (GMT) Date: Mon, 28 Oct 2019 10:58:21 +0000 From: Max Tottenham To: Subject: Transfering Data from GRUB to userspace? Message-ID: <20191028105820.GC11778@akamai.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-10-28_05:, , signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=667 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1910280110 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,1.0.8 definitions=2019-10-28_05:2019-10-25,2019-10-28 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxscore=0 clxscore=1011 spamscore=0 bulkscore=0 phishscore=0 impostorscore=0 malwarescore=0 priorityscore=1501 suspectscore=1 mlxlogscore=660 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-1908290000 definitions=main-1910280112 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 2620:100:9005:57f::1 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Oct 2019 10:58:29 -0000 Hi Folks I've often found myself in a position where I've needed to perform some debugging of remote hardware that does not have a network accessible KVM attached. To that end, being able to remotely log into a machine and have some method of accessing GRUB2 boot time debug messages from userspace (in my case linux), would be rather useful. It also dawned on me that this capability might be the sort of thing that folks upstream might be keen on. I have done a little thinking and have thought of two possible approaches: 1. Perform some hacking of the grub environment block (load/save env) handling to be able to write log data to either the same file in /boot, or perhaps a separate distinct debug log file. 2. Export the debug log to a running kernel as another initrd image. In other words, have GRUB2 buffer a bunch of log messages and then append that log data as a separate initrd archive. Some early userspace program would then be able to copy that archive to the real filesystem, or stick it into the kernel log buffer. The logfile in the initrd that GRUB generates could have either a configurable name based on some setting in grub.cfg, or some well known default name (like /grub2-debug.log) I initially started with 1, but I dislike the approach of having GRUB2 write to the filesystem, it's also a little cumbersome to setup, Approach 2 seems like it would work (at least for linux, I've no experience with the BSDs but presumably any OS that can load multiple initrd's would be able to use this approach too), and has the advantage that it doesn't have to touch any data on disk. If there is no objection I can whip up a POC patch for 2 and post it to the list? Regards -- Max Tottenham | mtottenh@akamai.com Senior Software Engineer, Server Platform Engineering /(* Akamai Technologies