kitakar5525 / chromeos-kernel-linux-surface

linux-surface kernel for chromiumos.
GNU General Public License v3.0
18 stars 1 forks source link

GENTOO: Kernel config will be overridden automatically before building #2

Closed kitakar5525 closed 4 years ago

kitakar5525 commented 5 years ago

When building using cros_workon_make, kernel config may be overridden by someone:

$ FEATURES="noclean" cros_workon_make --board=${BOARD} chromeos-kernel-4_19 --install
[...]
13:38:51 >>> Configuring source in /mnt/host/source/src/third_party/kernel/v4.19 ...
 * Using kernel config: chromiumos-x86_64
 *    - enabling Enable ACPI AC config
 *    - disabling framebuffer console config
 *    - enabling Support running virtual machines with KVM config
 *    - enabling CDC MBIM driver config
 *    - enabling TPM support config
 *    - enabling Transparent Hugepage Support config
 *    - enabling Virtual USB support config
 *    - enabling Virtual Video Test Driver config
 *    - enabling 802.1Q VLAN config
 *    - disabling VT console config
make -j48 O=/build/amd64-generic/var/cache/portage/sys-kernel/chromeos-kernel-4_19 LD=/usr/x86_64-pc-linux-gnu/x86_64-cros-linux-gnu/binutils-bin/2.27.0/ld 'CC=x86_64-cros-linux-gnu-clang -B/usr/x86_64-pc-linux-gnu/x86_64-cros-linux-gnu/binutils-bin/2.27.0' 'CXX=x86_64-cros-linux-gnu-clang++ -B/usr/x86_64-pc-linux-gnu/x86_64-cros-linux-gnu/binutils-bin/2.27.0' HOSTCC=x86_64-pc-linux-gnu-clang HOSTCXX=x86_64-pc-linux-gnu-clang++ olddefconfig 
make[1]: Entering directory '/build/amd64-generic/var/cache/portage/sys-kernel/chromeos-kernel-4_19'
  GEN     ./Makefile
scripts/kconfig/conf  --olddefconfig Kconfig
.config:794:warning: override: reassigning to symbol FRAMEBUFFER_CONSOLE
.config:803:warning: override: reassigning to symbol KVM
.config:808:warning: override: reassigning to symbol KVM_INTEL
.config:810:warning: override: reassigning to symbol VSOCKETS
.config:811:warning: override: reassigning to symbol VHOST_VSOCK
.config:819:warning: override: reassigning to symbol TCG_TPM
.config:820:warning: override: reassigning to symbol TCG_TIS
#
# configuration written to .config
#
make[1]: Leaving directory '/build/amd64-generic/var/cache/portage/sys-kernel/chromeos-kernel-4_19'
13:38:54 >>> Source configured.
[...]
kitakar5525 commented 4 years ago

I'm not familiar with Gentoo, but at least it seems that we can see used USE flags:

# after building chromeos-kernel-4_19 with the following command:
# FEATURES="noclean" cros_workon_make --board=${BOARD} chromeos-kernel-4_19 --install

$ cat /build/amd64-generic/tmp/portage/sys-kernel/chromeos-kernel-4_19-9999/build-info/USE
abi_x86_64 acpi_ac amd64 board_use_amd64-generic clang dt_compression elibc_glibc fit_compression_kernel_lz4 kernel_linux kvm_host mbim tpm transparent_hugepage usbip userland_GNU vivid vlan

We can override the USE flag at least at build time like this:

$ USE="${USE} -tpm" FEATURES="noclean" cros_workon_make --board=${BOARD} chromeos-kernel-4_19 --install
[...]
13:43:31 >>> Configuring source in /mnt/host/source/src/third_party/kernel/v4.19 ...
 * Using kernel config: chromiumos-x86_64
 *    - enabling Enable ACPI AC config
 *    - disabling framebuffer console config
 *    - enabling Support running virtual machines with KVM config
 *    - enabling CDC MBIM driver config
 *    - enabling Transparent Hugepage Support config
 *    - enabling Virtual USB support config
 *    - enabling Virtual Video Test Driver config
 *    - enabling 802.1Q VLAN config
 *    - disabling VT console config
make -j48 O=/build/amd64-generic/var/cache/portage/sys-kernel/chromeos-kernel-4_19 LD=/usr/x86_64-pc-linux-gnu/x86_64-cros-linux-gnu/binutils-bin/2.27.0/ld 'CC=x86_64-cros-linux-gnu-clang -B/usr/x86_64-pc-linux-gnu/x86_64-cros-linux-gnu/binutils-bin/2.27.0' 'CXX=x86_64-cros-linux-gnu-clang++ -B/usr/x86_64-pc-linux-gnu/x86_64-cros-linux-gnu/binutils-bin/2.27.0' HOSTCC=x86_64-pc-linux-gnu-clang HOSTCXX=x86_64-pc-linux-gnu-clang++ olddefconfig 
make[1]: Entering directory '/build/amd64-generic/var/cache/portage/sys-kernel/chromeos-kernel-4_19'
  GEN     ./Makefile
scripts/kconfig/conf  --olddefconfig Kconfig
.config:794:warning: override: reassigning to symbol FRAMEBUFFER_CONSOLE
.config:803:warning: override: reassigning to symbol KVM
.config:808:warning: override: reassigning to symbol KVM_INTEL
.config:810:warning: override: reassigning to symbol VSOCKETS
.config:811:warning: override: reassigning to symbol VHOST_VSOCK
#
# configuration written to .config
#
make[1]: Leaving directory '/build/amd64-generic/var/cache/portage/sys-kernel/chromeos-kernel-4_19'
13:43:34 >>> Source configured.
[...]
kitakar5525 commented 4 years ago

Now, my question is:

kitakar5525 commented 4 years ago

Found a list of USE flags:

$ cat /home/ubuntu/chromiumos/src/third_party/chromiumos-overlay/eclass/cros-kernel2.eclass

or see this link: https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/master/eclass/cros-kernel2.eclass#124

Especially, we may be interested in these flags:

kitakar5525 commented 4 years ago

# _config_disable fragments are optional and will be appended to kernel config # if use flag is not set. https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/master/eclass/cros-kernel2.eclass#117

So, we need to specify fbconsole and vtconsole explicitly to avoid getting automatically disabled those corresponding kernel configs.

$ USE="${USE} -tpm fbconsole vtconsole" FEATURES="noclean" cros_workon_make --board=${BOARD} chromeos-kernel-4_19 --install
[...]
15:58:25 >>> Configuring source in /mnt/host/source/src/third_party/kernel/v4.19 ...
 * Using kernel config: chromiumos-x86_64
 *    - enabling Enable ACPI AC config
 *    - enabling framebuffer console config
 *    - enabling Support running virtual machines with KVM config
 *    - enabling CDC MBIM driver config
 *    - enabling Transparent Hugepage Support config
 *    - enabling Virtual USB support config
 *    - enabling Virtual Video Test Driver config
 *    - enabling 802.1Q VLAN config
 *    - enabling VT console config
make -j48 O=/build/amd64-generic/var/cache/portage/sys-kernel/chromeos-kernel-4_19 LD=/usr/x86_64-pc-linux-gnu/x86_64-cros-linux-gnu/binutils-bin/2.27.0/ld 'CC=x86_64-cros-linux-gnu-clang -B/usr/x86_64-pc-linux-gnu/x86_64-cros-linux-gnu/binutils-bin/2.27.0' 'CXX=x86_64-cros-linux-gnu-clang++ -B/usr/x86_64-pc-linux-gnu/x86_64-cros-linux-gnu/binutils-bin/2.27.0' HOSTCC=x86_64-pc-linux-gnu-clang HOSTCXX=x86_64-pc-linux-gnu-clang++ olddefconfig 
make[1]: Entering directory '/build/amd64-generic/var/cache/portage/sys-kernel/chromeos-kernel-4_19'
  GEN     ./Makefile
scripts/kconfig/conf  --olddefconfig Kconfig
.config:794:warning: override: reassigning to symbol FRAMEBUFFER_CONSOLE
.config:803:warning: override: reassigning to symbol KVM
.config:808:warning: override: reassigning to symbol KVM_INTEL
.config:810:warning: override: reassigning to symbol VSOCKETS
.config:811:warning: override: reassigning to symbol VHOST_VSOCK
#
# configuration written to .config
#
make[1]: Leaving directory '/build/amd64-generic/var/cache/portage/sys-kernel/chromeos-kernel-4_19'
15:58:28 >>> Source configured.
[...]
kitakar5525 commented 4 years ago

Closing this issue because I don't use cros_sdk anymore. May be reopened when someone is interested in cros_sdk.