Embedded Linux 20240906
Embedded Linux 20240906
SI/SW
2024/9/6
I decided to just bite the bullet, and call the next version 3.0. It will get released close enough
to the 20-year mark, which is excuse enough for me, although honestly, the real reason is
just that I can no longer comfortably count as high as 40.
The strongest argument for some people advocating 4.0 seems to have been a wish to see
4.1.15 - because "that was the version of Linux skynet used for the T-800 terminator"
The numbering change is not indicative of anything special. If you want to have an official
reason, it's that I ran out of fingers and toes to count on, so 4.21 became 5.0
So, as is hopefully clear to everybody, the major version number change is more about me
running out of fingers and toes than it is about any big fundamental changes.
Example at Google: starting from Android O (2017), all new Android devices have
to run such an LTS kernel.
make
Only works from the top kernel source directory
Run several jobs in parallel. Our advice: ncpus * 2 to fully
load the CPU and I/Os at all times
Example: make -j 8
To recompile faster (7x according to some
benchmarks), use the ccache compiler cache
export CROSS_COMPILE="ccache arm-linux-"
# modinfo usb_storage
filename: /lib/modules/5.18.13-200.fc36.x86_64/kernel/drivers/usb/storage/usb-storage.ko.xz
license: GPL
description: USB Mass Storage driver for Linux
author: Matthew Dharm <[email protected]>
alias: usb:v*p*d*dc*dsc*dp*ic08isc06ip50in*
alias: usb:v*p*d*dc*dsc*dp*ic08isc05ip50in*
alias: usb:v*p*d*dc*dsc*dp*ic08isc04ip50in*
[...]
intree: Y
name: usb_storage
[...]
parm: option_zero_cd:ZeroCD mode (1=Force Modem (default), 2=Allow CD-Rom (uint)
parm: swi_tru_install:TRU-Install mode (1=Full Logic (def), 2=Force CD-Rom, 3=Force Modem) (uint)
parm: delay_use:seconds to delay before using a new device (uint)
parm: quirks:supplemental list of device IDs and their quirks (string)
module_init(hello_init);
module_exit(hello_exit);
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION(”Hello module");
MODULE_AUTHOR(”[email protected]");
obj-m := hello.o
all:
${MAKE} -C ${KDIR} M=${PWD} modules
install:
${MAKE} -C ${KDIR} M=${PWD} modules_install
clean:
${MAKE} -C ${KDIR} M=${PWD} clean
The unit address must be the address of the first reg entry.
module@a0000 { spi@300000 {
#address-cells = <1>; #address-cells = <1>;
#size-cells = <1>; #size-cells = <0>;
serial@1000 { flash@1 {
reg = <0x1000 0x10>, <0x2000 0x10>; reg = <1>;
}; };
}; };
The USB core now knows the association between the vendor/product IDs of
rtl8150 and the struct usb_driver structure of this driver
or
Example C code that uses the usual file API to write data to a serial port
int fd;
fd = open("/dev/ttyS0", O_RDWR);
write(fd, "Hello", 5);
close(fd);
#include <linux/fs.h>
struct file_operations {
struct module *owner;
ssize_t (*read) (struct file *, char __user *,
size_t, loff_t *);
ssize_t (*write) (struct file *, const char __user *,
size_t, loff_t *);
long (*unlocked_ioctl) (struct file *, unsigned int,
unsigned long);
int (*mmap) (struct file *, struct vm_area_struct *);
int (*open) (struct inode *, struct file *);
int (*release) (struct inode *, struct file *);
……
};
break;
}
[…]
default:
return -EINVAL;
}
return retval;
}
fd = open("/dev/dbg_iomem", O_RDWR);
if (fd < 0)
return -1;
close(fd);
return 0;
}
config MISC_RTSX_PCI
tristate "Realtek PCI-E card reader"
depends on PCI
select MFD_CORE
help
This supports for Realtek PCI-Express card reader including rts5209,
rts5227, rts522A, rts5229, rts5249, rts524A, rts525A, rtl8411, rts5260.
Realtek card readers support access to many types of memory cards,
such as Memory Stick, Memory Stick Pro, Secure Digital and
MultiMediaCard.
if I2C
onfig I2C_CHARDEV
…
endif # I2C
endmenu
menuconfig SPI
bool “SPI support”
if SPI
config SPI_DEBUG
…
endif # SPI
if MMC
source "drivers/mmc/core/Kconfig"
source "drivers/mmc/card/Kconfig"
source "drivers/mmc/host/Kconfig"
endif # MMC
The top Makefile reads the .config file, which comes from the kernel configuration
process.
The top Makefile is responsible for building two major products: vmlinux and
modules
Each subdirectory has a kbuild Makefile which carries out the commands passed
down from above
asflags-y := -ansi
ldflags-y += -T $(srctree)/$(src)/decompress_$(arch-y).lds
CFLAGS_$@, AFLAGS_$@
$(CFLAGS_$@) and $(AFLAGS_$@) specifies per-file options
ccflags-remove-$(CONFIG_MCOUNT) += -pg
clean-files := crc32table.h
clean-dirs := $(objtree)/debian/
/boot Kernel images, configurations and initramfs (only when the kernel is
loaded from a filesystem, not common on non-x86 architectures)
/dev Device files
/var Variable data files, for system services. This includes spool directories and
files, administrative and logging data, and transient and temporary files
Need to read the documentation (if any), read the Makefiles, and adapt to their
behavior.
root@rts4930-vm:~#
Your fair use and other rights are in no way affected by the above.