### Install Webmin Web Administration Interface Source: https://context7.com/alf45tar/ix4-300d/llms.txt Install the Webmin web administration tool by setting up its repository and then installing the package. This provides a feature-rich, traditional web interface for system administration. ```bash wget https://raw.githubusercontent.com/webmin/webmin/master/setup-repos.sh chmod 755 setup-repos.sh && ./setup-repos.sh apt-get install webmin --install-recommends ``` -------------------------------- ### Install system utilities Source: https://github.com/alf45tar/ix4-300d/blob/main/README.md Install packages for terminal management and service discovery. ```bash apt install xterm avahi-daemon smartmontools ``` -------------------------------- ### Install evtest package Source: https://github.com/alf45tar/ix4-300d/blob/main/README.md Install the evtest utility to monitor input device events. ```bash apt install evtest ``` -------------------------------- ### Enable and start the service Source: https://github.com/alf45tar/ix4-300d/blob/main/README.md Reload systemd configuration and activate the new service. ```bash systemctl daemon-reload systemctl enable kbdactions.service systemctl start kbdactions.service ``` -------------------------------- ### Install iwd Package Source: https://github.com/alf45tar/ix4-300d/blob/main/README.md Install the iwd package using apt. This is the first step to enable iwd functionality. ```bash apt install iwd ``` -------------------------------- ### Setup Cross-Build Environment Source: https://github.com/alf45tar/ix4-300d/wiki/How-to-cross-build-an-official-Debian-kernel-package-for-Lenovo-ix4‐300d Configures the build environment for the specified architecture, feature set, and flavour. This prepares the system for the architecture-specific build. ```bash fakeroot make -f debian/rules.gen setup_${ARCH}_${FEATURESET}_${FLAVOUR} ``` -------------------------------- ### Mount and Prepare Chroot Environment Source: https://github.com/alf45tar/ix4-300d/blob/main/README.md Mounts the necessary system directories and enters the chroot environment to prepare for package installation. ```bash mount --bind /dev /target/dev mount -t proc none /target/proc mount -t sysfs none /target/sys chroot /target /bin/sh apt-get update apt-get install flash-kernel ``` -------------------------------- ### Install Cockpit Server Management Source: https://github.com/alf45tar/ix4-300d/blob/main/README.md Installs Cockpit, a web-based graphical interface for managing server tasks. ```bash apt install cockpit ``` -------------------------------- ### Install Custom Kernel for LED Control Source: https://context7.com/alf45tar/ix4-300d/llms.txt Installs a custom kernel package required for GPIO-based LED control. This requires downloading a .deb file and installing it using dpkg. ```bash # Install custom kernel with GPIO_74X164 support wget https://github.com/alf45tar/debian-kernel/raw/main/kernel-packages/linux-image-6.1.0-23-armmp-lpae_6.1.99-1_armhf.deb dpkg -i linux-image-6.1.0-23-armmp-lpae_6.1.99-1_armhf.deb ``` -------------------------------- ### Install Fan Control Packages Source: https://github.com/alf45tar/ix4-300d/blob/main/README.md Installs necessary Python packages for the fan control script. Run this command before setting up the service. ```bash apt install python3-periphery python3-pil python3-psutil python3-evdev ``` -------------------------------- ### Install ALSA Utilities Source: https://github.com/alf45tar/ix4-300d/blob/main/README.md Installs the Advanced Linux Sound Architecture (ALSA) utilities required for audio playback. ```bash apt install libasound2 alsa-utils ``` -------------------------------- ### Install and Enable LCD Service Source: https://context7.com/alf45tar/ix4-300d/llms.txt Installs necessary Python libraries and the LCD control script, then configures it as a systemd service for automatic startup. This ensures the LCD displays system information upon boot. ```bash # Install LCD service apt install python3-periphery python3-pil python3-psutil python3-evdev mkdir -p /opt/ix4-300d wget -P /opt/ix4-300d https://raw.githubusercontent.com/alf45tar/ix4-300d/main/lcd.py cat << EOF > /etc/systemd/system/lcd.service [Unit] Description=Manage LCD display After=default.target [Service] ExecStart=python3 /opt/ix4-300d/lcd.py Restart=on-failure RestartSec=5s [Install] WantedBy=default.target EOF systemctl daemon-reload systemctl enable lcd.service systemctl start lcd.service ``` -------------------------------- ### Install Cockpit File Navigator Plugin Source: https://github.com/alf45tar/ix4-300d/blob/main/README.md Downloads and installs the Cockpit plugin for browsing, managing, and transferring files through the web interface. ```bash wget https://github.com/45Drives/cockpit-navigator/releases/download/v0.5.10/cockpit-navigator_0.5.10-1focal_all.deb ``` ```bash apt install ./cockpit-navigator_0.5.10-1focal_all.deb ``` -------------------------------- ### Install and Configure iwd for WiFi Source: https://context7.com/alf45tar/ix4-300d/llms.txt Install the iwd network daemon and enable its built-in DHCP client for simplified WiFi configuration. Restart the service to apply changes. ```bash apt install iwd sed -i 's/#EnableNetworkConfiguration=true/EnableNetworkConfiguration=true/' /etc/iwd/main.conf systemctl restart iwd.service ``` -------------------------------- ### Manage System Services Source: https://github.com/alf45tar/ix4-300d/blob/main/README.md Commands to reload the systemd daemon, enable the fan service to start on boot, and start the fan service immediately. ```bash systemctl daemon-reload systemctl enable fan.service systemctl start fan.service ``` -------------------------------- ### Start macOS TFTP Server Source: https://github.com/alf45tar/ix4-300d/blob/main/README.md Load and start the built-in TFTP server on macOS using launchctl. The default TFTP root directory is /private/tftpboot. ```bash sudo launchctl load -F /System/Library/LaunchDaemons/tftp.plist sudo launchctl start com.apple.tftpd ``` -------------------------------- ### Install fan.py script Source: https://github.com/alf45tar/ix4-300d/blob/main/README.md Download the custom fan control script to the system directory. ```bash mkdir /opt/ix4-300d wget -P /opt/ix4-300d https://raw.githubusercontent.com/alf45tar/ix4-300d/main/fan.py ``` -------------------------------- ### Install Cockpit File Sharing Plugin Source: https://github.com/alf45tar/ix4-300d/blob/main/README.md Downloads and installs the Cockpit plugin for managing Samba and NFS file sharing. ```bash wget https://github.com/45Drives/cockpit-identities/releases/download/v0.1.12/cockpit-identities_0.1.12-1focal_all.deb ``` ```bash wget https://github.com/45Drives/cockpit-file-sharing/releases/download/v3.2.9/cockpit-file-sharing_3.2.9-2focal_all.deb ``` ```bash apt intall ./cockpit-identities_0.1.12-1focal_all.deb ./cockpit-file-sharing_3.2.9-2focal_all.deb ``` -------------------------------- ### U-Boot USB Boot Commands for Debian Installer Source: https://context7.com/alf45tar/ix4-300d/llms.txt Boots the Debian installer from a USB stick. Ensure the USB stick is in the rear upper port and formatted with ext2. ```bash # At Marvell>> prompt, initialize USB subsystem usb start # Output: scanning bus for devices... 2 USB Device(s) found # View USB device information (optional) usb tree usb info usb part # Stop USB before loading files usb stop # Load kernel and initrd from USB partition 1 ext2load usb 0:1 0x0040000 uImage_ix4_300d_bookworm # Output: 5351835 bytes read ext2load usb 0:1 0x2000000 uInitrd_ix4_300d_bookworm # Output: 26337308 bytes read # Set boot arguments and boot setenv bootargs $console $mtdparts root=/dev/sda2 rw rootdelay=10 bootm 0x40000 0x2000000 ``` -------------------------------- ### Install Kernel on ix4-300d Source: https://github.com/alf45tar/ix4-300d/wiki/How-to-cross-build-an-official-Debian-kernel-package-for-Lenovo-ix4‐300d Installs the compiled kernel package on the ix4-300d device using dpkg. This command should be executed on the target device. ```bash dpkg -i linux-image-6.1.99-1_armhf-lpae.deb ``` -------------------------------- ### Example kbdactions script content Source: https://github.com/alf45tar/ix4-300d/blob/main/README.md A sample script that triggers systemd services based on button input events. ```bash #!/bin/bash device='/dev/input/event0' event_select_press='*code 314 (BTN_SELECT), value 1*' event_select_release='*code 314 (BTN_SELECT), value 0*' event_scroll_down_press='*code 178 (KEY_SCROLLDOWN), value 1*' event_scroll_down_release='*code 178 (KEY_SCROLLDOWN), value 0*' event_power='*code 116 (KEY_POWER), value 1*' event_restart='*code 408 (KEY_RESTART), value 1*' evtest "$device" | while read line; do case $line in ($event_select_press) systemctl is-active --quiet webmin.service && systemctl stop webmin.service || systemctl restart webmin.service ;; ($event_select_release) echo "SELECT release" ;; ($event_scroll_down_press) systemctl restart lcd.service ;; ($event_scroll_down_release) echo "SCROLl DOWN release" ;; ($event_power) echo "POWER" ;; ($event_restart) echo "RESTART" ;; esac done ``` -------------------------------- ### Download Debian Installer Files Source: https://github.com/alf45tar/ix4-300d/blob/main/README.md Use wget to download the necessary kernel, initrd, and device tree files from the Debian website for the armhf architecture. ```bash wget https://deb.debian.org/debian/dists/bookworm/main/installer-armhf/current/images/netboot/vmlinuz wget https://deb.debian.org/debian/dists/bookworm/main/installer-armhf/current/images/netboot/initrd.gz wget https://deb.debian.org/debian/dists/bookworm/main/installer-armhf/current/images/device-tree/armada-xp-lenovo-ix4-300d.dtb ``` -------------------------------- ### U-Boot TFTP Boot Commands for Debian Installer Source: https://context7.com/alf45tar/ix4-300d/llms.txt Boots the Debian installer via TFTP. Requires network configuration and the boot image to be present on the TFTP server. ```bash # At Marvell>> prompt, configure network setenv ipaddr 192.168.1.111 # NAS IP address setenv serverip 192.168.1.10 # TFTP server IP # Verify network connectivity ping 192.168.1.10 # Output: host 192.168.1.10 is alive # Transfer and boot Debian installer tftpboot uImage_di_ix4_300d_bookworm # Output: Bytes transferred = 31689151 (1e3a03f hex) bootm 0x2000000 ``` -------------------------------- ### USB WiFi Adapter Connection Log Source: https://github.com/alf45tar/ix4-300d/blob/main/README.md Example log output showing the detection and initialization of a USB WiFi adapter by the system. ```log [ 1267.712422] usb 2-1: new high-speed USB device number 2 using xhci_hcd [ 1267.874230] usb 2-1: New USB device found, idVendor=1737, idProduct=0073, bcdDevice= 2.00 [ 1267.882586] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [ 1267.889796] usb 2-1: Product: RTL8187B_WLAN_Adapter [ 1267.894748] usb 2-1: Manufacturer: Manufacturer_Realtek [ 1267.900041] usb 2-1: SerialNumber: 00e04c000001 [ 1268.671137] ieee80211 phy0: hwaddr 00:22:6b:da:ea:cb, RTL8187BvE V0 + rtl8225z2, rfkill mask 2 [ 1268.719600] rtl8187: Customer ID is 0x00 [ 1268.726537] rtl8187: wireless switch is on [ 1268.732574] usbcore: registered new interface driver rtl8187 [ 1268.950444] rtl8187 2-1:1.0 wlx00226bdaeacb: renamed from wlan0 ``` -------------------------------- ### Configure System LED for Network Activity Source: https://github.com/alf45tar/ix4-300d/blob/main/README.md This example demonstrates how to set the system's blue LED to indicate network activity on the 'bond0' interface. It requires loading the `ledtrig-netdev` module and configuring parameters for transmit (tx) and receive (rx) activity. ```bash modprobe ledtrig-netdev; echo netdev > /sys/class/leds/ix4-300d:sys:blue/trigger; echo bond0 > /sys/class/leds/ix4-300d:sys:blue/device_name; echo 1 > /sys/class/leds/ix4-300d:sys:blue/link; echo 1 > /sys/class/leds/ix4-300d:sys:blue/tx; echo 1 > /sys/class/leds/ix4-300d:sys:blue/rx; ``` -------------------------------- ### Install Custom Kernel Package Source: https://github.com/alf45tar/ix4-300d/wiki/How-to-build-a-customised-kernel Installs the newly built custom kernel package using `dpkg`. This command also configures the bootloader to use the new kernel. ```bash dpkg -i ../linux-image-6.1.90-1_armhf-lpae.deb ``` -------------------------------- ### Configure HDD LED for Disk Activity Source: https://github.com/alf45tar/ix4-300d/blob/main/README.md This example sets the HDD blue LED to show disk activity. It uses the 'disk-activity' trigger and sets the brightness to '1' to enable the LED. ```bash echo disk-activity > /sys/class/leds/ix4-300d:hdd:blue/trigger; echo 1 > /sys/class/leds/ix4-300d:hdd:blue/brightness; ``` -------------------------------- ### Bond Network Ports Source: https://github.com/alf45tar/ix4-300d/blob/main/README.md Setup instructions for bonding eth0 and eth1 using ifenslave for redundancy and increased throughput. ```bash apt install ifenslave ``` ```text # This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). source /etc/network/interfaces.d/* # The loopback network interface auto lo iface lo inet loopback # Bond setup auto bond0 iface bond0 inet static address 192.168.1.14 netmask 255.255.255.0 network 192.168.1.0 gateway 192.168.1.1 bond-slaves eth0 eth1 bond-mode balance-rr bond-miimon 100 bond-downdelay 200 bond-updelay 200 ``` ```bash systemctl restart networking.service ``` -------------------------------- ### Configure Power LED for Heartbeat Source: https://github.com/alf45tar/ix4-300d/blob/main/README.md This example configures the power white LED to display a heartbeat pattern, which is a hyperbolic function of the 1-minute CPU load average. It also inverts the LED's behavior. ```bash echo heartbeat > /sys/class/leds/ix4-300d:power:white/trigger; echo 1 > /sys/class/leds/ix4-300d:power:white/invert; ``` -------------------------------- ### Manage LCD System Service Source: https://github.com/alf45tar/ix4-300d/blob/main/README.md Commands to reload the systemd daemon, enable the LCD service to start on boot, and start the LCD service immediately. ```bash systemctl daemon-reload systemctl enable lcd.service systemctl start lcd.service ``` -------------------------------- ### Install Cockpit Web Administration Interface Source: https://context7.com/alf45tar/ix4-300d/llms.txt Install the Cockpit web administration tool and its plugins for file sharing and navigation. This provides a modern, browser-based interface for system management. ```bash apt install cockpit nano /etc/cockpit/disallowed-users # Remove 'root' line wget https://github.com/45Drives/cockpit-file-sharing/releases/download/v3.2.9/cockpit-file-sharing_3.2.9-2focal_all.deb wget https://github.com/45Drives/cockpit-navigator/releases/download/v0.5.10/cockpit-navigator_0.5.10-1focal_all.deb apt install ./cockpit-file-sharing_3.2.9-2focal_all.deb ./cockpit-navigator_0.5.10-1focal_all.deb ``` -------------------------------- ### Install shairport-sync for AirPlay Speaker Source: https://context7.com/alf45tar/ix4-300d/llms.txt Install necessary packages for shairport-sync to enable AirPlay audio streaming. This transforms the NAS into an AirPlay-compatible audio receiver. ```bash apt install libasound2 alsa-utils shairport-sync ``` -------------------------------- ### Install Custom Kernel for LED Support Source: https://github.com/alf45tar/ix4-300d/blob/main/README.md Download and install a custom Debian kernel that includes the necessary CONFIG_GPIO_74X164 module for LED control. This is a prerequisite for accessing LEDs via /sys/class/leds. ```bash wget https://github.com/alf45tar/debian-kernel/raw/main/kernel-packages/linux-image-6.1.0-23-armmp-lpae_6.1.99-1_armhf.deb dpkg -i linux-image-6.1.0-23-armmp-lpae_6.1.99-1_armhf.deb ``` -------------------------------- ### Bridge Network Ports Source: https://github.com/alf45tar/ix4-300d/blob/main/README.md Setup instructions for bridging eth0 and eth1 using bridge-utils. ```bash apt install bridge-utils ``` ```text # This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). source /etc/network/interfaces.d/* # The loopback network interface auto lo iface lo inet loopback # Set up interfaces manually, avoiding conflicts with, e.g., network manager iface eth0 inet manual iface eth1 inet manual # Bridge setup auto br0 iface br0 inet static bridge_ports eth0 eth1 address 192.168.1.14 broadcast 192.168.1.255 netmask 255.255.255.0 gateway 192.168.1.1 ``` ```bash systemctl restart networking.service ``` -------------------------------- ### Configure fan control and sensors Source: https://github.com/alf45tar/ix4-300d/blob/main/README.md Install monitoring tools and configure kernel modules for hardware sensors. ```bash apt install lm-sensors fancontrol ``` ```bash cat << EOF > /etc/modules # # This file contains the names of kernel modules that should be loaded # at boot time, one per line. Lines beginning with "#" are ignored. # Parameters can be specified after the module name. # Adapter drivers i2c_mv64xxx # Chip drivers adt7475 # Hard disk temperature drivetemp EOF ``` ```bash reboot ``` ```bash root@lenovo:~# sensors-detect # sensors-detect version 3.6.0 # Kernel: 6.1.0-11-armmp-lpae armv7l ``` -------------------------------- ### Configure fancontrol settings Source: https://github.com/alf45tar/ix4-300d/blob/main/README.md Example configuration for /etc/fancontrol to manage fan speeds based on hard disk temperature. ```ini # Configuration file generated by pwmconfig, changes will be lost INTERVAL=10 DEVPATH=hwmon1=devices/platform/soc/soc:internal-regs/d0011000.i2c/i2c-0/0-002e hwmon3=devices/platform/soc/soc:pcie@82000000/pci0000:00/0000:00:01.0/0000:01:00.0/ata2/host1/target1:0:0/1:0:0:0 DEVNAME=hwmon1=adt7473 hwmon3=drivetemp FCTEMPS= hwmon1/pwm1=hwmon3/temp1_input FCFANS= hwmon1/pwm1=hwmon1/fan1_input MINTEMP= hwmon1/pwm1=20 MAXTEMP= hwmon1/pwm1=60 MINSTART= hwmon1/pwm1=150 MINSTOP= hwmon1/pwm1=0 ``` -------------------------------- ### Install and Enable Fan Control Service Source: https://context7.com/alf45tar/ix4-300d/llms.txt Installs the fan control script and configures it as a systemd service to run automatically on boot. This ensures continuous fan speed management. ```bash # Install fan control service mkdir -p /opt/ix4-300d wget -P /opt/ix4-300d https://raw.githubusercontent.com/alf45tar/ix4-300d/main/fan.py cat << EOF > /etc/systemd/system/fan.service [Unit] Description=Fan Control After=default.target StartLimitIntervalSec=10min StartLimitBurst=5 [Service] ExecStart=python3 /opt/ix4-300d/fan.py Restart=on-failure RestartSec=30 [Install] WantedBy=default.target EOF systemctl daemon-reload systemctl enable fan.service systemctl start fan.service ``` -------------------------------- ### Prepare Kernel Image for U-Boot Source: https://github.com/alf45tar/ix4-300d/wiki/How-to-cross-build-an-official-Debian-kernel-package-for-Lenovo-ix4‐300d Creates the `uImage` and `uInitrd` files required by the U-Boot bootloader from the installed kernel and initrd.img. These commands are executed on the target device. ```bash cd /boot cat vmlinuz dtb > vmlinuz_ix4_300d mkimage -A arm -O linux -T kernel -C none -a 0x04000000 -e 0x04000000 -n "Linux Customized" -d vmlinuz_ix4_300d uImage mkimage -A arm -O linux -T ramdisk -C none -a 0x2000000 -e 0x2000000 -n "Linux Customized" -d initrd.img uInitrd rm vmlinuz_ix4_300d ``` -------------------------------- ### Prepare Kernel Source Tree Source: https://github.com/alf45tar/ix4-300d/wiki/How-to-build-a-customised-kernel Installs the kernel source package and extracts it to the current directory. Ensure sufficient disk space (at least 20 GB). ```bash apt install linux-source tar -xf /usr/src/linux-source-6.1.tar.xz cd linux-source-6.1 ``` -------------------------------- ### Reboot to Load New Kernel Source: https://github.com/alf45tar/ix4-300d/wiki/How-to-cross-build-an-official-Debian-kernel-package-for-Lenovo-ix4‐300d Reboots the ix4-300d device to apply the newly installed kernel. After rebooting, LEDs should be accessible under `/sys/class/leds`. ```bash reboot ``` -------------------------------- ### Network Bonding Configuration Source: https://context7.com/alf45tar/ix4-300d/llms.txt Configures network bonding for increased throughput and redundancy by installing ifenslave and setting up the bond0 interface in /etc/network/interfaces. ```bash # Install bonding support apt install ifenslave ``` ```bash # Configure network bonding cat << EOF > /etc/network/interfaces source /etc/network/interfaces.d/* auto lo iface lo inet loopback auto bond0 iface bond0 inet static address 192.168.1.14 netmask 255.255.255.0 network 192.168.1.0 gateway 192.168.1.1 bond-slaves eth0 eth1 bond-mode balance-rr bond-miimon 100 bond-downdelay 200 bond-updelay 200 EOF ``` ```bash systemctl restart networking.service ``` ```bash # Verify bonding status cat /proc/net/bonding/bond0 ``` -------------------------------- ### Configure Kernel Modules for Hardware Monitoring Source: https://context7.com/alf45tar/ix4-300d/llms.txt Load necessary kernel modules for I2C, ADT7475 temperature/fan controller, and hard disk temperature monitoring at boot. Install required packages and restart the lm-sensors service. ```bash # Configure kernel modules to load at boot cat << EOF > /etc/modules # Adapter drivers i2c_mv64xxx # Chip drivers adt7475 # Hard disk temperature drivetemp EOF # Install required packages apt install lm-sensors fancontrol # Detect sensors (interactive) sensors-detect # Restart service systemctl restart lm-sensors.service # View current sensor readings sensors # Output: adt7473-i2c-0-2e # temp1: +39.0°C # fan1: 1800 RPM ``` -------------------------------- ### LED Control via sysfs Interface Source: https://context7.com/alf45tar/ix4-300d/llms.txt Manages front panel LEDs by interacting with the sysfs interface after a custom kernel with GPIO support is installed. LEDs are accessible under /sys/class/leds/. ```bash # After reboot, LEDs available at /sys/class/leds/ ls /sys/class/leds/ ``` ```bash # Output: ix4-300d:hdd:blue ix4-300d:hddfail:red ix4-300d:power:white # ix4-300d:sys:blue ix4-300d:sysfail:red ``` ```bash # Show network activity on System LED (blue) modprobe ledtrig-netdev echo netdev > /sys/class/leds/ix4-300d:sys:blue/trigger echo bond0 > /sys/class/leds/ix4-300d:sys:blue/device_name echo 1 > /sys/class/leds/ix4-300d:sys:blue/link echo 1 > /sys/class/leds/ix4-300d:sys:blue/tx echo 1 > /sys/class/leds/ix4-300d:sys:blue/rx ``` ```bash # Show disk activity on HDD LED (blue) echo disk-activity > /sys/class/leds/ix4-300d:hdd:blue/trigger echo 1 > /sys/class/leds/ix4-300d:hdd:blue/brightness ``` ```bash # Show CPU heartbeat on Power LED (white) echo heartbeat > /sys/class/leds/ix4-300d:power:white/trigger echo 1 > /sys/class/leds/ix4-300d:power:white/invert ``` ```bash # Disable trigger and manually control LED echo none > /sys/class/leds/ix4-300d:sys:blue/trigger echo 0 > /sys/class/leds/ix4-300d:sys:blue/brightness # LED on echo 1 > /sys/class/leds/ix4-300d:sys:blue/brightness # LED off ``` -------------------------------- ### Connect to WiFi using iwctl Source: https://context7.com/alf45tar/ix4-300d/llms.txt Use the iwctl utility to scan for networks, view available networks, and connect to a WiFi network by providing its name and passphrase. This interactive mode guides through the connection process. ```bash iwctl # [iwd]# device list # [iwd]# station wlx00226bdaeacb scan # [iwd]# station wlx00226bdaeacb get-networks # [iwd]# station wlx00226bdaeacb connect MyWireless # Type the network passphrase for MyWireless psk. # Passphrase: *********** # [iwd]# station wlx00226bdaeacb show # [iwd]# quit ``` -------------------------------- ### Testing Button Events Interactively Source: https://context7.com/alf45tar/ix4-300d/llms.txt Installs and uses evtest to capture and display hardware button events from a specified input device. ```bash # Test button events interactively apt install evtest evtest /dev/input/event0 ``` ```bash # Output: Event: time 1693054739.406736, type 1 (EV_KEY), code 314 (BTN_SELECT), value 1 ``` -------------------------------- ### GPIO Interaction with gpiod Tools Source: https://context7.com/alf45tar/ix4-300d/llms.txt Utilizes the libgpiod interface for direct GPIO control. This involves installing gpiod, detecting GPIO chips, and then setting line states. ```bash # Install GPIO tools apt install gpiod ``` ```bash # Detect GPIO chips gpiodetect ``` ```bash # Output: gpiochip0 [d0018100.gpio] (32 lines) # gpiochip1 [d0018140.gpio] (17 lines) # gpiochip2 [74hc595] (8 lines) ``` ```bash # Show GPIO line information gpioinfo gpiochip0 ``` ```bash # Unload LED driver to access GPIO directly rmmod leds_gpio ``` ```bash # Control HDD LED via GPIO (pin 26) gpioset gpiochip0 26=1 # LED on gpioset gpiochip0 26=0 # LED off ``` -------------------------------- ### Configure Network and Boot via TFTP Source: https://github.com/alf45tar/ix4-300d/blob/main/README.md Commands to set network parameters and initiate a network boot from the U-Boot prompt. ```bash setenv ipaddr 192.168.1.111 ``` ```bash setenv serverip 192.168.1.10 ``` ```bash ping 192.168.1.10 ``` ```bash tftpboot uImage_di_ix4_300d_bookworm ``` ```bash bootm 0x2000000 ``` -------------------------------- ### Prepare Files for U-Boot Bootloader Source: https://github.com/alf45tar/ix4-300d/wiki/How-to-build-a-customised-kernel Combines the kernel image and device tree blob, then creates a U-Boot compatible kernel image (`uImage`) and initrd image (`uInitrd`). ```bash cd /boot cat vmlinuz dtb > vmlinuz_ix4_300d mkimage -A arm -O linux -T kernel -C none -a 0x04000000 -e 0x04000000 -n "Linux Customized" -d vmlinuz_ix4_300d uImage mkimage -A arm -O linux -T ramdisk -C none -a 0x2000000 -e 0x2000000 -n "Linux Customized" -d initrd.img uInitrd ``` -------------------------------- ### Boot Command for Backup Partition (sdb1) Source: https://github.com/alf45tar/ix4-300d/blob/main/README.md Configures the boot command to load the kernel and initrd from the 'sdb1' partition, specifying it as a backup boot location. Requires 'ide 3:1' to be correctly set. ```bash ide reset; ext2load ide 3:1 0x0040000 uImage; ext2load ide 3:1 0x2000000 uInitrd; setenv bootargs $console $mtdparts root=LABEL=rootfs rw rootdelay=5; bootm 0x40000 0x2000000 ``` -------------------------------- ### Boot Command for Backup Partition (sdc1) Source: https://github.com/alf45tar/ix4-300d/blob/main/README.md Configures the boot command to load the kernel and initrd from the 'sdc1' partition, specifying it as a backup boot location. Requires 'ide 4:1' to be correctly set. ```bash ide reset; ext2load ide 4:1 0x0040000 uImage; ext2load ide 4:1 0x2000000 uInitrd; setenv bootargs $console $mtdparts root=LABEL=rootfs rw rootdelay=5; bootm 0x40000 0x2000000 ``` -------------------------------- ### Disk Partitioning and Formatting Source: https://github.com/alf45tar/ix4-300d/blob/main/README.md Copies partition table from a source disk to a target disk, formats the first partition as ext2, and sets up the second partition as swap. ```bash # Copy the partition table from ${SOURCE} disk to ${DISK} echo "Partitioning $DISK..." sfdisk -dump ${SOURCE} | sfdisk ${DISK} echo "Partitioning completed!" # Format the first partition as ext2 mkfs.ext2 -F ${DISK}1 echo "Formatted ${DISK}1 as ext2." # Set up the second partition as swap mkswap ${DISK}2 echo "Set up ${DISK}2 as swap." # Set the third partition for RAID (no formatting needed as it will be part of a RAID array) echo "${DISK}3 is set for RAID." # Set the forth partition for RAID (no formatting needed as it will be part of a RAID array) echo "${DISK}4 is set for RAID." ``` -------------------------------- ### Install Shairport Sync for AirPlay Source: https://github.com/alf45tar/ix4-300d/blob/main/README.md Installs Shairport Sync, an AirPlay receiver that enables audio streaming from iOS devices and other AirPlay sources. ```bash apt install shairport-sync ``` -------------------------------- ### Create systemd service file Source: https://github.com/alf45tar/ix4-300d/blob/main/README.md Define a systemd service to run the keyboard action script at startup. ```bash cat << EOF > /etc/systemd/system/kbdactions.service [Unit] Description=Manage keyboard display After=default.target [Service] ExecStart=/opt/ix4-300d/kbdactions.sh [Install] WantedBy=default.target EOF ``` -------------------------------- ### Boot Command for Backup Partition (sdd1) Source: https://github.com/alf45tar/ix4-300d/blob/main/README.md Configures the boot command to load the kernel and initrd from the 'sdd1' partition, specifying it as a backup boot location. Requires 'ide 5:1' to be correctly set. ```bash ide reset; ext2load ide 5:1 0x0040000 uImage; ext2load ide 5:1 0x2000000 uInitrd; setenv bootargs $console $mtdparts root=LABEL=rootfs rw rootdelay=5; bootm 0x40000 0x2000000 ``` -------------------------------- ### Prepare Debian 12 Boot Images with mkimage Source: https://context7.com/alf45tar/ix4-300d/llms.txt Creates U-Boot compatible images for TFTP and USB booting. Requires downloading kernel, initrd, and device tree files first. ```bash # Download required files from Debian repository wget https://deb.debian.org/debian/dists/bookworm/main/installer-armhf/current/images/netboot/vmlinuz wget https://deb.debian.org/debian/dists/bookworm/main/installer-armhf/current/images/netboot/initrd.gz wget https://deb.debian.org/debian/dists/bookworm/main/installer-armhf/current/images/device-tree/armada-xp-lenovo-ix4-300d.dtb # Append device tree blob to kernel cat vmlinuz armada-xp-lenovo-ix4-300d.dtb > vmlinuz_ix4_300d # Create combined uImage for TFTP boot (kernel + initrd in one file) mkimage -A arm -O linux -T multi -C none -a 0x04000000 -e 0x04000000 \ -n "Debian armhf installer" -d vmlinuz_ix4_300d:initrd.gz uImage_di_ix4_300d_bookworm # Create separate kernel and initrd images for USB boot mkimage -A arm -O linux -T kernel -C none -a 0x04000000 -e 0x04000000 \ -n "Debian armhf installer" -d vmlinuz_ix4_300d uImage_ix4_300d_bookworm mkimage -A arm -O linux -T ramdisk -C none -a 0x2000000 -e 0x2000000 \ -n "Debian armhf installer" -d initrd.gz uInitrd_ix4_300d_bookworm ``` -------------------------------- ### Create TFTP Bootable uImage Source: https://github.com/alf45tar/ix4-300d/blob/main/README.md Use the mkimage tool to create a universal image (uImage) suitable for TFTP booting, combining the kernel and initrd with a specific header format for ARM Linux. ```bash mkimage -A arm -O linux -T multi -C none -a 0x04000000 -e 0x04000000 -n "Debian armhf installer" -d vmlinuz_ix4_300d:initrd.gz uImage_di_ix4_300d_bookworm ``` -------------------------------- ### Boot from internal disk using U-Boot Source: https://github.com/alf45tar/ix4-300d/blob/main/README.md Commands to load kernel and initrd from the internal IDE drive and boot the system. ```bash ide reset ext2load ide 2:1 0x0040000 uImage ext2load ide 2:1 0x2000000 uInitrd setenv bootargs $console $mtdparts root=/dev/sda2 rw rootdelay=10 bootm 0x40000 0x2000000 ``` ```bash ide reset ext2load ide 2:1 0x0040000 uImage ext2load ide 2:1 0x2000000 uInitrd setenv bootargs $console $mtdparts root=LABEL=rootfs rw rootdelay=5 bootm 0x40000 0x2000000 ``` ```bash ide reset; ext2load ide 2:1 0x0040000 uImage; ext2load ide 2:1 0x2000000 uInitrd; setenv bootargs $console $mtdparts root=LABEL=rootfs rw rootdelay=5; bootm 0x40000 0x2000000 ``` -------------------------------- ### Install Cross-Build Dependencies on Debian Bookworm Source: https://github.com/alf45tar/ix4-300d/wiki/How-to-cross-build-an-official-Debian-kernel-package-for-Lenovo-ix4‐300d Installs necessary packages for cross-compiling the Linux kernel on a Debian Bookworm system. Ensure you have sufficient disk space. ```bash sudo apt install fakeroot git kernel-wedge quilt ccache flex bison libssl-dev dh-exec rsync libelf-dev bc crossbuild-essential-armhf python3-jinja2 libncurses-dev ``` -------------------------------- ### Configure Network Interfaces for Poweroff Source: https://github.com/alf45tar/ix4-300d/blob/main/README.md Configuration for /etc/network/interfaces to ensure both eth0 and eth1 are initialized at boot. ```text # This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). source /etc/network/interfaces.d/* # The loopback network interface auto lo iface lo inet loopback # The primary network interface auto eth0 iface eth0 inet static address 192.168.1.14 netmask 255.255.255.0 gateway 192.168.1.1 auto eth1 iface eth1 inet static address 169.254.1.1 netmask 255.255.0.0 gateway 169.254.1.254 ``` -------------------------------- ### Create fan service file Source: https://github.com/alf45tar/ix4-300d/blob/main/README.md Initialize the systemd service file for the fan control script. ```bash cat << EOF > /etc/systemd/system/fan.service [Unit] ``` -------------------------------- ### Execute U-Boot USB boot commands Source: https://github.com/alf45tar/ix4-300d/blob/main/README.md Use these commands at the Marvell U-Boot prompt to load and boot the kernel and initrd from a USB stick. Ensure the USB is inserted into the rear upper port. ```bash usb start usb tree usb info usb part usb stop ext2load usb 0:1 0x0040000 uImage_ix4_300d_bookworm ext2load usb 0:1 0x2000000 uInitrd_ix4_300d_bookworm setenv bootargs $console $mtdparts root=/dev/sda2 rw rootdelay=10 bootm 0x40000 0x2000000 ``` -------------------------------- ### View U-Boot USB boot log Source: https://github.com/alf45tar/ix4-300d/blob/main/README.md Reference log output showing the successful execution of USB initialization and kernel boot commands. ```text Marvell>> usb start (Re)start USB... USB: Active port: 0 Register 10011 NbrPorts 1 USB EHCI 1.00 scanning bus for devices... 2 USB Device(s) found Waiting for storage device(s) to settle before scanning... scanning bus for storage devices... 1 Storage Device(s) found Marvell>> usb tree Device Tree: 1 Hub (480 Mb/s, 0mA) | u-boot EHCI Host Controller | +-2 Mass Storage (480 Mb/s, 200mA) 13111409002422 Marvell>> usb info 1: Hub, USB Revision 2.0 - u-boot EHCI Host Controller - Class: Hub - PacketSize: 64 Configurations: 1 - Vendor: 0x0000 Product 0x0000 Version 1.0 Configuration: 1 - Interfaces: 1 Self Powered 0mA Interface: 0 - Alternate Setting 0, Endpoints: 1 - Class Hub - Endpoint 1 In Interrupt MaxPacket 8 Interval 255ms 2: Mass Storage, USB Revision 2.0 - 13111409002422 - Class: (from Interface) Mass Storage - PacketSize: 64 Configurations: 1 - Vendor: 0x0718 Product 0x07f0 Version 1.18 Configuration: 1 - Interfaces: 1 Bus Powered 200mA Interface: 0 - Alternate Setting 0, Endpoints: 2 - Class Mass Storage, Transp. SCSI, Bulk only - Endpoint 1 Out Bulk MaxPacket 512 - Endpoint 2 In Bulk MaxPacket 512 Marvell>> usb part Partition Map for USB device 0 -- Partition Type: DOS Partition Start Sector Num Sectors Type 1 2048 2097152 83 Marvell>> usb stop stopping USB.. Marvell>> ext2load usb 0:1 0x0040000 uImage_ix4_300d_bookworm Loading file "uImage_ix4_300d_bookworm" from usb device 0:1 (usbda1) 5351835 bytes read Marvell>> ext2load usb 0:1 0x2000000 uInitrd_ix4_300d_bookworm Loading file "uInitrd_ix4_300d_bookworm" from usb device 0:1 (usbda1) 26337308 bytes read Marvell>> setenv bootargs $console $mtdparts root=/dev/sda2 rw rootdelay=10 Marvell>> bootm 0x40000 0x2000000 ## Booting kernel from Legacy Image at 00040000 ... Image Name: Debian armhf installer Created: 2023-08-24 21:17:04 UTC Image Type: ARM Linux Kernel Image (uncompressed) Data Size: 5351771 Bytes = 5.1 MB Load Address: 04000000 Entry Point: 04000000 Verifying Checksum ... OK ## Loading init Ramdisk from Legacy Image at 02000000 ... Image Name: Debian armhf installer Created: 2023-08-24 21:14:13 UTC Image Type: ARM Linux RAMDisk Image (uncompressed) Data Size: 26337244 Bytes = 25.1 MB Load Address: 02000000 Entry Point: 02000000 Verifying Checksum ... OK Loading Kernel Image ... OK OK Starting kernel ... ``` -------------------------------- ### Download kbdactions script Source: https://github.com/alf45tar/ix4-300d/blob/main/README.md Create the directory and download the script responsible for handling button actions. ```bash mkdir /opt/ix4-300d wget -P /opt/ix4-300d https://raw.githubusercontent.com/alf45tar/ix4-300d/main/kbdactions.sh chmod 755 /opt/ix4-300d/kbdactions.sh ``` -------------------------------- ### Create Separate USB Boot Images Source: https://github.com/alf45tar/ix4-300d/blob/main/README.md Generate individual uImage for the kernel and uInitrd for the ramdisk using mkimage, intended for booting from a USB stick on the ix4-300d. ```bash mkimage -A arm -O linux -T kernel -C none -a 0x04000000 -e 0x04000000 -n "Debian armhf installer" -d vmlinuz_ix4_300d uImage_ix4_300d_bookworm mkimage -A arm -O linux -T ramdisk -C none -a 0x2000000 -e 0x2000000 -n "Debian armhf installer" -d initrd.gz uInitrd_ix4_300d_bookworm ``` -------------------------------- ### Configure flash-kernel for ix4-300d Source: https://context7.com/alf45tar/ix4-300d/llms.txt Sets up flash-kernel to generate U-Boot compatible images for the ix4-300d. Requires updating initramfs after configuration. ```bash # Create flash-kernel database entry cat << EOF > /etc/flash-kernel/db Machine: Lenovo Iomega ix4-300d Kernel-Flavors: armmp armmp-lpae DTB-Id: armada-xp-lenovo-ix4-300d.dtb DTB-Append: yes U-Boot-Kernel-Address: 0x00008000 U-Boot-Initrd-Address: 0x0 Boot-Kernel-Path: /boot/uImage Boot-Initrd-Path: /boot/uInitrd Boot-DTB-Path: /boot/dtb Required-Packages: u-boot-tools Bootloader-Sets-Incorrect-Root: no EOF # Update initramfs to apply configuration update-initramfs -u # Output: flash-kernel: installing version 6.1.0-12-armmp-lpae # Output: Generating kernel u-boot image... done. # Output: Installing new uImage. ``` -------------------------------- ### Get Detailed RAID Array Information Source: https://context7.com/alf45tar/ix4-300d/llms.txt Obtain comprehensive details about a specific RAID array, including its configuration, member disks, and state. Use the appropriate device name (e.g., /dev/md0). ```bash mdadm --detail /dev/md0 mdadm --detail /dev/md1 ``` -------------------------------- ### Add required modules to /etc/modules Source: https://github.com/alf45tar/ix4-300d/blob/main/README.md Append these lines to /etc/modules to ensure necessary I2C and chip drivers are loaded at boot. ```text #----cut here---- # Adapter drivers i2c_mv64xxx # Chip drivers adt7475 #----cut here---- ``` -------------------------------- ### Configure permanent boot environment Source: https://github.com/alf45tar/ix4-300d/blob/main/README.md Persist boot settings in U-Boot environment variables. ```bash setenv bootdebian 'ide reset; ext2load ide 2:1 0x0040000 uImage; ext2load ide 2:1 0x2000000 uInitrd; setenv bootargs $console $mtdparts root=LABEL=rootfs rw rootdelay=5; bootm 0x40000 0x2000000;' setenv bootcmd 'run bootdebian; reset;' saveenv reset ```