Device Specific Setup - dslm4515/BMLFS GitHub Wiki
Uploaded specs at linux-hardware.org ... for the Celeron variant
- UEFI Boot from eMMC, mSD card, and USB (MrChromebox-4.16 04/09/2022)
- Audio (Speaker+Headphone-Jack) -- Mainstream kernel (5.18.x) has support
- Wifi (iwd) -- Mainstream kernel (5.18.x) has support
- Bluetooth -- Mainstream kernel (5.18.x) has support
- Tochpad & keyboard -- Mainstream kernel (5.18.x) has support
- Wayland - Tested with Wayfire + wlroots
- Webcam - not tested yet.
Boot Parameters: tpm_tis.interrupts=0 acpi_osi=Linux
SD Card Slot & eMMc [ mmcblk ]
Device Drivers -->
[*] MMC/SD/SDIO card support --->
<*> MMC block device driver
<*> Secure Digital Host Controller Interface support
<*> SDHCI support for ACPI enumerated SDHCI controllers
Touchpad [ Atmel maXTouch Touchpad ]
Device Drivers -->
Input device support --->
<*> Mouse interface
[*] Mice --->
<M> PS/2 mouse
[*] Touchscreens --->
<M> Atmel mXT I2C Touchscreen
I2C support --->
<*> I2C device interface
I2C Hardware Bus support --->
<M> Synopsys DesignWare Platform
Bluetooth [Intel Bluetooth]
Firmware: intel/ibt-hw-37.8.10-fw-1.10.3.11.e.bseq
Networking Support -->
<M/*> Bluetooth subsystem support --->
[*] Bluetooth Classic (BR/EDR) features
<M> RFCOMM protocol support
<M> BNEP protocol support
<M> CMTP protocol support
<M> HIDP protocol support
Bluetooth device drivers --->
<M> HCI USB driver
[*] Broadcom protocol support
[*] MediaTek protocol support
[*] Realtek protocol support
<M> HCI VHCI (Virtual HCI device) driver
HID support --->
[*] Battery level reporting for HID devices
[*] /dev/hidraw raw HID device support
<M> User-space I/O driver support for HID subsystem
<M> Generic HID driver
Special HID drivers --->
<M> Logitech devices
<M> Logitech receivers full support
-M- Logitech HID++ devices support
Mainstream kernel works. It's just a matter of selecting the correct drivers and features. No patches needed.
To compile:
cd linux
# Clean
make mrproper
# Apply this patch as to enable module signing with SHA512 & LibreSSL
#diff --git a/scripts/sign-file.c b/scripts/sign-file.c
#index fbd34b8e8f57..fd4d7c31d1bf 100644
#--- a/scripts/sign-file.c
#+++ b/scripts/sign-file.c
#@@ -41,9 +41,10 @@
# * signing with anything other than SHA1 - so we're stuck with that if such is
# * the case.
# */
#-#if defined(LIBRESSL_VERSION_NUMBER) || \
#- OPENSSL_VERSION_NUMBER < 0x10000000L || \
#- defined(OPENSSL_NO_CMS)
#+#if defined(OPENSSL_NO_CMS) || \
#+ ( defined(LIBRESSL_VERSION_NUMBER) \
#+ && (LIBRESSL_VERSION_NUMBER < 0x3010000fL) ) || \
#+ OPENSSL_VERSION_NUMBER < 0x10000000L
# #define USE_PKCS7
# #endif
# #ifndef USE_PKCS7
# Validate config and update with new kernel [config] symbols
make oldconfig
# Modify config if desired:
make menuconfig
# Build kernel & modules
make bzImage modules
# Install modules
make INSTALL_MOD_PATH=${BUILD} modules_install
# Install kernel, config and symbol map:
cp -iv arch/x86/boot/bzImage ${BUILD}/boot/vmlinuz
cp -iv .config ${BUILD}/boot/config
cp -iv .config ${BUILD}/boot/config
source ArchLinux Build
source for module-siging with LibreSSL
in progress
initrd.img
[from GalliumOS] has two archives inside: first is the intel CPU microcode and then secondly, the actual initrd
.
The actual initrd
is gzip'ed with kernel modules.
To extract the microcode:
$ file initrd.img-4.16.18-GaOS
initrd.img-4.16.18-GaOS: ASCII cpio archive (SVR4 with no CRC)
$ mkdir mcode && cd mcode
$ cpio -mvid < ../initrd.img-4.16.18-GaOS
kernel
kernel/x86
kernel/x86/microcode
kernel/x86/microcode/.enuineIntel.align.0123456789abc
kernel/x86/microcode/GenuineIntel.bin
5784 blocks
The first 5784
blocks of initrd.img-4.16.18-GaOS
is the microcode. Skip these blocks to unpack the actual initrd
archive:
$ cd ..
$ dd if=initrd.img-4.16.18-GaOS bs=512 skip=5784 of=initramfs.img
# Now it can be unpacked:
$ mkdir initrd-build && cd initrd-build
$ zcat ../initramfs.img | cpio -idmv
To re-pack:
# Pack-up the modified initramfs as `initramfs.gz`
$ cd initrd-build && mkdir ../inner-initrd
$ find . | cpio -o | gzip -9 > ../inner-initrd initramfs.gz
# Create the new [final] initrd.img:
$ cd ../mcode
$ find kernel/ | cpio -o -H newc > ../initrd.img
# Add initramfs.gz to new initrd.img:
$ find ../inner-initrd/ | cpio -o >> ../initrd.img
Source: Unpack stock GalliumOS initrd.img Source: Unpacking and packing initrd.img's
Currently, modified initrd.img causes kernel panic (unable to find & mount rootfs from the root=
kernel parameter). For now, ditch the initrd.img
and make sure the mmcblk
driver is built into kernel (and not as a module), so that kernel can mount rootfs with the kernel modules. I assume GalliumOS created a initrd.img to load the microcode as early in boot AND to build as many drivers as modules to reduce the kernel image size.
- Install alsa-lib & alsa-ucm-conf
- Create
/etc/asoundrc
with card 2 as default:
pcm.!default {
type hw
card 2
}
ctl.!default {
type hw
card 2
}
- Configure soundcard:
alsaucm -c chtrt5650 set _verb HiFi set _enadev Speaker
... not persistent between boots. May need to add to boot scripts. - Restart ALSA:
alsactl init
Test with a WAV or MP3 file to test build-in speakers:
aplay -D sysdefault:CARD=chtrt5650 sample.wav
mpg123 -a sysdefault:CARD=chtrt5650 sample.mp3
UPDATE: When using the 5.10.1 kernel from Hurrico's Fork, step 3 is still needed (at the VT/commnadline) UNLESS a Wayland DE is launched. Afterwards, audio is still fixed even while on the VT after exiting a Wayland DE. Step 4 may only be needed if using the GallimOS built kernel. No need to specify audio device , sysdefault:CARD=chtrt5650
when using Hurrico's kernel fork
Requires firmware:
/lib/firmware/iwlwifi-7265D-22.ucode
/lib/firmware/iwlwifi-7265D-27.ucode
/lib/firmware/iwlwifi-7265D-29.ucode
The eMMC is ~ 16GB. Probably will use micro-SD card slot to expand storage.
To avoid creating a swap partition on the eMMC, use ZRAM
Perhaps, create a squashFS filesystem for /opt
. Currently, /opt
has:
- X11/Xorg libraries, headers, and apps
- Qt5 libraries, headers, apps
- OpenSSL libraries for apps that will not build against LibreSSL
- Openjdk libraries, headers and apps.
- /opt/build - Packages used for building packages and not required at boot, like CMake or nasm.
Make sure to enable zram as a kernel module (for flexibility).
Disable zswap (similar name, different beast) to avoid it acting as a swap cache in front of zram:
sudo bash -c "echo 0 > /sys/module/zswap/parameters/enabled"
Disable any active swaps:
sudo swapoff --all
# May need to comment/remove any swap entries in /etc/fstab
Setup the zram device:
# Load the kernel module
$ sudo modprobe zram num_devices=1
# Show supported compression algorithms
$ cat /sys/block/zram0/comp_algorithm
# Set compression algorithm (example: zstd)
$ sudo bash -c "echo zstd > /sys/block/zram0/comp_algorithm"
# Set disk size (example: 4G)
$ sudo bash -c "echo 4G > /sys/block/zram0/disksize"
# Activate zram0 device with the highest priority setting of 32767
$ sudo mkswap --label zram0 /dev/zram0
$ sudo swapon --priority 32767 /dev/zram0
# Examine device using zramctl command (from package util-linux)
$ sudo zramctl
NAME ALGORITHM DISKSIZE DATA COMPR TOTAL STREAMS MOUNTPOINT
/dev/zram0 zstd 4G 4K 64B 4K 2 [SWAP]
How to stop ZRAM
# Deactivate zram0
$ sudo swapoff /dev/zram0
# Free all memory formerly allocated to device and reset disksize to zero
$ sudo bash -c "echo 1 > /sys/block/zram0/reset"
# Unload kernel module
$ sudo modprobe -r zram
Squashfs does not decompress entirely in RAM:
Mounting a squashfs file system doesn’t involve decompressing it into memory; decompression is done on the fly, as necessary. There is a small internal cache to avoid repeatedly decompressing the same data, but that’s all.
compress /opt/build
/opt/X11
and /opt/openssl
directories and empty them:
for d in build X11 openssl
do
sudo -S mksquashfs /opt/$d /opt/$d.sqsh
sudo -S rm -rf /opt/$d/*
done
Then create a bootscript to mount those directories:
for d in build X11 openssl
do
mount /opt/$d.sqsh /opt/$d -t squashfs -o loop
done
or add to /etc/fstab
:
/opt/build.sqsh /opt/build squashfs ro,defaults 0 0
/opt/openssl.sqsh /opt/openssl squashfs ro,defaults 0 0
/opt/X11.sqsh /opt/X11 squashfs ro,defaults 0 0
Squashing a home directory but without losing the possibility to apply changes or writing new files. This requires kernel to have overlayfs support.
Create the user1-ro.sqfs
squashed file system and the user1-rw.dir
dir:
$ mksquashfs /home/user1 user1-ro.sqfs
$ mkdir /home/user1-rw.dir
Mount the squashed ro.fs file system using the loopback device
$ mount -t squashfs user1-ro.sqfs /mnt/user1-rofs -o loop
mount the overlay file system, that makes /mnt/user1-rofs.dir and /home/user1-rw.sqfs apparently merged under /home/user1 location.
$ cd /home
$ mount -t overlay overlay user1 -o lowerdir=/mnt/user1-rofs,upperdir=/home/user1-rw.dir
When its time to add the new created files to the stable and compressed squashed file system, add them to the existing one.
# First unmount squashfs then append it:
$ mksquashfs /home/user1-rw.dir /home/user-ro.sqfs
To mount at boot, add to /etc/fstab
:
/home/user-1ro.fs /mnt/rofs squashfs loop 0 0
overlay /home/user1 overlay lowerdir=/mnt/user1-rofs,upperdir=/home/user1-rw.dir 0 0