From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752483AbeAZSPV (ORCPT ); Fri, 26 Jan 2018 13:15:21 -0500 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:34529 "EHLO out3-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751641AbeAZSPQ (ORCPT ); Fri, 26 Jan 2018 13:15:16 -0500 X-ME-Sender: Date: Fri, 26 Jan 2018 16:15:13 -0200 From: Henrique de Moraes Holschuh To: Victor Kamensky Cc: Rob Landley , Arnd Bergmann , Taras Kondratiuk , "H. Peter Anvin" , Al Viro , Mimi Zohar , Jonathan Corbet , James McMechan , initramfs@vger.kernel.org, linux-doc@vger.kernel.org, Linux Kernel Mailing List , LSM List , xe-linux-external@cisco.com Subject: Re: [PATCH v2 01/15] Documentation: add newcx initramfs format description Message-ID: <20180126181512.hnotac2lpxkj4ruv@khazad-dum.debian.net> References: <1516850875-25066-1-git-send-email-takondra@cisco.com> <1516850875-25066-2-git-send-email-takondra@cisco.com> <0725a45f-45ee-7346-12ee-c3cc4b862654@landley.net> <20180126103132.7szs5lj5ppm7eyy6@khazad-dum.debian.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-GPG-Fingerprint1: 4096R/0x0BD9E81139CB4807: C467 A717 507B BAFE D3C1 6092 0BD9 E811 39CB 4807 User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 26 Jan 2018, Victor Kamensky wrote: > On Fri, 26 Jan 2018, Henrique de Moraes Holschuh wrote: > > On Thu, 25 Jan 2018, Rob Landley wrote: > > > That said, I don't think -h newcx should emit (or recognize) the > > > "TRAILER!!!1!" entry. That's kinda silly in-band signaling for 2018: > > > files have a length, pipes provide EOF, and each cpiox entry starts with > > > 6 bytes of c_magic anyway. > > My understanding that TRAILER is really used on tape devices, > there is no notion of file end in this case, it is just a stream of bytes > from char device. TRAILER is really used anywhere you can have several cpio archives concatenated, which is the exact case of a Linux initramfs, not just tape. The initramfs format takes *one or more* cpio archives, concatenated. Each archive may be independently compressed (using whatever supported compression method), or uncompressed[1]. EOF or size information can only tell you where the entire concatenated archive ends, not where each "segment" (independent cpio archive that was concatenated into the whole) ends. TRAILER is the only decent way to know the concatenation points. Knowing where these points are is necessary for the kernel, due to the way hardlink encoding is done on cpio archives: one has to reset the state of the hardlink-tracking table between cpio archives that were concatenated, for safety (and sysadmin sanity) reasons. [1] for the special case when one includes an "early initramfs" section for firmware (microcode, etc) updates, the archive(s) containing the firmware data must be uncompressed, and these archives must come before compressed archives in the concatenation. -- Henrique Holschuh