From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 8C4CE1382C5 for ; Thu, 2 Jul 2020 00:43:23 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 93638E08F9; Thu, 2 Jul 2020 00:43:22 +0000 (UTC) Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 8BA82E08F9 for ; Thu, 2 Jul 2020 00:43:22 +0000 (UTC) Received: by mail-pj1-x1036.google.com with SMTP id o22so6683632pjw.2 for ; Wed, 01 Jul 2020 17:43:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=Dv6D1Mwiu/244+aAfh7tb/TUBxhagSXebtmyHvhegzE=; b=lkYb8Ox56yytsuu8jySoe+1w64PviK6s3Q0iLulmxszLrm3+p8UzthnFi4pPWedLBh CC01SD8enpVyKKhLgaEv1nfs5SmrqqPt1tjv7JlOpjpAD1zUDQ9h9AI3fmpNe+5ZJpCN ZBUBfFYUfLaArrLSg55xajICCucdRQ33Ms785lC8mDE1QT42Yo+n7/vl5zbLEXJ+SqBH GNwGz+VpdAh5ocIGciHaOJWJLCHa4nWA4khZecvgBkNNkF1Sk6pki5MToNfq40Rw85WO V7Fh3xnyV8zsXCSOQRh0Jo3SGmPtLre7FIXwsCQf2i0vWaBiqZzmIGZ3QwC4/VV6wteT 8S8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Dv6D1Mwiu/244+aAfh7tb/TUBxhagSXebtmyHvhegzE=; b=UxztZACf3CTMc7zWvseSpv/PXldNbc6irh3FC/xTu9o7tQ90xsZkzoCv6afh3vikJ2 JFxc1NnPmdOMvXtsjVmTnQ9HMSFzvSbElmrhwkMTeJ85RPWbDpRsqg1vnSleE+xhl/ft Dp2hDZtLg7bLuYYDBDAt69N+HIlEz2XP2iaiHfNXOu/wb1qcu3ZqgZKgbG7NSHDyZtpM cjNQm/rhEF2ZfCSdgor+BkvyMj9iLkwVuuyxW6zfd0I7VEfnVYCxmy/3qA34wMeNuck2 5pA6tLgjaW89LgcLynIDIHpUG5ZEeZUs06VTnMf1Jfw51Udndr82oJIoUHwQ4b1/VzFZ kNjQ== X-Gm-Message-State: AOAM530Oc6Cny7mPhlMtkvzJGN3KBZ79yXdbJtF+mmPCT2sfvvzj+qlM uXNbFOmgZPZQgyTm/EAQOMdeYqCA X-Google-Smtp-Source: ABdhPJx6wVpJ3VWqQX6b6OAoGZMOQSRuJdZsDdw3NwPhOMQmAivB4pkDnPSHsD6+pO4av+qTntgt5A== X-Received: by 2002:a17:90a:c592:: with SMTP id l18mr31552053pjt.119.1593650601294; Wed, 01 Jul 2020 17:43:21 -0700 (PDT) Received: from localhost ([223.190.120.187]) by smtp.gmail.com with ESMTPSA id q20sm7117781pfn.111.2020.07.01.17.43.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jul 2020 17:43:20 -0700 (PDT) Date: Thu, 2 Jul 2020 06:13:09 +0530 From: Gunwant Jain To: Benda Xu Cc: gentoo-soc@lists.gentoo.org Subject: Re: Fwd: Re: [gentoo-soc] Weekly Report: Portage Powered Android Message-ID: <20200702004309.7ntq7fygtnjg53o4@tardis.localdomain> References: <20200701155705.q7ovhqnlrpcpa6iv@tardis.localdomain> <87tuyq4w94.fsf@robot.e.airelinux.org> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-soc@lists.gentoo.org Reply-to: gentoo-soc@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="vnmvc7lermv2hiaw" Content-Disposition: inline In-Reply-To: <87tuyq4w94.fsf@robot.e.airelinux.org> X-Archives-Salt: 41432507-f231-4343-8fb4-a119253c87ae X-Archives-Hash: 07de2b1ca173ef69140350001d06f77f --vnmvc7lermv2hiaw Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 20/07/02 08:05AM, Benda Xu wrote: > >> Could you please remind me why we need a bootstrap-init? Can we just > >> exec the Android init when the lxc-guest starts? > > > > Yeah sure. Apparently, Android needs to parse its device tree for early > > mounting partitions, before exec'ing `init`. Plus even before dealing > > with the dt, we need to mount `/system` and switch root to it. > > I could create the environment for "using /system as root" w/o the help > > of `bootstrap-init` but I couldn't deal with the device tree easily.=20 > > > > `bootstrap-init` creates the entire environment for android to boot from > > scratch and then finally exec's `init`. So I proposed to use it instead > > of manually setting up the LXC container for system-as-root devices.=20 > > That way the setup is clean as we only need a /dev directory and a stat= ic > > `bootstrap-init` binary inside of the LXC rootfs. >=20 > In principle you can choose your way of achieving things. But > considering you got stuck in making a functional 'bootstrap-init', I > have 2 questions. I would like to clarify first that bootstrap-init works fine, but due to the nature of build-system it requires, I was having difficulties in compiling it natively in arm64 Gentoo. =20 > 1. If you need to prepare a proper environment for Android to boot > inside the LXC guest, please check out LXC container hooks in > lxc.container.conf(5) manpage. Another init seems an overkill for > me. I was going with this approach initially, but the container configs just don't seem apt for a process like this. I mean to mount the early partitions only, I have no clue how I would approach parsing the device tree using the LXC conf.=20 Although I had made some slight edits to the original container hook scripts, for keeping the rootfs clean after reboots and more. You could check the modified scripts in [1]. > 2. Why bootstrap-init needs to be written in C++? Would a shell script > enough? I followed Magisk's approach of booting SAR Android. I thought of rewriting the entire init but realised that that would be rather inefficient. Therefore, I stripped all the "Magisk-y" code and put forward the bare minimum required for functioning. In theory, we could rewrite it all in shell, but then again, I would not recommend it as it could be somewhat lengthy.=20 Moreover, this setup is scalable and it could be extended later for any=20 new boot-scheme Android pulls up. If required by any situation, I can willingly rewrite it in shell as=20 well. Regards, Gunwant [1] https://wantguns.gitlab.io/blog/sharkbait/starting_android_in_gentoo/#i= nstall-lxc --vnmvc7lermv2hiaw Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEEVcYcuddz0Grkn4q20gpuZPFudnkFAl79LZ0ACgkQ0gpuZPFu dnlBqwf9FyeRpXiDutinYeqmslLULhZWnG2O/rcnrpwVUY2quP3JYt+Ot1km6Zi7 B5kTZ+o4BGFV/AkadflICiQEcxytUFdlxdkQ0TjJU816D/3dwahA2q2LjWE84qqp 9osBZVGh15uUvG70iSoc4myS67AxNBfh2FqngTvpV2e2jB9uRp8wNHZfzAZViVLT pDK79Qj7BlAre4eheM9KqwRIEQTYanDrVnkdQS/JfBL/391VdbjsGlPB49pHG7U+ lYDcVBqZpgjlLSAxeZdSlzO8tCkxMl870cCxi4eqHp8OUHOxFLKBngvgANhB4amb gT9no5Cp/tAQU+IcQ/FMutbIGBmxzw== =eN3E -----END PGP SIGNATURE----- --vnmvc7lermv2hiaw--