Skip to content

chromeos-v4.19.121.r9069.a3d5a26405f2c-surface-brunch

Pre-release
Pre-release
Compare
Choose a tag to compare
@kitakar5525 kitakar5525 released this 11 May 16:01
· 38 commits to master since this release

Always backup local files before updating kernel; it may refresh your local data.

Issues:

  • Surface 3: config-general-surface: ACPI error messages appear continuously on dmesg #15
    Because of this issue, mark this release as pre-release.

Note: I switched kernel config from config-minimal-surface to config-general-surface from this release.

build command

git clone https://github.com/kitakar5525/linux-surface-kernel
git pull --tags
git checkout chromeos-v4.19.121.r9069.a3d5a26405f2c-surface-brunch

# arch-lts419 kernel config
wget "https://aur.archlinux.org/cgit/aur.git/plain/config?h=linux-lts419" -q --show-progress -O config_archlinux-lts419

# linux-surface 4.19 kernel config fragment
wget https://raw.githubusercontent.com/linux-surface/linux-surface/master/configs/surface-4.19.config -q --show-progress -O config_surface-4.19-fragment

# generate chromiumos-x86_64 fragment
chromeos/scripts/prepareconfig chromiumos-x86_64
mv .config config_chromiumos-x86_64-prepareconfig

# my config changes. you can also place your changes here if you want.
cat << EOS > config_mychanges-fragment
CONFIG_5525_ACPI_CALL=m
# CONFIG_DEBUG_INFO is not set
CONFIG_VIDEO_IPU3_IMGU=m
CONFIG_PCIEASPM_DEBUG=y

# for debugging Surface 3 touchscreen input
CONFIG_SPI_PXA2XX=m
CONFIG_SPI_PXA2XX_PCI=m

# https://github.com/kitakar5525/chromeos-kernel-linux-surface/issues/3
# CONFIG_MODULE_COMPRESS is not set

# https://github.com/kitakar5525/chromeos-kernel-linux-surface/issues/8
# and https://github.com/kitakar5525/chromeos-kernel-linux-surface#direct-firmware-load-for-firmware-file-failed-with-error--2
CONFIG_DRM_I915=m

# https://github.com/kitakar5525/chromeos-kernel-linux-surface/issues/9
CONFIG_TCG_TIS_CORE=m
CONFIG_TCG_TIS=m
CONFIG_TCG_VIRTIO_VTPM=m

# built-in storage related config
CONFIG_MMC_BLOCK=y

# init: Unable to mount /sys/fs/selinux filesystem: No such file or directory
# then kernel panic (and reboot)
CONFIG_SECURITY_SELINUX_BOOTPARAM_VALUE=1
CONFIG_DEFAULT_SECURITY_SELINUX=y
# CONFIG_DEFAULT_SECURITY_DAC is not set
CONFIG_DEFAULT_SECURITY="selinux"

# Enable kernel headers through /sys/kernel/kheaders.tar.xz
CONFIG_IKHEADERS=m

# https://github.com/systemd/systemd/blob/master/README
CONFIG_EFIVAR_FS=y

# to match stock chromiumos config
CONFIG_KERNEL_GZIP=y
# CONFIG_KERNEL_XZ is not set

# resolve "Actual value" not changing to "Requested value"
# caused by "NETFILTER_XT_MATCH_OWNER is not set"
# not specified in chromiumos-x86_64 prepareconfig
# (arc continuously crashing without this change)
# CONFIG_NETFILTER_XT_MATCH_OWNER is not set
CONFIG_NETFILTER_XT_MATCH_QTAGUID=y
EOS

# a lot of output for the first time. So, using `> /dev/null`
# arch419 + chromiumos-x86_64 + surface419 + mychanges
scripts/kconfig/merge_config.sh config_archlinux-lts419 \
config_chromiumos-x86_64-prepareconfig \
config_surface-4.19-fragment \
config_mychanges-fragment > /dev/null
cp .config config_arch419+chromiumos-x86_64+surface419+mychanges

# second time, check the generated config. So, not using `> /dev/null` here.
# you may be interested in "Requested value" vs "Actual value".
scripts/kconfig/merge_config.sh .config \
config_chromiumos-x86_64-prepareconfig \
config_surface-4.19-fragment \
config_mychanges-fragment
cp .config config_arch419+chromiumos-x86_64+surface419+mychanges

# memo
cat << EOS
# useful when you have to reload modules?
CONFIG_I2C_HID=m
EOS

export KVER=4_19 # kernel version you want to build
export KVER_PERIOD=$(echo $KVER | sed s/_/./)

kernver="$(make -s kernelrelease)"
export INSTALL_MOD_PATH=../chromeos-kernel-linux-surface-$kernver # modules will be exported to $INSTALL_MOD_PATH/lib/modules/$kernver
export INSTALL_PATH=../chromeos-kernel-linux-surface-$kernver/boot; mkdir -p $INSTALL_PATH 
export INSTALL_MOD_STRIP=1 # to reduce the modules size (one example: 487M -> 35M)
modulesdir="$INSTALL_MOD_PATH/lib/modules/$kernver"

### build the kernel
make -j$(nproc --all) bzImage modules
# export the built modules
make modules_install # exported to $INSTALL_MOD_PATH
# remove build and source links
rm "$modulesdir"/{source,build}

# copy vmlinuz, System.map, and config
# not using `make install` because it seems that depending on distros
# used to build the kernel, config may not be installed.
# Filename may also vary. So, explicitly copy them manually...
cp arch/x86_64/boot/bzImage $INSTALL_PATH/vmlinuz-${kernver}
cp System.map* $INSTALL_PATH/System.map-${kernver}
cp .config $INSTALL_PATH/config-${kernver}

# copy files to build/ for external module building
mkdir "$modulesdir"/build
cp Module.symvers "$modulesdir"/build
cp $INSTALL_PATH/config-${kernver} "$modulesdir"/build/.config
cp $INSTALL_PATH/System.map-${kernver} "$modulesdir"/build/System.map

# compress lib dir
tar -C $INSTALL_MOD_PATH -czf $INSTALL_MOD_PATH/lib.tar.gz lib && rm -rf $INSTALL_MOD_PATH/lib
# compress the whole dir if you want
tar -czf ${INSTALL_MOD_PATH}.tar.gz $INSTALL_MOD_PATH && rm -rf $INSTALL_MOD_PATH

Installation

Chromium OS:

  1. Extract the release binary
  2. Extract the compressed lib dir (lib.tar.gz)
  3. Copy the lib dir under ROOT-A/
  4. Copy the boot/vmlinuz* to EFI-SYSTEM/syslinux/vmlinuz.A

Brunch:

  1. Extract the release binary
  2. Extract the compressed lib dir (lib.tar.gz)
  3. Copy the lib dir under ROOT-C/
  4. Copy the boot/vmlinuz* to ROOT-C/kernel

Note: kernel is not signed with secure boot key. Please do it manually yourself for now.

Note 2: for Chromium OS, you need to install mwifiex and ipts firmware.

Note 3: for Brunch, you need to resize ROOT-C to larger size (e.g. 2GB) until #3 is fixed because size of this kernel is too large without compression due to general kernel config (config-general-surface).

Note

Kernel tree info:

This build contains patches from linux-surface and brunch.
Especially, including the following patches that is necessary for brunch framework to work well on unibuild images.:

The product_name will be "Brunch".

$ cat /sys/devices/virtual/dmi/id/product_name
Brunch