Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RM 6639: Adaptation for Emcraft 'project' build procedure #1

Merged
merged 4 commits into from
May 24, 2023

Conversation

av-dyachenko
Copy link
Collaborator

@av-dyachenko av-dyachenko commented May 22, 2023

Design

A number of changes is required to build the kernel using the Emcraft 'projects' framework. Some of them were ported from the Emcraft 4.5 kernel:

  1. Support uncompressed kernel feature (CONFIG_KERNEL_COMPRESS_NONE)
  2. Create vmlinux.lds.S.good backup file
  3. Create the initramfs-list-min.stub file. We need it in order to build a stub initramfs, so as to complete a kernel build successfully, before we can run build and installation of kernel modules.
  4. Set UIMAGE_LOADADDR from .config
  5. Correct UIMAGE_ENTRYADDR for thumb2-only kernel
  6. Restore UIMAGE_IN env variable to pass the uImage data files from the Emcraft 'project' build procedure (it was removed from the mainline kernel some time ago)

Test

  1. On the Linux host, activate the build environment:
$ . ACTIVATE.sh
  1. Build the rootfs project:
$ cd projects/rootfs
$ make
...
$ ls -l rootfs.uImage
-rw-rw-r--. 1 sasha_d sasha_d 4950317 May 24 16:29 rootfs.uImage
$
  1. Copy the rootfs.uImage file to the TFTP server.
  2. Boot the kernel image over Ethernet and verify that the kernel and the command shell starts successfully:
STM32H7-SOM U-Boot > setenv image stm32h7/rootfs.uImage
STM32H7-SOM U-Boot > run netboot
ethernet@40028000 Waiting for PHY auto negotiation to complete. done
Using ethernet@40028000 device
TFTP from server 192.168.0.3; our IP address is 192.168.0.166
Filename 'stm32h7/rootfs.uImage'.
Load address: 0xd0400000
Loading: #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #############
         354.5 KiB/s
done
Bytes transferred = 4950317 (4b892d hex)
## Booting kernel from Legacy Image at d0400000 ...
   Image Name:   Linux-5.15.67-00004-g70c36e17f0b
   Image Type:   ARM Linux Multi-File Image (uncompressed)
   Data Size:    4950253 Bytes = 4.7 MiB
   Load Address: d0008000
   Entry Point:  d0008001
   Contents:
      Image 0: 4935776 Bytes = 4.7 MiB
      Image 1: 14465 Bytes = 14.1 KiB
   Verifying Checksum ... OK
## Loading init Ramdisk from multi component Legacy Image at d0400000 ...
## Flattened Device Tree from multi component Image at D0400000
   Booting using the fdt at 0xd08b50ac
   Loading Multi-File Image ... OK
WARNING: legacy format multi component image overwritten
   Loading Ramdisk to d1e71000, end d1e74881 ... OK
   Loading Device Tree to d1e6a000, end d1e70880 ... OK

Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 5.15.67-00004-g70c36e17f0bc ([email protected]) (arm-none-eabi-gcc (GNU Arm Embedded Toolchain 10.3-2021.10) 10.3.1 20210824 (release), GNU ld (GNU Arm Embedded Toolchain 10.3-2021.10) 2.36.1.20210621) #150 PREEMPT Tue May 23 23:22:01 MSK 2023
[    0.000000] CPU: ARMv7-M [411fc271] revision 1 (ARMv7M), cr=00000000
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, PIPT instruction cache
[    0.000000] OF: fdt: Machine model: STM32H7 SOM Starter Kit
[    0.000000] printk: bootconsole [earlycon0] enabled
[    0.000000] printk: debug: ignoring loglevel setting.
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x00000000d0000000-0x00000000d1ffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x00000000d0000000-0x00000000d1ffffff]
[    0.000000] Initmem setup node 0 [mem 0x00000000d0000000-0x00000000d1ffffff]
[    0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
[    0.000000] pcpu-alloc: [0] 0
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 8128
[    0.000000] Kernel command line: console=ttySTM0,115200 earlyprintk consoleblank=0 panic=3 ignore_loglevel
...
init started: BusyBox v1.24.2 (2023-05-19 20:14:28 MSK)
mount: mounting devpts on /dev/pts failed: No such device
ifconfig: socket: Function not implemented
/ #
  1. Run some basic commands from the shell:
/ # ls -l /
drwxr-xr-x    2 root     root             0 Jan  1 00:00 bin
drwxr-xr-x    3 root     root             0 Jan  1 00:00 dev
drwxr-xr-x    5 root     root             0 May 23  2023 etc
drwxr-xr-x    3 root     root             0 May 23  2023 httpd
lrwxrwxrwx    1 root     root             9 May 23  2023 init -> /bin/init
drwxrwxrwx    3 root     root             0 May 23  2023 lib
drwxrwxrwx    8 root     root             0 May 23  2023 mnt
dr-xr-xr-x   61 root     root             0 Jan  1 00:00 proc
drwx------    2 root     root             0 May 23  2023 root
drwxr-xr-x    2 root     root             0 Jan  1 00:00 sbin
dr-xr-xr-x   12 root     root             0 Jan  1 00:00 sys
drwxrwxrwx    2 root     root             0 May 23  2023 tmp
drwxr-xr-x    6 root     root             0 May 23  2023 usr
drwxr-xr-x    7 root     root             0 May 23  2023 var
/ # reboot
The system is going down NOW!
TERM
Sent SIGTERM to all processes
Sent SIGKILL to all processes
Requesting system reboot
[   75.362781] reboot: Res
U-Boot SPL 2019.04-00060-g87d66feb7b (May 02 2023 - 19:13:37 +0300)

Sergei Miroshnichenko and others added 4 commits May 18, 2023 23:03
- vmlinux.lds.S.good backup file
- initramgs-list-min.stub file
- set UIMAGE_LOADADDR from .config
- correct UIMAGE_ENTRYADDR for thumb2-only kernel

Signed-off-by: Yuri Tikhonov <[email protected]>
@av-dyachenko av-dyachenko changed the title Rm6639 stm32h7 port RM 6639: Adaptation for Emcraft 'project' build procedure May 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants