Page 1 of 1

SAMA5D27 SOM1 EK1 customized Linux Image

Posted: Thu May 16, 2019 3:14 pm
by Gaston
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.

Re: SAMA5D27 SOM1 EK1 customized Linux Image

Posted: Thu May 16, 2019 6:59 pm
by CleberPeter
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.

Re: SAMA5D27 SOM1 EK1 customized Linux Image

Posted: Fri May 17, 2019 12:13 am
by blue_z
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

Re: SAMA5D27 SOM1 EK1 customized Linux Image

Posted: Fri May 17, 2019 3:18 am
by Gaston
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

Re: SAMA5D27 SOM1 EK1 customized Linux Image

Posted: Fri May 17, 2019 3:37 am
by Gaston
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.

Re: SAMA5D27 SOM1 EK1 customized Linux Image

Posted: Fri May 17, 2019 2:12 pm
by CleberPeter
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

Re: SAMA5D27 SOM1 EK1 customized Linux Image

Posted: Fri May 17, 2019 2:56 pm
by Gaston
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 ?

Re: SAMA5D27 SOM1 EK1 customized Linux Image

Posted: Fri May 17, 2019 3:54 pm
by CleberPeter
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

Re: SAMA5D27 SOM1 EK1 customized Linux Image

Posted: Fri May 17, 2019 8:21 pm
by Gaston
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 ?

Re: SAMA5D27 SOM1 EK1 customized Linux Image

Posted: Mon May 20, 2019 2:11 pm
by CleberPeter
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.

Re: SAMA5D27 SOM1 EK1 customized Linux Image

Posted: Tue May 21, 2019 10:55 am
by Gaston
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

Re: SAMA5D27 SOM1 EK1 customized Linux Image

Posted: Sun May 26, 2019 4:42 pm
by Gaston
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 ?