### Install Kernel to NAND Flash via TFTP Source: https://context7.com/benoitm974/ix4-300d/llms.txt Installs a custom kernel (uImage) to the onboard NAND flash using TFTP and serial console commands in U-Boot. This is for permanent installation. ```bash # At U-Boot prompt, load kernel via TFTP tftp uImage # Erase kernel partition (0x120000 offset, 4MB size) nand erase 0x120000 0x400000 # Write new kernel to NAND nand write.e $loadaddr 0x120000 0x400000 # NAND partition layout: # 0x000000-0x0E0000: u-boot (read-only) # 0x0E0000-0x100000: u-boot-env (read-only) # 0x100000-0x120000: u-boot-env2 (read-only) # 0x120000-0x520000: zImage (kernel) # 0x520000-0x920000: initrd # 0xE00000-0x40000000: boot (rootfs) ``` -------------------------------- ### Controlling System LEDs Source: https://github.com/benoitm974/ix4-300d/wiki/Home This example demonstrates how to control system LEDs using the standard Linux GPIO-LED interface. The 'sysfail' LED is controlled by echoing a brightness value to its corresponding file in the /sys/class/leds directory. Note that the HDD LED requires a specific mv_sata patch. ```bash echo 1 > /sys/class/leds/ix4-300d\:sysfail\:red/brightness ``` -------------------------------- ### Set Fan PWM Temperature Thresholds Source: https://github.com/benoitm974/ix4-300d/wiki/Home Defines the temperature points at which the PWM fan speed will start and reach its maximum. These values are in millidegrees Celsius. ```bash echo 57000 > /sys/class/i2c-adapter/i2c-0/0-002e/temp1_auto_point1_temp ``` ```bash echo 90000 > /sys/class/i2c-adapter/i2c-0/0-002e/temp1_auto_point2_temp ``` -------------------------------- ### Configure USB Boot for ix4-300d Source: https://context7.com/benoitm974/ix4-300d/llms.txt Sets up booting from a USB drive for testing custom kernels. Requires a partitioned USB drive and serial console access to interrupt U-Boot. ```bash # Prepare USB drive: # Partition 1: VFAT (10-20MB) for kernel # Partition 2: ext2/3/4 for root filesystem # Connect UART to CN9 connector (115200/8N1) # Pin 1 (marked): Vcc # Pin 2: RX (connect to adapter TX) # Pin 3: GND # Pin 4: TX (connect to adapter RX) # At U-Boot prompt (press key during boot to interrupt): usb reset;fatload usb 0:1 $loadaddr uImage;setenv bootargs $console $mtdparts root=/dev/sda2 rw rootdelay=10; bootm $loadaddr; # Note: USB boot only works from rear upper USB port ``` -------------------------------- ### Booting from USB Command Source: https://github.com/benoitm974/ix4-300d/wiki/Home This command sequence is used to boot the Lenovo IX4-300d from a USB drive. It requires a specific USB port (rear upper) and a properly formatted USB drive with a VFAT partition for the kernel and an ext partition for the bootstrap Linux system. Ensure UART is connected and stop the auto-boot sequence to enter the prompt. ```bash usb reset;fatload usb 0:1 $loadaddr uImage;setenv bootargs $console $mtdparts root=/dev/sda2 rw rootdelay=10; bootm $loadaddr; ``` -------------------------------- ### Build and Load LCD Driver Module Source: https://context7.com/benoitm974/ix4-300d/llms.txt Builds the wixlcm kernel module for the LCD display and loads it into the system. Ensure KERNEL_SOURCE is set to your Linux kernel source directory. ```bash # Build the LCD driver module cd wixlcm export KERNEL_SOURCE=/path/to/linux-source make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -C $KERNEL_SOURCE M=$(pwd) modules ``` ```bash # Load the module insmod wixlcm.ko ``` ```bash # Check device was created ls -la /dev/lcm ``` ```bash # View usage instructions cat /dev/lcm ``` -------------------------------- ### Configure Network Interfaces for Power-Off Source: https://context7.com/benoitm974/ix4-300d/llms.txt Ensures proper system shutdown by initializing Ethernet PHYs. This is typically achieved by configuring network interfaces at boot or bringing them up temporarily before shutdown. ```bash # Ensure both network interfaces are configured at boot # This initializes the Ethernet PHYs required for proper shutdown # /etc/network/interfaces example: # auto eth0 # iface eth0 inet static # address 192.168.1.100 # netmask 255.255.255.0 # # auto eth1 # iface eth1 inet static # address 169.254.1.1 # netmask 255.255.0.0 # Or simply bring up interfaces temporarily ip link set eth0 up ip link set eth1 up # Now shutdown will work correctly shutdown -h now ``` -------------------------------- ### Compile ix4-300d Kernel and Device Tree Source: https://context7.com/benoitm974/ix4-300d/llms.txt Builds a custom kernel (zImage) and device tree blobs (dtbs) for the ix4-300d. Requires mainline kernel 3.17+, a defconfig file, and cross-compilation tools. ```bash # Download mainline kernel 3.17 or later git clone https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git cd linux # Apply the ix4-300d defconfig cp /path/to/ix4-300d_defconfig .config # For Debian Jessie, enable additional options # CONFIG_DEVTMPFS=y # CONFIG_CGROUPS=y # Cross-compile the kernel and device tree make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j$(nproc) zImage make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j$(nproc) dtbs # Combine zImage with device tree and create uImage cat arch/arm/boot/zImage arch/arm/boot/dts/armada-xp-lenovo-ix4-300d.dtb > zud mkimage -A arm -O linux -T kernel -C none -a 0x00008000 -e 0x00008000 -n lenovo-ix4-300d -d zud uImage ``` -------------------------------- ### Control LEDs via sysfs Source: https://context7.com/benoitm974/ix4-300d/llms.txt Manages front panel LEDs using the standard Linux LED interface through sysfs. LEDs are exposed as gpio-leds in the device tree. ```bash # Available LEDs: # ix4-300d:hdd:blue - HDD activity (direct GPIO) # ix4-300d:power:white - Power LED (SPI shift register) # ix4-300d:sysfail:red - System failure indicator # ix4-300d:sys:blue - System status # ix4-300d:hddfail:red - HDD failure indicator # Turn on system failure LED echo 1 > /sys/class/leds/ix4-300d:sysfail:red/brightness # Turn off system failure LED echo 0 > /sys/class/leds/ix4-300d:sysfail:red/brightness # Set LED trigger to heartbeat echo heartbeat > /sys/class/leds/ix4-300d:sys:blue/trigger # List available triggers cat /sys/class/leds/ix4-300d:sys:blue/trigger # [none] rc-feedback kbd-scrolllock kbd-numlock kbd-capslock kbd-kanalock # kbd-shiftlock kbd-altgrlock kbd-ctrllock kbd-altlock kbd-shiftllock # kbd-shiftrlock kbd-ctrlllock kbd-ctrlrlock timer oneshot heartbeat # default-on transient ide-disk ``` -------------------------------- ### Flashing Custom Kernel via Serial Line Source: https://github.com/benoitm974/ix4-300d/wiki/Home These commands are used to flash a custom kernel image (uImage) to the NAND memory of the IX4-300d NAS via a serial connection. It involves loading the kernel via TFTP, erasing the target NAND region, and then writing the loaded kernel to that region. Ensure the TFTP transfer is successful before proceeding with erase and write operations. ```bash tftp uImage -> this should load your kernel from you TFTP server, only proceed if this step is OK ``` ```bash nand erase 0x120000 0x400000 -> this erase the nand from now you no more have kernel on nand ``` ```bash nand write.e $loadaddr 0x120000 0x400000 -> this flash the custom kernel loaded at first line ``` -------------------------------- ### Dimming Front Panel Lights Source: https://github.com/benoitm974/ix4-300d/wiki/Home This command controls the brightness of the front panel, including the LCD and LEDs, by writing a value to the PWM3 control file. The value ranges from 0 to 255, where 30 represents a dimmed state. ```bash echo 30 > /sys/class/i2c-adapter/i2c-0/0-002e/pwm3 ``` -------------------------------- ### Configure Automatic Fan Speed Control Source: https://github.com/benoitm974/ix4-300d/wiki/Home Enables automatic fan speed control based on CPU temperature. Ensure the I2C adapter and device are correctly configured. ```bash echo 1 > /sys/class/i2c-adapter/i2c-0/0-002e/pwm1_auto_channels_temp ``` ```bash echo 2 > /sys/class/i2c-adapter/i2c-0/0-002e/pwm1_enable ``` -------------------------------- ### Control LCD Display via /dev/lcm Source: https://context7.com/benoitm974/ix4-300d/llms.txt Sends commands to the LCD display through the /dev/lcm character device. Commands include clearing the screen, displaying text, initializing, or drawing bitmaps. ```bash # Clear the display echo -n "C" > /dev/lcm ``` ```bash # Display ASCII text (limited to first row due to 128-pixel width) echo -n "THello World" > /dev/lcm ``` ```bash # Display initialization/boot image echo -n "I" > /dev/lcm ``` ```python3 import sys # Create simple pattern: horizontal lines data = b'B' + bytes([0x55] * 1024) # Alternating pixel rows sys.stdout.buffer.write(data) ``` ```bash # Display raw bitmap (128x64 = 1024 bytes, 8 pages of 128 bytes each) # Format: 'B' followed by 1024 bytes of raw pixel data # Each byte represents 8 vertical pixels (LSB at top) python3 -c " import sys # Create simple pattern: horizontal lines data = b'B' + bytes([0x55] * 1024) # Alternating pixel rows sys.stdout.buffer.write(data) " > /dev/lcm ``` ```bash # Display custom image from file echo -n "B" > /dev/lcm && dd if=my_image.raw bs=1024 count=1 >> /dev/lcm ``` -------------------------------- ### Monitor GPIO Button Events Source: https://context7.com/benoitm974/ix4-300d/llms.txt Monitors input events from front panel buttons, which are mapped to specific GPIO pins and generate standard Linux input events. Compatible with acpid for system control. ```bash # Button GPIO mapping: # Power Button: GPIO44 (KEY_POWER) - Active High # Reset Button: GPIO45 (KEY_RESTART) - Active Low # Select Button: GPIO41 (BTN_SELECT) - Active Low # Scroll Button: GPIO42 (KEY_SCROLLDOWN) - Active Low # Monitor button events cat /dev/input/event0 ``` ```bash # Using evtest for detailed event information evtest /dev/input/event0 ``` ```bash # Configure acpid to respond to power button # /etc/acpi/events/powerbtn: # event=button/power # action=/sbin/shutdown -h now ``` -------------------------------- ### Checking CPU Temperature Source: https://github.com/benoitm974/ix4-300d/wiki/Home This command calculates and displays the CPU temperature by reading the raw temperature input from the i2c interface and converting it to a human-readable format. It uses 'bc' for floating-point arithmetic to divide the input value by 1000. ```bash echo "scale=0; `cat /sys/class/i2c-adapter/i2c-0/0-002e/temp1_input`/1000" | bc ``` -------------------------------- ### Control Front Panel Brightness via I2C PWM Source: https://context7.com/benoitm974/ix4-300d/llms.txt Adjusts the overall front panel brightness, including the LCD and LEDs, by controlling the ADT7473 PWM controller via I2C. ```bash # Set front panel brightness (0-255) # Minimum visible: ~30 # Maximum: 255 echo 30 > /sys/class/i2c-adapter/i2c-0/0-002e/pwm3 # Dim the panel for night mode echo 10 > /sys/class/i2c-adapter/i2c-0/0-002e/pwm3 # Full brightness echo 255 > /sys/class/i2c-adapter/i2c-0/0-002e/pwm3 ``` -------------------------------- ### Access Real-Time Clock (RTC) Source: https://context7.com/benoitm974/ix4-300d/llms.txt Interacts with the PCF8563 RTC via the standard Linux RTC interface. Commands include reading, writing, and setting the system time from/to the RTC, as well as direct I2C detection. ```bash # Read current RTC time hwclock -r ``` ```bash # Set RTC from system time hwclock -w ``` ```bash # Set system time from RTC hwclock -s ``` ```bash # Direct I2C access (for debugging) i2cdetect -y 0 ``` -------------------------------- ### Read CPU and Ambient Temperatures Source: https://context7.com/benoitm974/ix4-300d/llms.txt Reads temperature sensor inputs from the hwmon interface. CPU temperature is typically temp1_input and ambient is temp2_input. ```bash cat /sys/class/hwmon/hwmon0/temp1_input # CPU ``` ```bash cat /sys/class/hwmon/hwmon0/temp2_input # Ambient ``` -------------------------------- ### Write to LCD Device Source: https://github.com/benoitm974/ix4-300d/wiki/Home Displays text on the LCD screen by writing to the /dev/lcm device. Refer to the kernel driver for specific syntax. ```bash cat /dev/lcm ``` -------------------------------- ### Monitor Temperature Sensors via I2C Source: https://context7.com/benoitm974/ix4-300d/llms.txt Reads CPU and ambient temperature readings from the I2C-connected ADT7473 chip. Temperatures are reported in millidegrees Celsius. ```bash # Read CPU temperature (in millidegrees Celsius) cat /sys/class/i2c-adapter/i2c-0/0-002e/temp1_input # Output: 45000 (equals 45°C) # Convert to degrees with bc echo "scale=0; $(cat /sys/class/i2c-adapter/i2c-0/0-002e/temp1_input)/1000" | bc # Output: 45 ``` -------------------------------- ### Manual Fan Speed Control Source: https://context7.com/benoitm974/ix4-300d/llms.txt Sets the fan's PWM value directly for manual control. The value ranges from 0 (off) to 255 (full speed). ```bash # Manual fan control # Set PWM value directly (0-255) echo 150 > /sys/class/i2c-adapter/i2c-0/0-002e/pwm1 ``` -------------------------------- ### Set Fan PWM Speed Levels Source: https://github.com/benoitm974/ix4-300d/wiki/Home Sets the PWM duty cycle values corresponding to the defined temperature thresholds. Values range from 0 to 255. ```bash echo 75 > /sys/class/i2c-adapter/i2c-0/0-002e/pwm1_auto_point1_pwm ``` ```bash echo 180 > /sys/class/i2c-adapter/i2c-0/0-002e/pwm1_auto_point2_pwm ``` -------------------------------- ### Automatic Fan Speed Control Configuration Source: https://context7.com/benoitm974/ix4-300d/llms.txt Configures the fan to operate in automatic mode based on CPU temperature. This involves enabling auto mode, setting temperature reaction points, and defining corresponding PWM values. ```bash # Automatic PWM control (recommended) # Enable auto PWM mode echo 2 > /sys/class/i2c-adapter/i2c-0/0-002e/pwm1_enable ``` ```bash # Configure to react only to CPU temperature echo 1 > /sys/class/i2c-adapter/i2c-0/0-002e/pwm1_auto_channels_temp ``` ```bash # Set temperature thresholds (in millidegrees) # Fan starts at 57°C echo 57000 > /sys/class/i2c-adapter/i2c-0/0-002e/temp1_auto_point1_temp # Fan reaches max at 90°C echo 90000 > /sys/class/i2c-adapter/i2c-0/0-002e/temp1_auto_point2_temp ``` ```bash # Set PWM values for temperature points # Minimum fan speed (at 57°C) echo 75 > /sys/class/i2c-adapter/i2c-0/0-002e/pwm1_auto_point1_pwm # Maximum fan speed (at 90°C) echo 180 > /sys/class/i2c-adapter/i2c-0/0-002e/pwm1_auto_point2_pwm ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.