Buildroot 4 anni dopo ma sempre su Arietta G25.

Parte terza. La prima build.

Come già detto in questo primo timido approccio a buildroot mi sono concentrato solo sulla creazione del rootfs.

Quindi,  buildroot-2020.02.1.tar.gz.

Dopo di che ho applicato uno dei defconfig gentilemnete forniti da acmesystems:

$ make acmesystems_arietta_g25_256mb_defconfig

Poi ho personalizzato il tutto aggiungendo lighttpd, ntpd e qualche altra amenità con:

$ make menuconfig

A questo punto ho creato il mio defconfig  personalizzato:

$ make defconfig
$ mv defconfig/Mia_arietta_defconfig

Di seguito il mio defconfig:

$ more configs/Mia_arietta_defconfig
BR2_arm=y
BR2_OPTIMIZE_FAST=y
BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_19=y
BR2_TARGET_GENERIC_ISSUE="Welcome to Arietta-G25 Buildroot"
BR2_TARGET_GENERIC_ROOT_PASSWD="XXXXXX"
BR2_TARGET_GENERIC_GETTY_PORT="ttyS0"
BR2_TARGET_GENERIC_GETTY_BAUDRATE_115200=y
BR2_ENABLE_LOCALE_WHITELIST="it_IT.UTF-8"
BR2_TARGET_TZ_INFO=y
BR2_TARGET_LOCALTIME="Europe/Paris"
BR2_ROOTFS_OVERLAY="./board/acmesystems/arietta-g25/rootfs_overlay"
BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh"
BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/acmesystems/arietta-g25/genimage.cfg"
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_VERSION=y
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="4.19"
BR2_LINUX_KERNEL_DEFCONFIG="at91_dt"
BR2_LINUX_KERNEL_DTS_SUPPORT=y
BR2_LINUX_KERNEL_INTREE_DTS_NAME="at91-ariettag25"
BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y
BR2_PACKAGE_LINUX_FIRMWARE=y
BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT2XX=y
BR2_PACKAGE_HAVEGED=y
BR2_PACKAGE_IW=y
BR2_PACKAGE_LIGHTTPD=y
BR2_PACKAGE_LIGHTTPD_PCRE=y
BR2_PACKAGE_NTP=y
BR2_PACKAGE_OPENSSH=y
BR2_PACKAGE_WPA_SUPPLICANT=y
BR2_PACKAGE_WPA_SUPPLICANT_CLI=y
BR2_PACKAGE_WPA_SUPPLICANT_PASSPHRASE=y
BR2_TARGET_ROOTFS_EXT2=y
BR2_TARGET_ROOTFS_EXT2_4=y
BR2_TARGET_ROOTFS_EXT2_LABEL="rootfs"
BR2_TARGET_AT91BOOTSTRAP3=y
BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_GIT=y
BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_REPO_URL="https://github.com/linux4sam/at91bootstrap.git"
BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_REPO_VERSION="v3.8.13"
BR2_TARGET_AT91BOOTSTRAP3_DEFCONFIG="arietta-256m"
BR2_PACKAGE_HOST_DOSFSTOOLS=y
BR2_PACKAGE_HOST_GENIMAGE=y
BR2_PACKAGE_HOST_MTOOLS=y

A questo punto conviene parlare del rootfs_overlay.
In pratica, alla fine della compilazione, buildroot va a sovrascrivere alcuni files che va a pescare nel percorso definito nel defconfig alla voce BR2_ROOTFS_OVERLAY=”./board/acmesystems/arietta-g25/rootfs_overlay”.

$ ls -R ./board/acmesystems/arietta-g25/rootfs_overlay
./board/acmesystems/arietta-g25/rootfs_overlay:
etc  var

./board/acmesystems/arietta-g25/rootfs_overlay/etc:
init.d  inittab  kmap_it.bin  network  resolv.conf  ssh  wpa_supplicant.conf

./board/acmesystems/arietta-g25/rootfs_overlay/etc/init.d:
S60SetKeyboard

./board/acmesystems/arietta-g25/rootfs_overlay/etc/network:
interfaces

./board/acmesystems/arietta-g25/rootfs_overlay/etc/ssh:
sshd_config

./board/acmesystems/arietta-g25/rootfs_overlay/var:
www

./board/acmesystems/arietta-g25/rootfs_overlay/var/www:
index.html
Download rootfs_overlay.tar

Detti files sono spesso file di configurazione che noi stessi abbiamo provveduto a scrivere per il corretto funzionamento di alcuni servizi, o semplicemente files che vogliamo di fatto inclusi nel nostro file system.
A questo punto:

$ make

Se tutto sarà andato a buon fine troveremo quanto necessitiamo in output/images:

$ ls -l output/images/
totale 68020
-rw-r--r-- 1 antonino antonino 23674 mag 26 16:54 at91-ariettag25.dtb
-rwxr-xr-x 1 antonino antonino 14749 mag 26 16:48 at91bootstrap.bin
-rwxr-xr-x 1 antonino antonino 14749 mag 26 16:48 at91sam9x5_arietta-sdcardboot-linux-zimage-dt-3.8.13.bin
-rwxr-xr-x 1 antonino antonino 14749 mag 26 16:48 boot.bin
-rw-r--r-- 1 antonino antonino 16777216 mag 26 16:54 boot.vfat
-rw-r--r-- 1 antonino antonino 62914560 mag 26 16:54 rootfs.ext2
lrwxrwxrwx 1 antonino antonino 11 mag 26 16:54 rootfs.ext4 -> rootfs.ext2
-rw-r--r-- 1 antonino antonino 16824320 mag 26 16:54 rootfs.tar
-rw-r--r-- 1 antonino antonino 79692288 mag 26 16:54 sdcard.img
-rw-r--r-- 1 antonino antonino 4118040 mag 26 16:54 zImage

Come si sarà già compreso l’età avanza e non posso permettermi di mettere troppa carne al fuoco.
Quindi avendo già kernel, boot.bin e dtb pronti mi sono limitato a gioire del solo rootfs.tar.

Quindi con un bel:

$ sudo tar xvf output/images/rootfs.tar -C /media/$USER/rootfs

ho provveduto a copiare il file system nella microsd precedentemente partizionata e formattata.
Dopo un sync ed un umount ho spostato la microsd nello slot di arietta et voilà!

Questo l’output in console della fase di avvio:

$ sudo minicom dfl
[sudo] password di antonino:

Welcome to minicom 2.7.1

OPTIONS: I18n
Compiled on Aug 13 2017, 15:25:34.
Port /dev/ttyUSB0, 17:56:48

Press CTRL-A Z for help on special keys

RomBOOT


AT91Bootstrap 3.7-00029-ge79aea3 (mar 20 ott 2015, 15.59.44, CEST)

1-Wire: Loading 1-Wire information ...
1-Wire: ROM Searching ... Done, 0x0 1-Wire chips found

WARNING: 1-Wire: No 1-Wire chip found

1-Wire: Using default information

1-Wire: SYS_GPBR2: 0x4010425, SYS_GPBR3: 0x8421

SD/MMC: Image: Read file zImage to 0x22000000
SD: Card Capacity: High or Extended
SD: Specification Version 3.0X
SD/MMC: dt blob: Read file acme-arietta.dtb to 0x21000000
SD: Card Capacity: High or Extended
SD: Specification Version 3.0X

Booting zImage ......
zImage magic: 0x16f2818 is found

Using device tree in place at 0x21000000

Starting linux kernel ..., machid: 0xffffffff

Booting Linux on physical CPU 0x0
Linux version 4.9.124 (antonino@smilzo) (gcc version 7.5.0 (Ubuntu/Linaro 7.5.0-3ubuntu1~18.04) ) #3 Wed Apr 22 16:16:38 CEST 2020
CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=0005317f
CPU: VIVT data cache, VIVT instruction cache
OF: fdt:Machine model: Acme Systems Arietta G25
Memory policy: Data cache writeback
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 65024
Kernel command line: mem=256M console=ttyS0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait consoleblank=0
PID hash table entries: 1024 (order: 0, 4096 bytes)
Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
Memory: 253540K/262144K available (4538K kernel code, 161K rwdata, 1028K rodata, 196K init, 116K bss, 8604K reserved, 0K cma-reserved)
Virtual kernel memory layout:
vector : 0xffff0000 - 0xffff1000 ( 4 kB)
fixmap : 0xffc00000 - 0xfff00000 (3072 kB)
vmalloc : 0xd0800000 - 0xff800000 ( 752 MB)
lowmem : 0xc0000000 - 0xd0000000 ( 256 MB)
.text : 0xc0008000 - 0xc0476ef0 (4540 kB)
.init : 0xc0599000 - 0xc05ca000 ( 196 kB)
.data : 0xc05ca000 - 0xc05f2520 ( 162 kB)
.bss : 0xc05f2520 - 0xc060f67c ( 117 kB)
NR_IRQS:16 nr_irqs:16 16
clocksource: pit: mask: 0x7ffffff max_cycles: 0x7ffffff, max_idle_ns: 7167226906 ns
sched_clock: 32 bits at 128 Hz, resolution 7812500ns, wraps every 16777215996093750ns
Console: colour dummy device 80x30
Calibrating delay loop... 198.76 BogoMIPS (lpj=775168)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
CPU: Testing write buffer coherency: ok
Setting up static identity map for 0x20008400 - 0x2000847c
devtmpfs: initialized
clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 14931722236523437 ns
futex hash table entries: 256 (order: -1, 3072 bytes)
pinctrl core: initialized pinctrl subsystem
NET: Registered protocol family 16
DMA: preallocated 256 KiB pool for atomic coherent allocations
AT91: Detected SoC family: at91sam9x5
AT91: Detected SoC: at91sam9g25, revision 1
No ATAGs?
gpio-at91 fffff400.gpio: at address d0861400
gpio-at91 fffff600.gpio: at address d0863600
gpio-at91 fffff800.gpio: at address d0865800
gpio-at91 fffffa00.gpio: at address d0867a00
pinctrl-at91 ahb:apb:pinctrl@fffff400: initialized AT91 pinctrl driver
clocksource: tcb_clksrc: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 114675631333 ns
at_hdmac ffffec00.dma-controller: Atmel AHB DMA Controller ( cpy set slave sg-cpy ), 8 channels
at_hdmac ffffee00.dma-controller: Atmel AHB DMA Controller ( cpy set slave sg-cpy ), 8 channels
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
at91_i2c f8010000.i2c: using dma0chan0 (tx) and dma0chan1 (rx) for DMA transfers
at91_i2c f8010000.i2c: AT91 i2c bus driver (hw version: 0x402).
clocksource: Switched to clocksource tcb_clksrc
NET: Registered protocol family 2
TCP established hash table entries: 2048 (order: 1, 8192 bytes)
TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
TCP: Hash tables configured (established 2048 bind 2048)
UDP hash table entries: 256 (order: 0, 4096 bytes)
UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
NET: Registered protocol family 1
workingset: timestamp_bits=30 max_order=16 bucket_order=0
NET: Registered protocol family 38
io scheduler noop registered (default)
fffff200.serial: ttyS0 at MMIO 0xfffff200 (irq = 16, base_baud = 8333333) is a ATMEL_SERIAL
console [ttyS0] enabled
f8020000.serial: ttyS2 at MMIO 0xf8020000 (irq = 23, base_baud = 8333333) is a ATMEL_SERIAL
brd: module loaded
loop: module loaded
atmel_spi f0004000.spi: version: 0x212
atmel_spi f0004000.spi: Using dma1chan0 (tx) and dma1chan1 (rx) for DMA transfers
atmel_spi f0004000.spi: Atmel SPI Controller at 0xf0004000 (irq 26)
fbtft_of_value: regwidth = 8
fbtft_of_value: buswidth = 8
fbtft_of_value: rotate = 270
fbtft_of_value: fps = 30
random: fast init done
Console: switching to colour frame buffer device 80x40
graphics fb0: fb_ili9341 frame buffer, 320x240, 150 KiB video memory, 16 KiB DMA buffer memory, fps=32, spi32766.0 at 50 MHz
libphy: Fixed MDIO Bus: probed
usbcore: registered new interface driver rt2800usb
ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
ehci-atmel: EHCI Atmel driver
atmel-ehci 700000.ehci: EHCI Host Controller
atmel-ehci 700000.ehci: new USB bus registered, assigned bus number 1
atmel-ehci 700000.ehci: irq 28, io mem 0x00700000
atmel-ehci 700000.ehci: USB 2.0 started, EHCI 1.00
usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
usb usb1: Product: EHCI Host Controller
usb usb1: Manufacturer: Linux 4.9.124 ehci_hcd
usb usb1: SerialNumber: 700000.ehci
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 3 ports detected
ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
ohci-atmel: OHCI Atmel driver
at91_ohci 600000.ohci: failed to find sfr node
at91_ohci 600000.ohci: USB Host Controller
at91_ohci 600000.ohci: new USB bus registered, assigned bus number 2
at91_ohci 600000.ohci: irq 28, io mem 0x00600000
usb usb2: New USB device found, idVendor=1d6b, idProduct=0001
usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
usb usb2: Product: USB Host Controller
usb usb2: Manufacturer: Linux 4.9.124 ohci_hcd
usb usb2: SerialNumber: at91
hub 2-0:1.0: USB hub found
hub 2-0:1.0: 3 ports detected
usbcore: registered new interface driver cdc_acm
cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
usbcore: registered new interface driver usb-storage
usbcore: registered new interface driver usbserial
usbcore: registered new interface driver usbserial_generic
usbserial: USB Serial support registered for generic
usbcore: registered new interface driver ftdi_sio
usbserial: USB Serial support registered for FTDI USB Serial Device
usbcore: registered new interface driver pl2303
usbserial: USB Serial support registered for pl2303
atmel_usba_udc 500000.gadget: MMIO registers at 0xf803c000 mapped at d08de000
atmel_usba_udc 500000.gadget: FIFO at 0x00500000 mapped at d0c80000
using random self ethernet address
using random host ethernet address
usb0: HOST MAC 8a:5f:62:1d:75:c0
usb0: MAC 72:66:09:c7:08:f5
using random self ethernet address
using random host ethernet address
g_ether gadget: Ethernet Gadget, version: Memorial Day 2008
g_ether gadget: g_ether ready
mousedev: PS/2 mouse device common for all mice
rtc rtc0: invalid alarm value: 1900-1-1 0:0:0
at91_rtc fffffeb0.rtc: rtc core: registered fffffeb0.rtc as rtc0
at91_rtc fffffeb0.rtc: AT91 Real Time Clock driver.
i2c /dev entries driver
Driver for 1-wire Dallas network protocol.
AT91: Starting after wakeup
atmel_mci f0008000.mmc: version: 0x504
atmel_mci f0008000.mmc: using dma0chan2 for DMA transfers
atmel_mci f0008000.mmc: Atmel MCI controller at 0xf0008000 irq 22, 1 slots
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
iio iio:device0: Resolution used: 10 bits
input: at91_adc as /devices/soc0/ahb/ahb:apb/f804c000.adc/input/input0
usb 1-2: new high-speed USB device number 2 using atmel-ehci
NET: Registered protocol family 17
at91_rtc fffffeb0.rtc: setting system clock to 2007-01-01 00:00:03 UTC (1167609603)
Waiting for root device /dev/mmcblk0p2...
mmc0: host does not support reading read-only switch, assuming write-enable
g_ether gadget: high-speed config #2: RNDIS
mmc0: new high speed SDHC card at address aaaa
mmcblk0: mmc0:aaaa SS08G 7.40 GiB
mmcblk0: p1 p2
EXT4-fs (mmcblk0p2): INFO: recovery required on readonly filesystem
EXT4-fs (mmcblk0p2): write access will be enabled during recovery
usb 1-2: New USB device found, idVendor=148f, idProduct=5370
usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 1-2: Product: 802.11 n WLAN
usb 1-2: Manufacturer: Ralink
usb 1-2: SerialNumber: 1.0
EXT4-fs (mmcblk0p2): recovery complete
usb 1-2: reset high-speed USB device number 2 using atmel-ehci
EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
VFS: Mounted root (ext4 filesystem) readonly on device 179:2.
devtmpfs: mounted
Freeing unused kernel memory: 196K
This architecture does not have kernel memory protection.
ieee80211 phy0: rt2x00_set_rt: Info - RT chipset 5390, rev 0502 detected
EXT4-fs (mmcblk0p2): re-mounted. Opts: data=ordered
ieee80211 phy0: rt2x00_set_rf: Info - RF chipset 5370 detected
Starting syslogd: OK
Starting klogd: OK
Running sysctl: OK
Initializing random number generator: OK
Saving random seed: random: dd: uninitialized urandom read (512 bytes read)
OK
Starting haveged: haveged: listening socket at 3
OK
Starting network: Successfully initialized wpa_supplicant
rfkill: Caieee80211 phy0: rt2x00lib_request_firmware: Info - Loading firmware file 'rt2870.bin'
nnot open RFKILL control device
ieee80211 phy0: rt2x00lib_request_firmware: Info - Firmware detected - version: 0.36
OK
Starting ntpd: wlan0: authenticate with 2c:3a:fd:cd:58:52
wlan0: send auth to 2c:3a:fd:cd:58:52 (try 1/3)
wlan0: send auth to 2c:3a:fd:cd:58:52 (try 2/3)
wlan0: authenticated
wlan0: associate with 2c:3a:fd:cd:58:52 (try 1/3)
wlan0: RX AssocResp from 2c:3a:fd:cd:58:52 (capab=0x1431 status=0 aid=6)
wlan0: associated
random: wpa_supplicant: uninitialized urandom read (32 bytes read)
OK
Starting lighttpd: OK
random: crng init done
Starting sshd: OK

Welcome to Arietta-G25 Buildroot
buildroot login:

Circa 15 secondi più tardi arietta presenta la richiesta di login, non male direi.

Ovviamente ho effettuato più make man mano che aggiungevo pacchetti con il make menuconfig.

Buildroot sembra avere le cose sotto controllo e non ricompila ai make successivi al primo pacchetti già pronti rendendo i tempi di compilazione ridottissimi rispetto al primo tentativo.
Devo però segnalare di aver avuto dei problemi con lighttpd che non voleva saperne di funzionare.

La soluzione dei miei problemi è giunta eseguendo un:

$ make clean
rm -rf /home/antonino/sviluppo/buildroot-2020.02.1/output/target /home/antonino/sviluppo/buildroot-2020.02.1/output/images /home/antonino/sviluppo/buildroot-2020.02.1/output/host  \
        /home/antonino/sviluppo/buildroot-2020.02.1/output/build /home/antonino/sviluppo/buildroot-2020.02.1/output/staging \
        /home/antonino/sviluppo/buildroot-2020.02.1/output/legal-info /home/antonino/sviluppo/buildroot-2020.02.1/output/graphs /home/antonino/sviluppo/buildroot-2020.02.1/output/per-package

e poi di nuovo il make.

 

Aggiornamento!!!

Ma visto e considerato che saranno 20 volte che sto qui a dire che del kernel ed altro non mi interessa niente perché me lo compilo a manina altrove non sarebbe il caso di escluderlo dai già numerosi fardelli che buildroot si porta dietro ad ogni make?
Stessa cosa per il bootloader AT91BOOTSTRAP3.

make menuconfig, la compilazione del kernel è abilitata.

make menuconfig, ecco come risparmiare tempo e… denaro! 🙂

Ovviamente ecco il mio nuovo defconfig:

$ more configs/Mia_arietta_defconfig
BR2_arm=y
BR2_OPTIMIZE_FAST=y
BR2_KERNEL_HEADERS_4_9=y
BR2_TARGET_GENERIC_ISSUE="Welcome to Arietta-G25 Buildroot"
BR2_TARGET_GENERIC_ROOT_PASSWD="XxXxXx"
BR2_TARGET_GENERIC_GETTY_PORT="ttyS0"
BR2_TARGET_GENERIC_GETTY_BAUDRATE_115200=y
BR2_ENABLE_LOCALE_WHITELIST="it_IT.UTF-8"
BR2_TARGET_TZ_INFO=y
BR2_TARGET_LOCALTIME="Europe/Paris"
BR2_ROOTFS_OVERLAY="./board/acmesystems/arietta-g25/rootfs_overlay"
BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh"
BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/acmesystems/arietta-g25/genimage.cfg"
BR2_PACKAGE_LINUX_FIRMWARE=y
BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT2XX=y
BR2_PACKAGE_HAVEGED=y
BR2_PACKAGE_IW=y
BR2_PACKAGE_LIGHTTPD=y
BR2_PACKAGE_LIGHTTPD_PCRE=y
BR2_PACKAGE_NTP=y
BR2_PACKAGE_OPENSSH=y
BR2_PACKAGE_WPA_SUPPLICANT=y
BR2_PACKAGE_WPA_SUPPLICANT_CLI=y
BR2_PACKAGE_WPA_SUPPLICANT_PASSPHRASE=y
BR2_TARGET_ROOTFS_EXT2=y
BR2_TARGET_ROOTFS_EXT2_4=y
BR2_TARGET_ROOTFS_EXT2_LABEL="rootfs"
BR2_PACKAGE_HOST_DOSFSTOOLS=y
BR2_PACKAGE_HOST_GENIMAGE=y
BR2_PACKAGE_HOST_MTOOLS=y
Pubblicato in Digitale, Linux.

admin

Admin, per l'anagrafe Antonino Brisindi e per i colleghi radioamatori IZ0HEM,
nasce a Giugno del 1972.
Si cimenta in diverse discipline. Dal motociclismo all'elettronica.
Dalla meccanica delle chiavi inglesi al Jazz delle ance.
Dalla cucina dei fornelli alle dinamiche di volo ad ala mobile.
Interagisce con tutto quello che intercorre tra un 6502 ed un sistema embedded.
Capisce davvero poco di tutto quello che fa ed in questo periodo ama definirsi un pessimo system integrator! ;-)