From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: MIME-Version: 1.0 From: Jon Ringle Date: Mon, 18 Feb 2019 11:11:51 -0500 Message-ID: Subject: [ptxdist] Problems building kernel image with initramfs with no tty List-Id: PTXdist Development Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: ptxdist@pengutronix.de Content-Type: multipart/mixed; boundary="===============1866529645==" Errors-To: ptxdist-bounces@pengutronix.de Sender: "ptxdist" To: ptxdist@pengutronix.com --===============1866529645== Content-Type: multipart/alternative; boundary="0000000000009d6fa005822d622e" --0000000000009d6fa005822d622e Content-Type: text/plain; charset="UTF-8" I've recently updated to ptxdist-2019.01.0 and have noted some changes with my project that builds a kernel image with initramfs: 1) In rules/kernel.make, there is the following code: # # Don't keep the expanded path to INITRAMS_SOURCE in $(KERNEL_CONFIG), # because it contains local workdir path which is not relevant to # other developers. # ifdef KERNEL_INITRAMFS_SOURCE_y @sed -i -e 's,^CONFIG_INITRAMFS_SOURCE.*$$,CONFIG_INITRAMFS_SOURCE=\"# Automatically set by PTXDist\",g' \ "$(<)" endif However, this is no longer having the intended behavior. The $(KERNEL_CONFIG) is being modified after doing a `ptxdist images`: $ ptxdist print KERNEL_CONFIG /home/local/GRIDPOINT/jringle/git/linux-initramfs/ptxconf/ec1k/kernelconfig-3.12 $ ptxdist print KERNEL_INITRAMFS_SOURCE_y /home/local/GRIDPOINT/jringle/git/linux-initramfs/platform-ec1k/state/empty.cpio $ git diff diff --git a/ptxconf/ec1k/kernelconfig-3.12 b/ptxconf/ec1k/kernelconfig-3.12 index 247c3bb..c77037f 100644 --- a/ptxconf/ec1k/kernelconfig-3.12 +++ b/ptxconf/ec1k/kernelconfig-3.12 @@ -116,7 +116,7 @@ CONFIG_NET_NS=y # CONFIG_SYSFS_DEPRECATED is not set # CONFIG_RELAY is not set CONFIG_BLK_DEV_INITRD=y -CONFIG_INITRAMFS_SOURCE="# Automatically set by PTXDist" +CONFIG_INITRAMFS_SOURCE="/home/local/GRIDPOINT/jringle/git/linux-initramfs/platform-ec1k/state/empty.cpio" CONFIG_INITRAMFS_ROOT_UID=0 CONFIG_INITRAMFS_ROOT_GID=0 # CONFIG_RD_GZIP is not set 2) As a result of the above, the build behavior is different between a build with a tty, and a build without a tty (build by a CI build environment), because the kernel config file has changed and ptxd_make_kconfig_sync() in scripts/lib/ptxd_make_world_kconfig.sh is called: ptxd_make_kconfig_sync() { local mode if [ "${ptx_config_mode}" = run ]; then if tty -s; then ptx_config_mode=update else ptx_config_mode=check fi fi if [ -n "${ref_file_dotconfig}" ]; then file_dotconfig="${ref_file_dotconfig}" ptxd_normalize_config && relative_ref_file_dotconfig="${relative_file_dotconfig}" fi && ptxd_normalize_config && ptxd_kconfig_sync_config "${ptx_config_mode}" "${pkg_build_dir}/.config" \ "${relative_file_dotconfig}" "${file_dotconfig}" "${relative_ref_file_dotconfig}" } A build failure without a tty can be simulated with: `ssh localhost "cd $(pwd); ptxdist images"`: ---------------------- target: kernel.prepare ---------------------- Using config file: 'linux-initramfs/ptxconf/ec1k/kernelconfig-3.12' make[1]: Entering directory `/home/local/GRIDPOINT/jringle/git/linux' scripts/kconfig/conf --oldconfig Kconfig # # configuration written to .config # make[1]: Leaving directory `/home/local/GRIDPOINT/jringle/git/linux' ptxdist: error: Outdated config for 'linux-initramfs' ptxdist: error: 'oldconfig' changes the file. Run 'oldconfig kernel' to update. make: *** [/home/local/GRIDPOINT/jringle/git/linux-initramfs/platform-ec1k/state/kernel.prepare] Error 1 I worked around this by modifying the ptxdist used by our build server so that ptxd_make_kconfig_sync() always used ptx_config_mode=update even if there is no tty. But I know that this is not the right solution. But I also don't know what the proper solution should be. Regards, -Jon --0000000000009d6fa005822d622e Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I've recen= tly updated to ptxdist-2019.01.0 and have noted some changes with my projec= t that builds a kernel image with initramfs:

1) In rules= /kernel.make, there is the following code:
#
=
# Don't keep the expanded path to INITRAMS_S= OURCE in $(KERNEL_CONFIG),
# because it con= tains local workdir path which is not relevant to
# other developers.
#
ifdef KERNEL_INITRAMFS_SOURCE_y
=C2=A0 =C2=A0 =C2=A0 =C2=A0 @sed -i -e 's,^CONFIG_INITRAMFS_SOUR= CE.*$$,CONFIG_INITRAMFS_SOURCE=3D\"# Automatically set by PTXDist\&quo= t;,g' \
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 "$(<)"
endif

=
However, this is no longer having the intended behavior. The $(KERNEL_= CONFIG) is being modified after doing a `ptxdist images`:
=
$ ptxdist print KERNEL_CONFIG
/home/local/= GRIDPOINT/jringle/git/linux-initramfs/ptxconf/ec1k/kernelconfig-3.12
<= /div>
$ ptxdist print = KERNEL_INITRAMFS_SOURCE_y
/home/local/GRIDPOINT/jringle/git/linux-initramfs/platform-= ec1k/state/empty.cpio
$ git diff
diff --git a/ptxconf/ec1k/kernelconfig-3.12 b/ptxconf/ec1k/ker= nelconfig-3.12
=
index 247c3bb..c77037f 100644
=
--- a/ptxconf/ec1k/kernelconfig-3.12
+++ b/ptxconf/ec1k/kern= elconfig-3.12
<= div>@@ -116,7 +116,7 @@ CONFIG_NET_NS=3Dy
=C2=A0# CONFIG_SYSFS_DEPRECATED is not set<= /div>
=C2=A0# CO= NFIG_RELAY is not set
=C2=A0CONFIG_BLK_DEV_INITRD=3Dy
-CONFIG_INITRAMFS_SOURCE=3D"# Automa= tically set by PTXDist"
<= div>
+CONFIG_INITRAMFS_SOURCE=3D"/home/local/GRIDPOINT/j= ringle/git/linux-initramfs/platform-ec1k/state/empty.cpio"
=
=C2=A0CONFIG_INITRAMF= S_ROOT_UID=3D0
=
=C2=A0CONFIG_INITRAMFS_ROOT_GID=3D0
=C2=A0# CONFIG_RD_GZIP is not set

2) As a result of the ab= ove, the build behavior is different between a build with a tty, and a buil= d without a tty (build by a CI build environment), because the kernel confi= g file has changed and ptxd_make_kconfig_sync() in scripts/lib/ptxd_make_wo= rld_kconfig.sh is called:
ptxd_make_kconfig_sync() {
=C2=A0 =C2=A0 local mode
<= /div>
=C2= =A0 =C2=A0 if [ "${ptx_config_mode}" =3D run ]; then
<= /div>
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 if tty -s; then
=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 ptx_config_mode=3Dupdate
=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 else
<= /div>
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ptx_config_mode=3Dcheck
=C2=A0 =C2=A0 =C2= =A0 =C2=A0 fi
=
=C2=A0 =C2=A0 fi
=C2=A0 =C2=A0 if [ -n "${ref_file_dotconfig}" ]; then
=C2=A0 =C2=A0 =C2=A0 =C2=A0 file_dotconfig=3D"${ref_file_dotcon= fig}" ptxd_normalize_config &&
=C2=A0 =C2=A0 =C2=A0 = =C2=A0 relative_ref_file_dotconfig=3D"${relative_file_dotconfig}"=
=C2=A0 =C2=A0 fi &&
=C2=A0 =C2=A0 ptxd_normali= ze_config &&
=C2=A0 =C2=A0 ptxd_kconfig_sync_config "= ;${ptx_config_mode}" "${pkg_build_dir}/.config" \
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 "${relative_file_dotconfig}" "${= file_dotconfig}" "${relative_ref_file_dotconfig}"
= }

A build failure wit= hout a tty can be simulated with: `ssh localhost "cd $(pwd); ptxdist i= mages"`:
=
----------------------
target: k= ernel.prepare
----------------------

Using config file: 'linux-initramfs= /ptxconf/ec1k/kernelconfig-3.12'

make[1]: Entering directory `/home/local/GRIDPOINT/jringle/git= /linux'
=
scripts/kconfig/conf --oldconfig Kconfig=
<= div>
#
# configuration written to= .config
#
=
make[1]: Leaving d= irectory `/home/local/GRIDPOINT/jringle/git/linux'

ptxdist: error: Outdated config for 'lin= ux-initramfs'
ptxdist: error: 'oldconfig'= ; changes the file. Run 'oldconfig kernel' to update.
=

make: *** [/home/local/GRIDPOINT/jrin= gle/git/linux-initramfs/platform-ec1k/state/kernel.prepare] Error 1

I worked around this by mod= ifying the ptxdist used by our build server so that ptxd_make_kconfig_sync(= ) always used ptx_config_mode=3Dupdate even if there is no tty. But I know = that this is not the right solution. But I also don't know what the pro= per solution should be.

Regards,
-Jon


=
--0000000000009d6fa005822d622e-- --===============1866529645== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KcHR4ZGlzdCBt YWlsaW5nIGxpc3QKcHR4ZGlzdEBwZW5ndXRyb25peC5kZQ== --===============1866529645==--