SAMA5D27 SOM1 EK1 customized Linux Image

Moderator: nferre

Gaston
Posts: 29
Joined: Fri May 10, 2019 12:21 pm

SAMA5D27 SOM1 EK1 customized Linux Image

Thu May 16, 2019 3:14 pm

Hello everybody, I am working on sama5d27 som1 ek1 board and yocto project, i built a linux kernel image for it following the steps described here :
www.at91.com/linux4sam/bin/view/Linux4S ... EKMainPage

I m now having a bootable image which size is 49 MO.
The problem now is how can i make a less sized image, which modifications can i make and what can i delete before rebuilding the image to make it smaller.
For now i just want to make an image that support SERIAL PORTS, RS485 communication, ETHERNET.

Thank you.
CleberPeter
Location: Brazil
Posts: 6
Joined: Tue May 14, 2019 7:57 pm

Re: SAMA5D27 SOM1 EK1 customized Linux Image

Thu May 16, 2019 6:59 pm

Which of the images did you build?

The smallest image is obtained through the 'core-image-minimal' image.

Did you use the 'poky-atmel' distribution?

It also includes several optimizations with respect to image size.
blue_z
Location: USA
Posts: 1956
Joined: Thu Apr 19, 2007 10:15 pm

Re: SAMA5D27 SOM1 EK1 customized Linux Image

Fri May 17, 2019 12:13 am

Gaston wrote: I m now having a bootable image which size is 49 MO.
What are 'MO" units?

Only the kernel image is booted.
The image of the root filesystem is mounted. Only if the root filesystem is a ramfs/tmpfs or in ramdisk would the rootfs archive be read into memory.
What is this image that you refer to?

Gaston wrote: The problem now is how can i make a less sized image, which modifications can i make and what can i delete before rebuilding the image to make it smaller.
Clarify if you are referring to (a) the kernel, (b) the root filesystem, or (c) both (e.g. kernel with linked-in initramfs archive).

Gaston wrote: For now i just want to make an image that support SERIAL PORTS, RS485 communication, ETHERNET.
For a small root filesystem, consider choosing:
(a) Buildroot with a minimal defconfig (i.e. not dev_devconfig, see this) instead of Yocto for the build tool,
(b) uClibc instead of glibc for the C library,
(c) Busybox init instead of systemd or systemV for system initialization,
(d?) Thumb-2 instruction set instead of 32-bit ARM instructions.

Also perform Buildroot commands `make busybox-menuconfig` and `make linux-menuconfig` to remove extraneous commands/features/drivers.
You need to assess exactly what Ethernet capabilities and features are required, as that can impact the code size in both the kernel and userspace.

Regards
Gaston
Posts: 29
Joined: Fri May 10, 2019 12:21 pm

Re: SAMA5D27 SOM1 EK1 customized Linux Image

Fri May 17, 2019 3:18 am

CleberPeter wrote:
Thu May 16, 2019 6:59 pm
Which of the images did you build?

The smallest image is obtained through the 'core-image-minimal' image.

Did you use the 'poky-atmel' distribution?

It also includes several optimizations with respect to image size.
Yes i built ' core-image-minimal' and i used poky-atmel distribution
Gaston
Posts: 29
Joined: Fri May 10, 2019 12:21 pm

Re: SAMA5D27 SOM1 EK1 customized Linux Image

Fri May 17, 2019 3:37 am

I'm new with yocto and i was just following the steps described here to build u-boot , at91bootsrap, kernel and rootfs :
https://www.at91.com/linux4sam/bin/view ... EKMainPage

what i mean by Mo is " Mega octet " unit

what i mean by less sized image is both of rootfs and the kernel, by the way i just want to keep just a few features usable for my sama5 board like : ethernet, serial ports and rs485 communication. I don't know how to delete unwanted drivers or packages from the generated image.
CleberPeter
Location: Brazil
Posts: 6
Joined: Tue May 14, 2019 7:57 pm

Re: SAMA5D27 SOM1 EK1 customized Linux Image

Fri May 17, 2019 2:12 pm

Strange, Did you use 'sumo' branch ?

did not you add any packages to your distribution? , an ssh or gdb server?

My zImage file has 4MB and my RootFs it's smaller than 10MB, for the same steps you followed.

To enable the RS485 it is necessary to first configure the device tree so that the kernel can map the peripheral configuration example:

https://github.com/linux4sam/linux-at91 ... /rs485.txt

Also it will be necessary to use some driver that must be enabled in the kernel configuration, example of driver implementation:

https://github.com/linux4sam/linux-at91 ... -rs485.txt

Finally I recommend a reading of the datasheet of the processor to first check how to enable the peripheral and later how to make the electrical connection of the same:

http://ww1.microchip.com/downloads/en/d ... 01476b.pdf

page 1439: 47.7.6 RS485 Mode
Gaston
Posts: 29
Joined: Fri May 10, 2019 12:21 pm

Re: SAMA5D27 SOM1 EK1 customized Linux Image

Fri May 17, 2019 2:56 pm

CleberPeter wrote:
Fri May 17, 2019 2:12 pm
Strange, Did you use 'sumo' branch ?

did not you add any packages to your distribution? , an ssh or gdb server?

My zImage file has 4MB and my RootFs it's smaller than 10MB, for the same steps you followed.

To enable the RS485 it is necessary to first configure the device tree so that the kernel can map the peripheral configuration example:

https://github.com/linux4sam/linux-at91 ... /rs485.txt

Also it will be necessary to use some driver that must be enabled in the kernel configuration, example of driver implementation:

https://github.com/linux4sam/linux-at91 ... -rs485.txt

Finally I recommend a reading of the datasheet of the processor to first check how to enable the peripheral and later how to make the electrical connection of the same:

http://ww1.microchip.com/downloads/en/d ... 01476b.pdf

page 1439: 47.7.6 RS485 Mode
Yes i used SUMO branch and i follow this path : poky/build/tmp/deploy/sama5d27-som1-ek1 to find the "core-image-minimal-sama5d27-som1-ek-sd.wic" 49 mega octet file which i flash on my sd card. I didn't add anything i just followed the steps described in the link which i posted in my previous post. By the way, how can i see the drivers and packages that were installed ?
CleberPeter
Location: Brazil
Posts: 6
Joined: Tue May 14, 2019 7:57 pm

Re: SAMA5D27 SOM1 EK1 customized Linux Image

Fri May 17, 2019 3:54 pm

You can find the packages installed in your image after compilation in:

"${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.manifest"

as variable IMAGE_MANIFEST: https://www.yoctoproject.org/docs/curre ... E_MANIFEST
Gaston
Posts: 29
Joined: Fri May 10, 2019 12:21 pm

Re: SAMA5D27 SOM1 EK1 customized Linux Image

Fri May 17, 2019 8:21 pm

CleberPeter wrote:
Fri May 17, 2019 3:54 pm
You can find the packages installed in your image after compilation in:

"${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.manifest"

as variable IMAGE_MANIFEST: https://www.yoctoproject.org/docs/curre ... E_MANIFEST
I can see that now, thank you.
Please do you have any idea how can make device tree configuration ? remove some drivers or add some ?
CleberPeter
Location: Brazil
Posts: 6
Joined: Tue May 14, 2019 7:57 pm

Re: SAMA5D27 SOM1 EK1 customized Linux Image

Mon May 20, 2019 2:11 pm

An excellent reference to writing the device tree is the kernel documentation itself.

https://github.com/linux4sam/linux-at91 ... e/bindings

But remember the device tree is a description of your hardware, that is, what peripherals will be used if some remapping is needed.
Gaston
Posts: 29
Joined: Fri May 10, 2019 12:21 pm

Re: SAMA5D27 SOM1 EK1 customized Linux Image

Tue May 21, 2019 10:55 am

For a small root filesystem, consider choosing:
(a) Buildroot with a minimal defconfig (i.e. not dev_devconfig, see this) instead of Yocto for the build tool,
(b) uClibc instead of glibc for the C library,
(c) Busybox init instead of systemd or systemV for system initialization,
(d?) Thumb-2 instruction set instead of 32-bit ARM instructions.

Also perform Buildroot commands `make busybox-menuconfig` and `make linux-menuconfig` to remove extraneous commands/features/drivers.
You need to assess exactly what Ethernet capabilities and features are required, as that can impact the code size in both the kernel and userspace.
I can modify C library , system initialization and the instructions only when I m using Buildroot instead of yocto ?
For me i prefer using Yocto for his short re-build time comparing to other open source projects
Gaston
Posts: 29
Joined: Fri May 10, 2019 12:21 pm

Re: SAMA5D27 SOM1 EK1 customized Linux Image

Sun May 26, 2019 4:42 pm

For a small root filesystem, consider choosing:
(a) Buildroot with a minimal defconfig (i.e. not dev_devconfig, see this) instead of Yocto for the build tool,
(b) uClibc instead of glibc for the C library,
(c) Busybox init instead of systemd or systemV for system initialization,
(d?) Thumb-2 instruction set instead of 32-bit ARM instructions.
I have reduced the size of my rootfs, Is there a way to reduce the size of the boot ?

Return to “SAMA5-based”

Who is online

Users browsing this forum: Bing [Bot] and 2 guests