All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [Buildroot] [PATCH 1/1] configs/stm32f769_disco_sd_defconfig: new defconfig
       [not found] <CABGWkvoH-sy4LhPtWgY422FXm6pQ9UR5eM63nV-LAmEf1FRFng@mail.gmail.com>
@ 2023-04-22 16:56 ` Giulio Benetti
  2023-04-23 17:20   ` Dario Binacchi
  0 siblings, 1 reply; 8+ messages in thread
From: Giulio Benetti @ 2023-04-22 16:56 UTC (permalink / raw)
  To: Dario Binacchi; +Cc: buildroot

Hi Dario,

I readd the mailing list in Cc,

> Il giorno 22 apr 2023, alle ore 18:33, Dario Binacchi <dario.binacchi@amarulasolutions.com> ha scritto:
> 
> Hi Giulio,
> 
>> On Sat, Apr 22, 2023 at 4:56 PM Giulio Benetti
>> <giulio.benetti@benettiengineering.com> wrote:
>> 
>> Hi Dario,
>> 
>>> On 22/04/23 16:00, Dario Binacchi wrote:
>>> Board support package includes the following components:
>>> - mainline Linux kernel 5.14.21
>>> - mainline U-Boot 2023.04
>>> - default packages from buildroot
>>> 
>>> Note: There is a problem in u-boot display management. It should display
>>> the ST microelectronics logo but "noise" is displayed (like when running
>>> the command dd if=/dev/urandom of=/dev/fb0 in Linux). I also tried to
>>> change version (even the first version in which this feature was
>>> introduced), but without success. Despite this I decided not to disable
>>> the video management configuration to remind us that it needs to be
>>> fixed :).
>>> 
>>> Link: https://www.st.com/en/evaluation-tools/32f769idiscovery.html
>>> Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
>>> ---
>>>  DEVELOPERS                                    |  2 ++
>>>  .../stm32f769-disco/extlinux.conf             |  4 +++
>>>  .../stm32f769-disco/flash_sd.sh               | 18 +++++++++++
>>>  .../stm32f769-disco/genimage.cfg              | 27 ++++++++++++++++
>>>  .../stm32f769-disco/linux-sd.fragment         |  1 +
>>>  .../stm32f769-disco/post-build.sh             |  7 ++++
>>>  .../stm32f769-disco/readme.txt                | 32 +++++++++++++++++++
>>>  configs/stm32f769_disco_sd_defconfig          | 30 +++++++++++++++++
>>>  8 files changed, 121 insertions(+)
>>>  create mode 100644 board/stmicroelectronics/stm32f769-disco/extlinux.conf
>>>  create mode 100755 board/stmicroelectronics/stm32f769-disco/flash_sd.sh
>>>  create mode 100644 board/stmicroelectronics/stm32f769-disco/genimage.cfg
>>>  create mode 100644 board/stmicroelectronics/stm32f769-disco/linux-sd.fragment
>>>  create mode 100755 board/stmicroelectronics/stm32f769-disco/post-build.sh
>>>  create mode 100644 board/stmicroelectronics/stm32f769-disco/readme.txt
>>>  create mode 100644 configs/stm32f769_disco_sd_defconfig
>>> 
>>> diff --git a/DEVELOPERS b/DEVELOPERS
>>> index 5cd882b5791c..88ed40412ae8 100644
>>> --- a/DEVELOPERS
>>> +++ b/DEVELOPERS
>>> @@ -702,8 +702,10 @@ F:       package/xinetd/
>>> 
>>>  N:  Dario Binacchi <dario.binacchi@amarulasolutions.com>
>>>  F:  board/bsh/
>>> +F:   board/stmicroelectronics/stm32f769-disco/
>>>  F:  configs/imx8mn_bsh_smm_s2_defconfig
>>>  F:  configs/imx8mn_bsh_smm_s2_pro_defconfig
>>> +F:   configs/stm32f769_disco_sd_defconfig
>>>  F:  package/sscep/
>>>  F:  package/uuu/
>>> 
>>> diff --git a/board/stmicroelectronics/stm32f769-disco/extlinux.conf b/board/stmicroelectronics/stm32f769-disco/extlinux.conf
>>> new file mode 100644
>>> index 000000000000..48483a01fc4e
>>> --- /dev/null
>>> +++ b/board/stmicroelectronics/stm32f769-disco/extlinux.conf
>>> @@ -0,0 +1,4 @@
>>> +label stm32f769-disco-buildroot
>>> +  kernel /zImage
>>> +  devicetree /stm32f769-disco.dtb
>>> +  append console=ttySTM0,115200 root=/dev/mmcblk0p2 rw rootfstype=ext2 rootwait earlyprintk consoleblank=0 ignore_loglevel
>>> diff --git a/board/stmicroelectronics/stm32f769-disco/flash_sd.sh b/board/stmicroelectronics/stm32f769-disco/flash_sd.sh
>>> new file mode 100755
>>> index 000000000000..0ff3ae7dbfb3
>>> --- /dev/null
>>> +++ b/board/stmicroelectronics/stm32f769-disco/flash_sd.sh
>>> @@ -0,0 +1,18 @@
>>> +#!/bin/bash
>>> +
>>> +OUTPUT_DIR=$1
>>> +
>>> +if ! test -d "${OUTPUT_DIR}" ; then
>>> +    echo "ERROR: no output directory specified."
>>> +    echo "Usage: $0 OUTPUT_DIR"
>>> +    exit 1
>>> +fi
>>> +
>>> +"${OUTPUT_DIR}"/host/bin/openocd -f board/stm32f769i-disco.cfg \
>>> +  -c "init" \
>>> +  -c "reset init" \
>>> +  -c "flash probe 0" \
>>> +  -c "flash info 0" \
>>> +  -c "flash write_image erase ${OUTPUT_DIR}/images/u-boot.bin 0x08000000" \
>>> +  -c "reset run" \
>>> +  -c "shutdown"
>>> diff --git a/board/stmicroelectronics/stm32f769-disco/genimage.cfg b/board/stmicroelectronics/stm32f769-disco/genimage.cfg
>>> new file mode 100644
>>> index 000000000000..41f9da512489
>>> --- /dev/null
>>> +++ b/board/stmicroelectronics/stm32f769-disco/genimage.cfg
>>> @@ -0,0 +1,27 @@
>>> +image boot.vfat {
>>> +     vfat {
>>> +             files = {
>>> +                     "zImage",
>>> +                     "stm32f769-disco.dtb",
>>> +                     "extlinux"
>>> +             }
>>> +     }
>>> +
>>> +     size = 16M
>>> +}
>>> +
>>> +image sdcard.img {
>>> +     hdimage {
>>> +     }
>>> +
>>> +     partition u-boot {
>>> +             partition-type = 0xC
>>> +             image = "boot.vfat"
>>> +     }
>>> +
>>> +     partition rootfs {
>>> +             partition-type = 0x83
>>> +             image = "rootfs.ext2"
>>> +             size = 32M
>>> +     }
>>> +}
>>> diff --git a/board/stmicroelectronics/stm32f769-disco/linux-sd.fragment b/board/stmicroelectronics/stm32f769-disco/linux-sd.fragment
>>> new file mode 100644
>>> index 000000000000..846229d0d468
>>> --- /dev/null
>>> +++ b/board/stmicroelectronics/stm32f769-disco/linux-sd.fragment
>>> @@ -0,0 +1 @@
>>> +# CONFIG_XIP_KERNEL is not set
>>> diff --git a/board/stmicroelectronics/stm32f769-disco/post-build.sh b/board/stmicroelectronics/stm32f769-disco/post-build.sh
>>> new file mode 100755
>>> index 000000000000..c8cca3de8c9b
>>> --- /dev/null
>>> +++ b/board/stmicroelectronics/stm32f769-disco/post-build.sh
>>> @@ -0,0 +1,7 @@
>>> +#!/bin/sh
>>> +BOARD_DIR="$(dirname "$0")"
>>> +
>>> +# Kernel is built without devpts support
>>> +sed -i '/^devpts/d' "${TARGET_DIR}"/etc/fstab
>>> +
>>> +install -m 0644 -D "${BOARD_DIR}"/extlinux.conf "${BINARIES_DIR}"/extlinux/extlinux.conf
>>> diff --git a/board/stmicroelectronics/stm32f769-disco/readme.txt b/board/stmicroelectronics/stm32f769-disco/readme.txt
>>> new file mode 100644
>>> index 000000000000..8f4f79a86138
>>> --- /dev/null
>>> +++ b/board/stmicroelectronics/stm32f769-disco/readme.txt
>>> @@ -0,0 +1,32 @@
>>> +STM32F769 Discovery
>>> +===================
>>> +
>>> +This tutorial describes how to use the predefined Buildroot
>>> +configuration for the STM32F769 Discovery evaluation platform.
>>> +
>>> +Building
>>> +--------
>>> +
>>> +  make stm32f769_disco_sd_defconfig
>>> +  make
>>> +
>>> +Flashing
>>> +--------
>>> +
>>> +  ./board/stmicroelectronics/stm32f769-disco/flash_sd.sh output/
>>> +
>>> +It will flash the U-boot bootloader.
>>> +
>>> +Creating SD card
>>> +----------------
>>> +
>>> +Buildroot prepares an"sdcard.img" image in the output/images/ directory,
>>> +ready to be dumped on a SD card. Launch the following command as root:
>>> +
>>> +  dd if=output/images/sdcard.img of=/dev/<your-sd-device>
>>> +
>>> +*** WARNING! This will destroy all the card content. Use with care! ***
>>> +
>>> +For details about the medium image layout and its content, see the
>>> +definition in board/stmicroelectronics/stm32f769-disco/genimage.cfg.
>>> +
>>> diff --git a/configs/stm32f769_disco_sd_defconfig b/configs/stm32f769_disco_sd_defconfig
>>> new file mode 100644
>>> index 000000000000..4d43658403ca
>>> --- /dev/null
>>> +++ b/configs/stm32f769_disco_sd_defconfig
>>> @@ -0,0 +1,30 @@
>>> +BR2_arm=y
>>> +BR2_cortex_m4=y
>> 
>> Here ^^^ it is a BR2_cortex_m7
> 
> Yes,  you are right
> 
>> 
>>> +BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_14=y
>>> +BR2_ROOTFS_POST_BUILD_SCRIPT="board/stmicroelectronics/stm32f769-disco/post-build.sh"
>>> +BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh"
>>> +BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/stmicroelectronics/stm32f769-disco/genimage.cfg"
>>> +BR2_LINUX_KERNEL=y
>>> +BR2_LINUX_KERNEL_CUSTOM_VERSION=y
>>> +BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.14.21"
>> 
>> It would be great if you could use Linux latest stable 5.15.108 that has
>> patch for MMU-less fix committed[0]. I've found and fixed the bug on
>> i.MXRT but it should affect every MMU-less system.
> 
> thanks for the info
> 
>> Or you could bump Linux to latest version 6.2 that has the patch
>> committed too.
> 
> I will try with 5.15.108. Each new kernel version generally leads to
> occupying more memory and this is then reflected in some cases
> on applications to be launched in user space that become unstable
> (or at least it seems to me to be so).

You’re right about the size, but your experience as user space instability is normally due to bug on
mmu-less arm support that is few tested compared to mmu arm.
The bug I’ve found showed up during rootfs ext4 mount so it was easy to reproduce.
It dealt exactly with memory page translation to mmu-less.
So maybe what you see as instability could be fixed by my patch.

> So, for now I prefer to bump to
> 5.15.108.

Sure. Could you also try to fill the memory and see if everything works correctly?
You could try to start many instances of a program until you fill the memory and see that everything is working ok(I hope).

Thank you
Best regards
Giulio

> 
> Thanks and regards,
> Dario
> 
>> 
>> This could be done also for the stm32f4xx boards you're bumping for
>> uboot.
>> 
>> [0]:
>> https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=linux-5.15.y&id=7ae0262748e5d8ff1e42b77bb19bba474733f280
>> 
>> Best regards
>> --
>> Giulio Benetti
>> Benetti Engineering sas
>> 
>>> +BR2_LINUX_KERNEL_DEFCONFIG="stm32"
>>> +BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="$(LINUX_DIR)/arch/arm/configs/dram_0xc0000000.config board/stmicroelectronics/stm32f769-disco/linux-sd.fragment"
>>> +BR2_LINUX_KERNEL_IMAGE_TARGET_CUSTOM=y
>>> +BR2_LINUX_KERNEL_IMAGE_TARGET_NAME="zImage"
>>> +BR2_LINUX_KERNEL_DTS_SUPPORT=y
>>> +BR2_LINUX_KERNEL_INTREE_DTS_NAME="stm32f769-disco"
>>> +BR2_PACKAGE_BUSYBOX_CONFIG="package/busybox/busybox-minimal.config"
>>> +# BR2_PACKAGE_IFUPDOWN_SCRIPTS is not set
>>> +BR2_TARGET_ROOTFS_EXT2=y
>>> +BR2_TARGET_ROOTFS_EXT2_SIZE="32M"
>>> +# BR2_TARGET_ROOTFS_TAR is not set
>>> +BR2_TARGET_UBOOT=y
>>> +BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y
>>> +BR2_TARGET_UBOOT_CUSTOM_VERSION=y
>>> +BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2023.04"
>>> +BR2_TARGET_UBOOT_BOARD_DEFCONFIG="stm32f769-disco"
>>> +BR2_TARGET_UBOOT_NEEDS_OPENSSL=y
>>> +BR2_PACKAGE_HOST_DOSFSTOOLS=y
>>> +BR2_PACKAGE_HOST_GENIMAGE=y
>>> +BR2_PACKAGE_HOST_MTOOLS=y
>>> +BR2_PACKAGE_HOST_OPENOCD=y
>> 
> 
> 
> -- 
> 
> Dario Binacchi
> 
> Senior Embedded Linux Developer
> 
> dario.binacchi@amarulasolutions.com
> 
> __________________________________
> 
> 
> Amarula Solutions SRL
> 
> Via Le Canevare 30, 31100 Treviso, Veneto, IT
> 
> T. +39 042 243 5310
> info@amarulasolutions.com
> 
> www.amarulasolutions.com

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Buildroot] [PATCH 1/1] configs/stm32f769_disco_sd_defconfig: new defconfig
  2023-04-22 16:56 ` [Buildroot] [PATCH 1/1] configs/stm32f769_disco_sd_defconfig: new defconfig Giulio Benetti
@ 2023-04-23 17:20   ` Dario Binacchi
  2023-04-23 20:31     ` Giulio Benetti
  0 siblings, 1 reply; 8+ messages in thread
From: Dario Binacchi @ 2023-04-23 17:20 UTC (permalink / raw)
  To: Giulio Benetti; +Cc: buildroot

Hi Giulio,

On Sat, Apr 22, 2023 at 6:56 PM Giulio Benetti
<giulio.benetti@benettiengineering.com> wrote:
>
> Hi Dario,
>
> I readd the mailing list in Cc,
>
> > Il giorno 22 apr 2023, alle ore 18:33, Dario Binacchi <dario.binacchi@amarulasolutions.com> ha scritto:
> >
> > Hi Giulio,
> >
> >> On Sat, Apr 22, 2023 at 4:56 PM Giulio Benetti
> >> <giulio.benetti@benettiengineering.com> wrote:
> >>
> >> Hi Dario,
> >>
> >>> On 22/04/23 16:00, Dario Binacchi wrote:
> >>> Board support package includes the following components:
> >>> - mainline Linux kernel 5.14.21
> >>> - mainline U-Boot 2023.04
> >>> - default packages from buildroot
> >>>
> >>> Note: There is a problem in u-boot display management. It should display
> >>> the ST microelectronics logo but "noise" is displayed (like when running
> >>> the command dd if=/dev/urandom of=/dev/fb0 in Linux). I also tried to
> >>> change version (even the first version in which this feature was
> >>> introduced), but without success. Despite this I decided not to disable
> >>> the video management configuration to remind us that it needs to be
> >>> fixed :).
> >>>
> >>> Link: https://www.st.com/en/evaluation-tools/32f769idiscovery.html
> >>> Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
> >>> ---
> >>>  DEVELOPERS                                    |  2 ++
> >>>  .../stm32f769-disco/extlinux.conf             |  4 +++
> >>>  .../stm32f769-disco/flash_sd.sh               | 18 +++++++++++
> >>>  .../stm32f769-disco/genimage.cfg              | 27 ++++++++++++++++
> >>>  .../stm32f769-disco/linux-sd.fragment         |  1 +
> >>>  .../stm32f769-disco/post-build.sh             |  7 ++++
> >>>  .../stm32f769-disco/readme.txt                | 32 +++++++++++++++++++
> >>>  configs/stm32f769_disco_sd_defconfig          | 30 +++++++++++++++++
> >>>  8 files changed, 121 insertions(+)
> >>>  create mode 100644 board/stmicroelectronics/stm32f769-disco/extlinux.conf
> >>>  create mode 100755 board/stmicroelectronics/stm32f769-disco/flash_sd.sh
> >>>  create mode 100644 board/stmicroelectronics/stm32f769-disco/genimage.cfg
> >>>  create mode 100644 board/stmicroelectronics/stm32f769-disco/linux-sd.fragment
> >>>  create mode 100755 board/stmicroelectronics/stm32f769-disco/post-build.sh
> >>>  create mode 100644 board/stmicroelectronics/stm32f769-disco/readme.txt
> >>>  create mode 100644 configs/stm32f769_disco_sd_defconfig
> >>>
> >>> diff --git a/DEVELOPERS b/DEVELOPERS
> >>> index 5cd882b5791c..88ed40412ae8 100644
> >>> --- a/DEVELOPERS
> >>> +++ b/DEVELOPERS
> >>> @@ -702,8 +702,10 @@ F:       package/xinetd/
> >>>
> >>>  N:  Dario Binacchi <dario.binacchi@amarulasolutions.com>
> >>>  F:  board/bsh/
> >>> +F:   board/stmicroelectronics/stm32f769-disco/
> >>>  F:  configs/imx8mn_bsh_smm_s2_defconfig
> >>>  F:  configs/imx8mn_bsh_smm_s2_pro_defconfig
> >>> +F:   configs/stm32f769_disco_sd_defconfig
> >>>  F:  package/sscep/
> >>>  F:  package/uuu/
> >>>
> >>> diff --git a/board/stmicroelectronics/stm32f769-disco/extlinux.conf b/board/stmicroelectronics/stm32f769-disco/extlinux.conf
> >>> new file mode 100644
> >>> index 000000000000..48483a01fc4e
> >>> --- /dev/null
> >>> +++ b/board/stmicroelectronics/stm32f769-disco/extlinux.conf
> >>> @@ -0,0 +1,4 @@
> >>> +label stm32f769-disco-buildroot
> >>> +  kernel /zImage
> >>> +  devicetree /stm32f769-disco.dtb
> >>> +  append console=ttySTM0,115200 root=/dev/mmcblk0p2 rw rootfstype=ext2 rootwait earlyprintk consoleblank=0 ignore_loglevel
> >>> diff --git a/board/stmicroelectronics/stm32f769-disco/flash_sd.sh b/board/stmicroelectronics/stm32f769-disco/flash_sd.sh
> >>> new file mode 100755
> >>> index 000000000000..0ff3ae7dbfb3
> >>> --- /dev/null
> >>> +++ b/board/stmicroelectronics/stm32f769-disco/flash_sd.sh
> >>> @@ -0,0 +1,18 @@
> >>> +#!/bin/bash
> >>> +
> >>> +OUTPUT_DIR=$1
> >>> +
> >>> +if ! test -d "${OUTPUT_DIR}" ; then
> >>> +    echo "ERROR: no output directory specified."
> >>> +    echo "Usage: $0 OUTPUT_DIR"
> >>> +    exit 1
> >>> +fi
> >>> +
> >>> +"${OUTPUT_DIR}"/host/bin/openocd -f board/stm32f769i-disco.cfg \
> >>> +  -c "init" \
> >>> +  -c "reset init" \
> >>> +  -c "flash probe 0" \
> >>> +  -c "flash info 0" \
> >>> +  -c "flash write_image erase ${OUTPUT_DIR}/images/u-boot.bin 0x08000000" \
> >>> +  -c "reset run" \
> >>> +  -c "shutdown"
> >>> diff --git a/board/stmicroelectronics/stm32f769-disco/genimage.cfg b/board/stmicroelectronics/stm32f769-disco/genimage.cfg
> >>> new file mode 100644
> >>> index 000000000000..41f9da512489
> >>> --- /dev/null
> >>> +++ b/board/stmicroelectronics/stm32f769-disco/genimage.cfg
> >>> @@ -0,0 +1,27 @@
> >>> +image boot.vfat {
> >>> +     vfat {
> >>> +             files = {
> >>> +                     "zImage",
> >>> +                     "stm32f769-disco.dtb",
> >>> +                     "extlinux"
> >>> +             }
> >>> +     }
> >>> +
> >>> +     size = 16M
> >>> +}
> >>> +
> >>> +image sdcard.img {
> >>> +     hdimage {
> >>> +     }
> >>> +
> >>> +     partition u-boot {
> >>> +             partition-type = 0xC
> >>> +             image = "boot.vfat"
> >>> +     }
> >>> +
> >>> +     partition rootfs {
> >>> +             partition-type = 0x83
> >>> +             image = "rootfs.ext2"
> >>> +             size = 32M
> >>> +     }
> >>> +}
> >>> diff --git a/board/stmicroelectronics/stm32f769-disco/linux-sd.fragment b/board/stmicroelectronics/stm32f769-disco/linux-sd.fragment
> >>> new file mode 100644
> >>> index 000000000000..846229d0d468
> >>> --- /dev/null
> >>> +++ b/board/stmicroelectronics/stm32f769-disco/linux-sd.fragment
> >>> @@ -0,0 +1 @@
> >>> +# CONFIG_XIP_KERNEL is not set
> >>> diff --git a/board/stmicroelectronics/stm32f769-disco/post-build.sh b/board/stmicroelectronics/stm32f769-disco/post-build.sh
> >>> new file mode 100755
> >>> index 000000000000..c8cca3de8c9b
> >>> --- /dev/null
> >>> +++ b/board/stmicroelectronics/stm32f769-disco/post-build.sh
> >>> @@ -0,0 +1,7 @@
> >>> +#!/bin/sh
> >>> +BOARD_DIR="$(dirname "$0")"
> >>> +
> >>> +# Kernel is built without devpts support
> >>> +sed -i '/^devpts/d' "${TARGET_DIR}"/etc/fstab
> >>> +
> >>> +install -m 0644 -D "${BOARD_DIR}"/extlinux.conf "${BINARIES_DIR}"/extlinux/extlinux.conf
> >>> diff --git a/board/stmicroelectronics/stm32f769-disco/readme.txt b/board/stmicroelectronics/stm32f769-disco/readme.txt
> >>> new file mode 100644
> >>> index 000000000000..8f4f79a86138
> >>> --- /dev/null
> >>> +++ b/board/stmicroelectronics/stm32f769-disco/readme.txt
> >>> @@ -0,0 +1,32 @@
> >>> +STM32F769 Discovery
> >>> +===================
> >>> +
> >>> +This tutorial describes how to use the predefined Buildroot
> >>> +configuration for the STM32F769 Discovery evaluation platform.
> >>> +
> >>> +Building
> >>> +--------
> >>> +
> >>> +  make stm32f769_disco_sd_defconfig
> >>> +  make
> >>> +
> >>> +Flashing
> >>> +--------
> >>> +
> >>> +  ./board/stmicroelectronics/stm32f769-disco/flash_sd.sh output/
> >>> +
> >>> +It will flash the U-boot bootloader.
> >>> +
> >>> +Creating SD card
> >>> +----------------
> >>> +
> >>> +Buildroot prepares an"sdcard.img" image in the output/images/ directory,
> >>> +ready to be dumped on a SD card. Launch the following command as root:
> >>> +
> >>> +  dd if=output/images/sdcard.img of=/dev/<your-sd-device>
> >>> +
> >>> +*** WARNING! This will destroy all the card content. Use with care! ***
> >>> +
> >>> +For details about the medium image layout and its content, see the
> >>> +definition in board/stmicroelectronics/stm32f769-disco/genimage.cfg.
> >>> +
> >>> diff --git a/configs/stm32f769_disco_sd_defconfig b/configs/stm32f769_disco_sd_defconfig
> >>> new file mode 100644
> >>> index 000000000000..4d43658403ca
> >>> --- /dev/null
> >>> +++ b/configs/stm32f769_disco_sd_defconfig
> >>> @@ -0,0 +1,30 @@
> >>> +BR2_arm=y
> >>> +BR2_cortex_m4=y
> >>
> >> Here ^^^ it is a BR2_cortex_m7
> >
> > Yes,  you are right
> >
> >>
> >>> +BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_14=y
> >>> +BR2_ROOTFS_POST_BUILD_SCRIPT="board/stmicroelectronics/stm32f769-disco/post-build.sh"
> >>> +BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh"
> >>> +BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/stmicroelectronics/stm32f769-disco/genimage.cfg"
> >>> +BR2_LINUX_KERNEL=y
> >>> +BR2_LINUX_KERNEL_CUSTOM_VERSION=y
> >>> +BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.14.21"
> >>
> >> It would be great if you could use Linux latest stable 5.15.108 that has
> >> patch for MMU-less fix committed[0]. I've found and fixed the bug on
> >> i.MXRT but it should affect every MMU-less system.
> >
> > thanks for the info
> >
> >> Or you could bump Linux to latest version 6.2 that has the patch
> >> committed too.
> >
> > I will try with 5.15.108. Each new kernel version generally leads to
> > occupying more memory and this is then reflected in some cases
> > on applications to be launched in user space that become unstable
> > (or at least it seems to me to be so).
>
> You’re right about the size, but your experience as user space instability is normally due to bug on
> mmu-less arm support that is few tested compared to mmu arm.
> The bug I’ve found showed up during rootfs ext4 mount so it was easy to reproduce.
> It dealt exactly with memory page translation to mmu-less.
> So maybe what you see as instability could be fixed by my patch.
>
> > So, for now I prefer to bump to
> > 5.15.108.
>
> Sure. Could you also try to fill the memory and see if everything works correctly?
> You could try to start many instances of a program until you fill the memory and see that everything is working ok(I hope).


I just uploaded version 2 with your suggested changes. I did some
tests with can applications (candump, cansend, ...) and had
no problems.
But for example, running the ifconfig application, the second time I
got this error:

~ # candump can2 -L &
[18] 81 candump can2 -L
~ # ifconfig
Segmentation fault
~ # [  193.040912] warn_alloc: 1 callbacks suppressed
[  193.040970] ifconfig: page allocation failure: order:7,
mode:0xcc0(GFP_KERNEL), nodemask=(null)
[  193.041056] CPU: 0 PID: 82 Comm: ifconfig Not tainted 5.19.0-rc2 #8
[  193.041110] Hardware name: STM32 (Device Tree Support)
[  193.041147]  unwind_backtrace from show_stack+0xb/0xc
[  193.041252]  show_stack from dump_stack_lvl+0x19/0x1e
[  193.041347]  dump_stack_lvl from warn_alloc+0x61/0xe8
[  193.041434]  warn_alloc from __alloc_pages+0x36f/0x57e
[  193.041511]  __alloc_pages from __get_free_pages+0xf/0x24
[  193.041583]  __get_free_pages from alloc_pages_exact+0x45/0x5c
[  193.041656]  alloc_pages_exact from do_mmap+0x491/0x556
[  193.041752]  do_mmap from vm_mmap_pgoff+0x53/0x84
[  193.041858]  vm_mmap_pgoff from load_flat_binary+0x501/0x690
[  193.041960]  load_flat_binary from bprm_execve+0x1f5/0x2f4
[  193.042044]  bprm_execve from do_execveat_common+0x10f/0x12c
[  193.042119]  do_execveat_common from sys_execve+0x1d/0x20
[  193.042195]  sys_execve from ret_fast_syscall+0x1/0x4c
[  193.042262] Exception stack(0xc0ddbfa8 to 0xc0ddbff0)
[  193.042324] bfa0:                   c0e6eff0 c0e68fa7 c0e6eff0
c0c6e420 c0c6e028 0000000b
[  193.042389] bfc0: c0e6eff0 c0e68fa7 c0e68b88 0000000b c0e6eff6
00000ff6 c0e626f4 00000000
[  193.042438] bfe0: 6962732f c0e68b88 c0e0f7df c0e15db4
[  193.042873] Mem-Info:
[  193.042910] active_anon:0 inactive_anon:0 isolated_anon:0
[  193.042910]  active_file:0 inactive_file:18 isolated_file:0
[  193.042910]  unevictable:5 dirty:0 writeback:4
[  193.042910]  slab_reclaimable:281 slab_unreclaimable:511
[  193.042910]  mapped:0 shmem:0 pagetables:0 bounce:0
[  193.042910]  kernel_misc_reclaimable:0
[  193.042910]  free:1426 free_pcp:0 free_cma:0
[  193.043049] Node 0 active_anon:0kB inactive_anon:0kB
active_file:0kB inactive_file:72kB unevictable:20kB isolated(anon):0kB
isolated(file):0kB mapped:0kB dirty:0kB writeback:16kB shmem:0kB
writeback_tmp:0kB kernel_stack:400kB pagetables:0kB all_unreclaimable?
no
[  193.043162] Normal free:5704kB boost:0kB min:444kB low:552kB
high:660kB reserved_highatomic:0KB active_anon:0kB inactive_anon:0kB
active_file:0kB inactive_file:72kB unevictable:20kB writepending:16kB
present:16384kB managed:12544kB mlocked:0kB bounce:0kB free_pcp:0kB
local_pcp:0kB free_cma:0kB
[  193.043295] lowmem_reserve[]: 0 0
[  193.043352] Normal: 22*4kB (UM) 32*8kB (UM) 23*16kB (UM) 20*32kB
(UM) 20*64kB (UM) 0*128kB 12*256kB (UM) 0*512kB 0*1024kB 0*2048kB
0*4096kB = 5704kB
[  193.043729] 23 total pagecache pages
[  193.043748] 4096 pages RAM
[  193.043765] 0 pages HighMem/MovableOnly
[  193.043783] 960 pages reserved
[  193.043805] nommu: Allocation of length 430080 from process 82
(ifconfig) failed
[  193.043843] active_anon:0 inactive_anon:0 isolated_anon:0
[  193.043843]  active_file:0 inactive_file:18 isolated_file:0
[  193.043843]  unevictable:5 dirty:0 writeback:4
[  193.043843]  slab_reclaimable:281 slab_unreclaimable:511
[  193.043843]  mapped:0 shmem:0 pagetables:0 bounce:0
[  193.043843]  kernel_misc_reclaimable:0
[  193.043843]  free:1426 free_pcp:0 free_cma:0
[  193.043965] Node 0 active_anon:0kB inactive_anon:0kB
active_file:0kB inactive_file:72kB unevictable:20kB isolated(anon):0kB
isolated(file):0kB mapped:0kB dirty:0kB writeback:16kB shmem:0kB
writeback_tmp:0kB kernel_stack:400kB pagetables:0kB all_unreclaimable?
no
[  193.044073] Normal free:5704kB boost:0kB min:444kB low:552kB
high:660kB reserved_highatomic:0KB active_anon:0kB inactive_anon:0kB
active_file:0kB inactive_file:72kB unevictable:20kB writepending:16kB
present:16384kB managed:12544kB mlocked:0kB bounce:0kB free_pcp:0kB
local_pcp:0kB free_cma:0kB
[  193.044206] lowmem_reserve[]: 0 0
[  193.044260] Normal: 22*4kB (UM) 32*8kB (UM) 23*16kB (UM) 20*32kB
(UM) 20*64kB (UM) 0*128kB 12*256kB (UM) 0*512kB 0*1024kB 0*2048kB
0*4096kB = 5704kB
[  193.044638] 23 total pagecache pages
[  193.044670] binfmt_flat: Unable to allocate RAM for process
text/data, errno -12

Was it similar to your problem?

Thanks and regards,
Dario


>
> Thank you
> Best regards
> Giulio
>
> >
> > Thanks and regards,
> > Dario
> >
> >>
> >> This could be done also for the stm32f4xx boards you're bumping for
> >> uboot.
> >>
> >> [0]:
> >> https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=linux-5.15.y&id=7ae0262748e5d8ff1e42b77bb19bba474733f280
> >>
> >> Best regards
> >> --
> >> Giulio Benetti
> >> Benetti Engineering sas
> >>
> >>> +BR2_LINUX_KERNEL_DEFCONFIG="stm32"
> >>> +BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="$(LINUX_DIR)/arch/arm/configs/dram_0xc0000000.config board/stmicroelectronics/stm32f769-disco/linux-sd.fragment"
> >>> +BR2_LINUX_KERNEL_IMAGE_TARGET_CUSTOM=y
> >>> +BR2_LINUX_KERNEL_IMAGE_TARGET_NAME="zImage"
> >>> +BR2_LINUX_KERNEL_DTS_SUPPORT=y
> >>> +BR2_LINUX_KERNEL_INTREE_DTS_NAME="stm32f769-disco"
> >>> +BR2_PACKAGE_BUSYBOX_CONFIG="package/busybox/busybox-minimal.config"
> >>> +# BR2_PACKAGE_IFUPDOWN_SCRIPTS is not set
> >>> +BR2_TARGET_ROOTFS_EXT2=y
> >>> +BR2_TARGET_ROOTFS_EXT2_SIZE="32M"
> >>> +# BR2_TARGET_ROOTFS_TAR is not set
> >>> +BR2_TARGET_UBOOT=y
> >>> +BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y
> >>> +BR2_TARGET_UBOOT_CUSTOM_VERSION=y
> >>> +BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2023.04"
> >>> +BR2_TARGET_UBOOT_BOARD_DEFCONFIG="stm32f769-disco"
> >>> +BR2_TARGET_UBOOT_NEEDS_OPENSSL=y
> >>> +BR2_PACKAGE_HOST_DOSFSTOOLS=y
> >>> +BR2_PACKAGE_HOST_GENIMAGE=y
> >>> +BR2_PACKAGE_HOST_MTOOLS=y
> >>> +BR2_PACKAGE_HOST_OPENOCD=y
> >>
> >
> >
> > --
> >
> > Dario Binacchi
> >
> > Senior Embedded Linux Developer
> >
> > dario.binacchi@amarulasolutions.com
> >
> > __________________________________
> >
> >
> > Amarula Solutions SRL
> >
> > Via Le Canevare 30, 31100 Treviso, Veneto, IT
> >
> > T. +39 042 243 5310
> > info@amarulasolutions.com
> >
> > www.amarulasolutions.com
>


-- 

Dario Binacchi

Senior Embedded Linux Developer

dario.binacchi@amarulasolutions.com

__________________________________


Amarula Solutions SRL

Via Le Canevare 30, 31100 Treviso, Veneto, IT

T. +39 042 243 5310
info@amarulasolutions.com

www.amarulasolutions.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Buildroot] [PATCH 1/1] configs/stm32f769_disco_sd_defconfig: new defconfig
  2023-04-23 17:20   ` Dario Binacchi
@ 2023-04-23 20:31     ` Giulio Benetti
  2023-04-25 19:50       ` Dario Binacchi
  0 siblings, 1 reply; 8+ messages in thread
From: Giulio Benetti @ 2023-04-23 20:31 UTC (permalink / raw)
  To: Dario Binacchi; +Cc: buildroot

Hi Dario,

On 23/04/23 19:20, Dario Binacchi wrote:
[ SNIP ]

>>
>> Sure. Could you also try to fill the memory and see if everything works correctly?
>> You could try to start many instances of a program until you fill the memory and see that everything is working ok(I hope).
> 
> 
> I just uploaded version 2 with your suggested changes. I did some
> tests with can applications (candump, cansend, ...) and had
> no problems.
> But for example, running the ifconfig application, the second time I
> got this error:
> 
> ~ # candump can2 -L &
> [18] 81 candump can2 -L
> ~ # ifconfig
> Segmentation fault
> ~ # [  193.040912] warn_alloc: 1 callbacks suppressed
> [  193.040970] ifconfig: page allocation failure: order:7,
> mode:0xcc0(GFP_KERNEL), nodemask=(null)
> [  193.041056] CPU: 0 PID: 82 Comm: ifconfig Not tainted 5.19.0-rc2 #8
> [  193.041110] Hardware name: STM32 (Device Tree Support)
> [  193.041147]  unwind_backtrace from show_stack+0xb/0xc
> [  193.041252]  show_stack from dump_stack_lvl+0x19/0x1e
> [  193.041347]  dump_stack_lvl from warn_alloc+0x61/0xe8
> [  193.041434]  warn_alloc from __alloc_pages+0x36f/0x57e
> [  193.041511]  __alloc_pages from __get_free_pages+0xf/0x24
> [  193.041583]  __get_free_pages from alloc_pages_exact+0x45/0x5c
> [  193.041656]  alloc_pages_exact from do_mmap+0x491/0x556
> [  193.041752]  do_mmap from vm_mmap_pgoff+0x53/0x84
> [  193.041858]  vm_mmap_pgoff from load_flat_binary+0x501/0x690
> [  193.041960]  load_flat_binary from bprm_execve+0x1f5/0x2f4
> [  193.042044]  bprm_execve from do_execveat_common+0x10f/0x12c
> [  193.042119]  do_execveat_common from sys_execve+0x1d/0x20
> [  193.042195]  sys_execve from ret_fast_syscall+0x1/0x4c
> [  193.042262] Exception stack(0xc0ddbfa8 to 0xc0ddbff0)
> [  193.042324] bfa0:                   c0e6eff0 c0e68fa7 c0e6eff0
> c0c6e420 c0c6e028 0000000b
> [  193.042389] bfc0: c0e6eff0 c0e68fa7 c0e68b88 0000000b c0e6eff6
> 00000ff6 c0e626f4 00000000
> [  193.042438] bfe0: 6962732f c0e68b88 c0e0f7df c0e15db4
> [  193.042873] Mem-Info:
> [  193.042910] active_anon:0 inactive_anon:0 isolated_anon:0
> [  193.042910]  active_file:0 inactive_file:18 isolated_file:0
> [  193.042910]  unevictable:5 dirty:0 writeback:4
> [  193.042910]  slab_reclaimable:281 slab_unreclaimable:511
> [  193.042910]  mapped:0 shmem:0 pagetables:0 bounce:0
> [  193.042910]  kernel_misc_reclaimable:0
> [  193.042910]  free:1426 free_pcp:0 free_cma:0
> [  193.043049] Node 0 active_anon:0kB inactive_anon:0kB
> active_file:0kB inactive_file:72kB unevictable:20kB isolated(anon):0kB
> isolated(file):0kB mapped:0kB dirty:0kB writeback:16kB shmem:0kB
> writeback_tmp:0kB kernel_stack:400kB pagetables:0kB all_unreclaimable?
> no
> [  193.043162] Normal free:5704kB boost:0kB min:444kB low:552kB
> high:660kB reserved_highatomic:0KB active_anon:0kB inactive_anon:0kB
> active_file:0kB inactive_file:72kB unevictable:20kB writepending:16kB
> present:16384kB managed:12544kB mlocked:0kB bounce:0kB free_pcp:0kB
> local_pcp:0kB free_cma:0kB
> [  193.043295] lowmem_reserve[]: 0 0
> [  193.043352] Normal: 22*4kB (UM) 32*8kB (UM) 23*16kB (UM) 20*32kB
> (UM) 20*64kB (UM) 0*128kB 12*256kB (UM) 0*512kB 0*1024kB 0*2048kB
> 0*4096kB = 5704kB
> [  193.043729] 23 total pagecache pages
> [  193.043748] 4096 pages RAM
> [  193.043765] 0 pages HighMem/MovableOnly
> [  193.043783] 960 pages reserved
> [  193.043805] nommu: Allocation of length 430080 from process 82
> (ifconfig) failed
> [  193.043843] active_anon:0 inactive_anon:0 isolated_anon:0
> [  193.043843]  active_file:0 inactive_file:18 isolated_file:0
> [  193.043843]  unevictable:5 dirty:0 writeback:4
> [  193.043843]  slab_reclaimable:281 slab_unreclaimable:511
> [  193.043843]  mapped:0 shmem:0 pagetables:0 bounce:0
> [  193.043843]  kernel_misc_reclaimable:0
> [  193.043843]  free:1426 free_pcp:0 free_cma:0
> [  193.043965] Node 0 active_anon:0kB inactive_anon:0kB
> active_file:0kB inactive_file:72kB unevictable:20kB isolated(anon):0kB
> isolated(file):0kB mapped:0kB dirty:0kB writeback:16kB shmem:0kB
> writeback_tmp:0kB kernel_stack:400kB pagetables:0kB all_unreclaimable?
> no
> [  193.044073] Normal free:5704kB boost:0kB min:444kB low:552kB
> high:660kB reserved_highatomic:0KB active_anon:0kB inactive_anon:0kB
> active_file:0kB inactive_file:72kB unevictable:20kB writepending:16kB
> present:16384kB managed:12544kB mlocked:0kB bounce:0kB free_pcp:0kB
> local_pcp:0kB free_cma:0kB
> [  193.044206] lowmem_reserve[]: 0 0
> [  193.044260] Normal: 22*4kB (UM) 32*8kB (UM) 23*16kB (UM) 20*32kB
> (UM) 20*64kB (UM) 0*128kB 12*256kB (UM) 0*512kB 0*1024kB 0*2048kB
> 0*4096kB = 5704kB
> [  193.044638] 23 total pagecache pages
> [  193.044670] binfmt_flat: Unable to allocate RAM for process
> text/data, errno -12
> 
> Was it similar to your problem?

Yes, this error could be caused by the bug I've fixed and I've seen
you've used Linux 5.19-rc2. In this version there is not my bugfix
and in general it should be avoided to use rc versions.

This is the patch that fixes ZERO_PAGE(0) that is dedicated to
massive "memset()" in the kernel, so it's used pretty often.
In my case it failed to allocate it, so since in your backtrace
there is try to allocate it could be fixed by my patch, also because
you have 5MB free and they look enough for ifconfig.

Can you give a try with 5.15.108 and repeat the same test please?
Otherwise I'd need to enter debug with this board but I don't have it
and this kind of bugs are subtle to catch and fix.

Thank you!

Best regards
-- 
Giulio Benetti
Benetti Engineering sas
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Buildroot] [PATCH 1/1] configs/stm32f769_disco_sd_defconfig: new defconfig
  2023-04-23 20:31     ` Giulio Benetti
@ 2023-04-25 19:50       ` Dario Binacchi
  2023-04-25 20:18         ` Giulio Benetti
  0 siblings, 1 reply; 8+ messages in thread
From: Dario Binacchi @ 2023-04-25 19:50 UTC (permalink / raw)
  To: Giulio Benetti; +Cc: buildroot

Hi Giulio,

On Sun, Apr 23, 2023 at 10:31 PM Giulio Benetti
<giulio.benetti@benettiengineering.com> wrote:
>
> Hi Dario,
>
> On 23/04/23 19:20, Dario Binacchi wrote:
> [ SNIP ]
>
> >>
> >> Sure. Could you also try to fill the memory and see if everything works correctly?
> >> You could try to start many instances of a program until you fill the memory and see that everything is working ok(I hope).
> >
> >
> > I just uploaded version 2 with your suggested changes. I did some
> > tests with can applications (candump, cansend, ...) and had
> > no problems.
> > But for example, running the ifconfig application, the second time I
> > got this error:
> >
> > ~ # candump can2 -L &
> > [18] 81 candump can2 -L
> > ~ # ifconfig
> > Segmentation fault
> > ~ # [  193.040912] warn_alloc: 1 callbacks suppressed
> > [  193.040970] ifconfig: page allocation failure: order:7,
> > mode:0xcc0(GFP_KERNEL), nodemask=(null)
> > [  193.041056] CPU: 0 PID: 82 Comm: ifconfig Not tainted 5.19.0-rc2 #8
> > [  193.041110] Hardware name: STM32 (Device Tree Support)
> > [  193.041147]  unwind_backtrace from show_stack+0xb/0xc
> > [  193.041252]  show_stack from dump_stack_lvl+0x19/0x1e
> > [  193.041347]  dump_stack_lvl from warn_alloc+0x61/0xe8
> > [  193.041434]  warn_alloc from __alloc_pages+0x36f/0x57e
> > [  193.041511]  __alloc_pages from __get_free_pages+0xf/0x24
> > [  193.041583]  __get_free_pages from alloc_pages_exact+0x45/0x5c
> > [  193.041656]  alloc_pages_exact from do_mmap+0x491/0x556
> > [  193.041752]  do_mmap from vm_mmap_pgoff+0x53/0x84
> > [  193.041858]  vm_mmap_pgoff from load_flat_binary+0x501/0x690
> > [  193.041960]  load_flat_binary from bprm_execve+0x1f5/0x2f4
> > [  193.042044]  bprm_execve from do_execveat_common+0x10f/0x12c
> > [  193.042119]  do_execveat_common from sys_execve+0x1d/0x20
> > [  193.042195]  sys_execve from ret_fast_syscall+0x1/0x4c
> > [  193.042262] Exception stack(0xc0ddbfa8 to 0xc0ddbff0)
> > [  193.042324] bfa0:                   c0e6eff0 c0e68fa7 c0e6eff0
> > c0c6e420 c0c6e028 0000000b
> > [  193.042389] bfc0: c0e6eff0 c0e68fa7 c0e68b88 0000000b c0e6eff6
> > 00000ff6 c0e626f4 00000000
> > [  193.042438] bfe0: 6962732f c0e68b88 c0e0f7df c0e15db4
> > [  193.042873] Mem-Info:
> > [  193.042910] active_anon:0 inactive_anon:0 isolated_anon:0
> > [  193.042910]  active_file:0 inactive_file:18 isolated_file:0
> > [  193.042910]  unevictable:5 dirty:0 writeback:4
> > [  193.042910]  slab_reclaimable:281 slab_unreclaimable:511
> > [  193.042910]  mapped:0 shmem:0 pagetables:0 bounce:0
> > [  193.042910]  kernel_misc_reclaimable:0
> > [  193.042910]  free:1426 free_pcp:0 free_cma:0
> > [  193.043049] Node 0 active_anon:0kB inactive_anon:0kB
> > active_file:0kB inactive_file:72kB unevictable:20kB isolated(anon):0kB
> > isolated(file):0kB mapped:0kB dirty:0kB writeback:16kB shmem:0kB
> > writeback_tmp:0kB kernel_stack:400kB pagetables:0kB all_unreclaimable?
> > no
> > [  193.043162] Normal free:5704kB boost:0kB min:444kB low:552kB
> > high:660kB reserved_highatomic:0KB active_anon:0kB inactive_anon:0kB
> > active_file:0kB inactive_file:72kB unevictable:20kB writepending:16kB
> > present:16384kB managed:12544kB mlocked:0kB bounce:0kB free_pcp:0kB
> > local_pcp:0kB free_cma:0kB
> > [  193.043295] lowmem_reserve[]: 0 0
> > [  193.043352] Normal: 22*4kB (UM) 32*8kB (UM) 23*16kB (UM) 20*32kB
> > (UM) 20*64kB (UM) 0*128kB 12*256kB (UM) 0*512kB 0*1024kB 0*2048kB
> > 0*4096kB = 5704kB
> > [  193.043729] 23 total pagecache pages
> > [  193.043748] 4096 pages RAM
> > [  193.043765] 0 pages HighMem/MovableOnly
> > [  193.043783] 960 pages reserved
> > [  193.043805] nommu: Allocation of length 430080 from process 82
> > (ifconfig) failed
> > [  193.043843] active_anon:0 inactive_anon:0 isolated_anon:0
> > [  193.043843]  active_file:0 inactive_file:18 isolated_file:0
> > [  193.043843]  unevictable:5 dirty:0 writeback:4
> > [  193.043843]  slab_reclaimable:281 slab_unreclaimable:511
> > [  193.043843]  mapped:0 shmem:0 pagetables:0 bounce:0
> > [  193.043843]  kernel_misc_reclaimable:0
> > [  193.043843]  free:1426 free_pcp:0 free_cma:0
> > [  193.043965] Node 0 active_anon:0kB inactive_anon:0kB
> > active_file:0kB inactive_file:72kB unevictable:20kB isolated(anon):0kB
> > isolated(file):0kB mapped:0kB dirty:0kB writeback:16kB shmem:0kB
> > writeback_tmp:0kB kernel_stack:400kB pagetables:0kB all_unreclaimable?
> > no
> > [  193.044073] Normal free:5704kB boost:0kB min:444kB low:552kB
> > high:660kB reserved_highatomic:0KB active_anon:0kB inactive_anon:0kB
> > active_file:0kB inactive_file:72kB unevictable:20kB writepending:16kB
> > present:16384kB managed:12544kB mlocked:0kB bounce:0kB free_pcp:0kB
> > local_pcp:0kB free_cma:0kB
> > [  193.044206] lowmem_reserve[]: 0 0
> > [  193.044260] Normal: 22*4kB (UM) 32*8kB (UM) 23*16kB (UM) 20*32kB
> > (UM) 20*64kB (UM) 0*128kB 12*256kB (UM) 0*512kB 0*1024kB 0*2048kB
> > 0*4096kB = 5704kB
> > [  193.044638] 23 total pagecache pages
> > [  193.044670] binfmt_flat: Unable to allocate RAM for process
> > text/data, errno -12
> >
> > Was it similar to your problem?
>
> Yes, this error could be caused by the bug I've fixed and I've seen
> you've used Linux 5.19-rc2. In this version there is not my bugfix
> and in general it should be avoided to use rc versions.
>
> This is the patch that fixes ZERO_PAGE(0) that is dedicated to
> massive "memset()" in the kernel, so it's used pretty often.
> In my case it failed to allocate it, so since in your backtrace
> there is try to allocate it could be fixed by my patch, also because
> you have 5MB free and they look enough for ifconfig.
>
> Can you give a try with 5.15.108 and repeat the same test please?
> Otherwise I'd need to enter debug with this board but I don't have it
> and this kind of bugs are subtle to catch and fix.

I did further tests with version 6.2 (stm32f469-disco, stm32f429-disco and
stm32f769-disco) and the situation definitely improved. Without your patch,
even a simple reboot command was causing problems. I had only one problem like
this and not deterministic:

~ # ps
[  102.396252] ps: page allocation failure: order:7,
mode:0xcc0(GFP_KERNEL), nodemask=(null)
[  102.404509] CPU: 0 PID: 62 Comm: ps Not tainted 6.2.9 #4
[  102.409911] Hardware name: STM32 (Device Tree Support)
[  102.415096]  unwind_backtrace from show_stack+0xb/0xc
[  102.420169]  show_stack from dump_stack_lvl+0x19/0x1e
[  102.425334]  dump_stack_lvl from warn_alloc+0x5f/0xf4
[  102.430409]  warn_alloc from __alloc_pages+0x36f/0x57e
[  102.435675]  __alloc_pages from __get_free_pages+0xf/0x24
[  102.441149]  __get_free_pages from alloc_pages_exact+0x45/0x5c
[  102.447031]  alloc_pages_exact from do_mmap+0x4c3/0x5d2
[  102.452288]  do_mmap from vm_mmap_pgoff+0x53/0x84
[  102.457022]  vm_mmap_pgoff from load_flat_binary+0x4f9/0x688
[  102.462777]  load_flat_binary from bprm_execve+0x1f9/0x2f4
[  102.468346]  bprm_execve from do_execveat_common+0x10f/0x12c
[  102.474023]  do_execveat_common from sys_execve+0x1d/0x20
[  102.479492]  sys_execve from ret_fast_syscall+0x1/0x4c
[  102.484628] Exception stack(0xc07dbfa8 to 0xc07dbff0)
[  102.489838] bfa0:                   c0c6aff7 c0c68fa2 c0c6aff7
c07e86b8 c056a028 0000000b
[  102.498014] bfc0: c0c6aff7 c0c68fa2 c0c68b88 0000000b c0c6affc
00000ffc c0c62734 00000000
[  102.506278] bfe0: 3a6e6962 c0c68b88 c0c0f7c7 c0c15d94
[  102.515871] Mem-Info:
[  102.518121] active_anon:0 inactive_anon:0 isolated_anon:0
[  102.518121]  active_file:50 inactive_file:29 isolated_file:0
[  102.518121]  unevictable:5 dirty:4 writeback:0
[  102.518121]  slab_reclaimable:287 slab_unreclaimable:460
[  102.518121]  mapped:0 shmem:0 pagetables:0
[  102.518121]  sec_pagetables:0 bounce:0
[  102.518121]  kernel_misc_reclaimable:0
[  102.518121]  free:1785 free_pcp:0 free_cma:0
[  102.556022] Node 0 active_anon:0kB inactive_anon:0kB
active_file:200kB inactive_file:116kB unevictable:20kB
isolated(anon):0kB isolated(file):0kB mapped:0kB dirty:16kB
writeback:0kB shmem:0kB writeback_tmp:0kB kernel_stack:272kB
pagetables:0kB sec_pagetables:0kB all_unreclaimable? no
[  102.581731] Normal free:7172kB boost:0kB min:440kB low:548kB
high:656kB reserved_highatomic:0KB active_anon:0kB inactive_anon:0kB
active_file:200kB inactive_file:116kB unevictable:20kB
writepending:16kB present:16384kB managed:12356kB mlocked:0kB
bounce:0kB free_pcp:0kB local_pcp:0kB free_cma:0kB
[  102.608439] lowmem_reserve[]: 0 0
[  102.611733] Normal: 25*4kB (UM) 20*8kB (UM) 10*16kB (UM) 21*32kB
(UM) 19*64kB (UM) 10*128kB (UM) 14*256kB (U) 0*512kB 0*1024kB 0*2048kB
0*4096kB = 7172kB
[  102.626183] 84 total pagecache pages
[  102.629735] 4096 pages RAM
[  102.632444] 0 pages HighMem/MovableOnly
[  102.636362] 1007 pages reserved
[  102.639494] nommu: Allocation of length 430080 from process 62 (ps) failed
[  102.646491] active_anon:0 inactive_anon:0 isolated_anon:0
[  102.646491]  active_file:50 inactive_file:29 isolated_file:0
[  102.646491]  unevictable:5 dirty:4 writeback:0
[  102.646491]  slab_reclaimable:279 slab_unreclaimable:460
[  102.646491]  mapped:0 shmem:0 pagetables:0
[  102.646491]  sec_pagetables:0 bounce:0
[  102.646491]  kernel_misc_reclaimable:0
[  102.646491]  free:1793 free_pcp:0 free_cma:0
[  102.683596] Node 0 active_anon:0kB inactive_anon:0kB
active_file:200kB inactive_file:116kB unevictable:20kB
isolated(anon):0kB isolated(file):0kB mapped:0kB dirty:16kB
writeback:0kB shmem:0kB writeback_tmp:0kB kernel_stack:272kB
pagetables:0kB sec_pagetables:0kB all_unreclaimable? no
[  102.708986] Normal free:7172kB boost:0kB min:440kB low:548kB
high:656kB reserved_highatomic:0KB active_anon:0kB inactive_anon:0kB
active_file:200kB inactive_file:116kB unevictable:20kB
writepending:16kB present:16384kB managed:12356kB mlocked:0kB
bounce:0kB free_pcp:0kB local_pcp:0kB free_cma:0kB
[  102.735642] lowmem_reserve[]: 0 0
[  102.738928] Normal: 25*4kB (UM) 20*8kB (UM) 10*16kB (UM) 21*32kB
(UM) 19*64kB (UM) 10*128kB (UM) 14*256kB (U) 0*512kB 0*1024kB 0*2048kB
0*4096kB = 7172kB
[  102.753269] 84 total pagecache pages
[  102.756881] binfmt_flat: Unable to allocate RAM for process
text/data, errno -12
Segmentation fault

Thanks and regards,
Dario
>
> Thank you!
>
> Best regards
> --
> Giulio Benetti
> Benetti Engineering sas



-- 

Dario Binacchi

Senior Embedded Linux Developer

dario.binacchi@amarulasolutions.com

__________________________________


Amarula Solutions SRL

Via Le Canevare 30, 31100 Treviso, Veneto, IT

T. +39 042 243 5310
info@amarulasolutions.com

www.amarulasolutions.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Buildroot] [PATCH 1/1] configs/stm32f769_disco_sd_defconfig: new defconfig
  2023-04-25 19:50       ` Dario Binacchi
@ 2023-04-25 20:18         ` Giulio Benetti
  2023-05-01 16:30           ` Giulio Benetti
  0 siblings, 1 reply; 8+ messages in thread
From: Giulio Benetti @ 2023-04-25 20:18 UTC (permalink / raw)
  To: Dario Binacchi; +Cc: buildroot

Hi Dario,

> Il giorno 25 apr 2023, alle ore 21:50, Dario Binacchi <dario.binacchi@amarulasolutions.com> ha scritto:
> 
> Hi Giulio,
> 
>> On Sun, Apr 23, 2023 at 10:31 PM Giulio Benetti
>> <giulio.benetti@benettiengineering.com> wrote:
>> 
>> Hi Dario,
>> 
>> On 23/04/23 19:20, Dario Binacchi wrote:
>> [ SNIP ]
>> 
>>>> 
>>>> Sure. Could you also try to fill the memory and see if everything works correctly?
>>>> You could try to start many instances of a program until you fill the memory and see that everything is working ok(I hope).
>>> 
>>> 
>>> I just uploaded version 2 with your suggested changes. I did some
>>> tests with can applications (candump, cansend, ...) and had
>>> no problems.
>>> But for example, running the ifconfig application, the second time I
>>> got this error:
>>> 
>>> ~ # candump can2 -L &
>>> [18] 81 candump can2 -L
>>> ~ # ifconfig
>>> Segmentation fault
>>> ~ # [  193.040912] warn_alloc: 1 callbacks suppressed
>>> [  193.040970] ifconfig: page allocation failure: order:7,
>>> mode:0xcc0(GFP_KERNEL), nodemask=(null)
>>> [  193.041056] CPU: 0 PID: 82 Comm: ifconfig Not tainted 5.19.0-rc2 #8
>>> [  193.041110] Hardware name: STM32 (Device Tree Support)
>>> [  193.041147]  unwind_backtrace from show_stack+0xb/0xc
>>> [  193.041252]  show_stack from dump_stack_lvl+0x19/0x1e
>>> [  193.041347]  dump_stack_lvl from warn_alloc+0x61/0xe8
>>> [  193.041434]  warn_alloc from __alloc_pages+0x36f/0x57e
>>> [  193.041511]  __alloc_pages from __get_free_pages+0xf/0x24
>>> [  193.041583]  __get_free_pages from alloc_pages_exact+0x45/0x5c
>>> [  193.041656]  alloc_pages_exact from do_mmap+0x491/0x556
>>> [  193.041752]  do_mmap from vm_mmap_pgoff+0x53/0x84
>>> [  193.041858]  vm_mmap_pgoff from load_flat_binary+0x501/0x690
>>> [  193.041960]  load_flat_binary from bprm_execve+0x1f5/0x2f4
>>> [  193.042044]  bprm_execve from do_execveat_common+0x10f/0x12c
>>> [  193.042119]  do_execveat_common from sys_execve+0x1d/0x20
>>> [  193.042195]  sys_execve from ret_fast_syscall+0x1/0x4c
>>> [  193.042262] Exception stack(0xc0ddbfa8 to 0xc0ddbff0)
>>> [  193.042324] bfa0:                   c0e6eff0 c0e68fa7 c0e6eff0
>>> c0c6e420 c0c6e028 0000000b
>>> [  193.042389] bfc0: c0e6eff0 c0e68fa7 c0e68b88 0000000b c0e6eff6
>>> 00000ff6 c0e626f4 00000000
>>> [  193.042438] bfe0: 6962732f c0e68b88 c0e0f7df c0e15db4
>>> [  193.042873] Mem-Info:
>>> [  193.042910] active_anon:0 inactive_anon:0 isolated_anon:0
>>> [  193.042910]  active_file:0 inactive_file:18 isolated_file:0
>>> [  193.042910]  unevictable:5 dirty:0 writeback:4
>>> [  193.042910]  slab_reclaimable:281 slab_unreclaimable:511
>>> [  193.042910]  mapped:0 shmem:0 pagetables:0 bounce:0
>>> [  193.042910]  kernel_misc_reclaimable:0
>>> [  193.042910]  free:1426 free_pcp:0 free_cma:0
>>> [  193.043049] Node 0 active_anon:0kB inactive_anon:0kB
>>> active_file:0kB inactive_file:72kB unevictable:20kB isolated(anon):0kB
>>> isolated(file):0kB mapped:0kB dirty:0kB writeback:16kB shmem:0kB
>>> writeback_tmp:0kB kernel_stack:400kB pagetables:0kB all_unreclaimable?
>>> no
>>> [  193.043162] Normal free:5704kB boost:0kB min:444kB low:552kB
>>> high:660kB reserved_highatomic:0KB active_anon:0kB inactive_anon:0kB
>>> active_file:0kB inactive_file:72kB unevictable:20kB writepending:16kB
>>> present:16384kB managed:12544kB mlocked:0kB bounce:0kB free_pcp:0kB
>>> local_pcp:0kB free_cma:0kB
>>> [  193.043295] lowmem_reserve[]: 0 0
>>> [  193.043352] Normal: 22*4kB (UM) 32*8kB (UM) 23*16kB (UM) 20*32kB
>>> (UM) 20*64kB (UM) 0*128kB 12*256kB (UM) 0*512kB 0*1024kB 0*2048kB
>>> 0*4096kB = 5704kB
>>> [  193.043729] 23 total pagecache pages
>>> [  193.043748] 4096 pages RAM
>>> [  193.043765] 0 pages HighMem/MovableOnly
>>> [  193.043783] 960 pages reserved
>>> [  193.043805] nommu: Allocation of length 430080 from process 82
>>> (ifconfig) failed
>>> [  193.043843] active_anon:0 inactive_anon:0 isolated_anon:0
>>> [  193.043843]  active_file:0 inactive_file:18 isolated_file:0
>>> [  193.043843]  unevictable:5 dirty:0 writeback:4
>>> [  193.043843]  slab_reclaimable:281 slab_unreclaimable:511
>>> [  193.043843]  mapped:0 shmem:0 pagetables:0 bounce:0
>>> [  193.043843]  kernel_misc_reclaimable:0
>>> [  193.043843]  free:1426 free_pcp:0 free_cma:0
>>> [  193.043965] Node 0 active_anon:0kB inactive_anon:0kB
>>> active_file:0kB inactive_file:72kB unevictable:20kB isolated(anon):0kB
>>> isolated(file):0kB mapped:0kB dirty:0kB writeback:16kB shmem:0kB
>>> writeback_tmp:0kB kernel_stack:400kB pagetables:0kB all_unreclaimable?
>>> no
>>> [  193.044073] Normal free:5704kB boost:0kB min:444kB low:552kB
>>> high:660kB reserved_highatomic:0KB active_anon:0kB inactive_anon:0kB
>>> active_file:0kB inactive_file:72kB unevictable:20kB writepending:16kB
>>> present:16384kB managed:12544kB mlocked:0kB bounce:0kB free_pcp:0kB
>>> local_pcp:0kB free_cma:0kB
>>> [  193.044206] lowmem_reserve[]: 0 0
>>> [  193.044260] Normal: 22*4kB (UM) 32*8kB (UM) 23*16kB (UM) 20*32kB
>>> (UM) 20*64kB (UM) 0*128kB 12*256kB (UM) 0*512kB 0*1024kB 0*2048kB
>>> 0*4096kB = 5704kB
>>> [  193.044638] 23 total pagecache pages
>>> [  193.044670] binfmt_flat: Unable to allocate RAM for process
>>> text/data, errno -12
>>> 
>>> Was it similar to your problem?
>> 
>> Yes, this error could be caused by the bug I've fixed and I've seen
>> you've used Linux 5.19-rc2. In this version there is not my bugfix
>> and in general it should be avoided to use rc versions.
>> 
>> This is the patch that fixes ZERO_PAGE(0) that is dedicated to
>> massive "memset()" in the kernel, so it's used pretty often.
>> In my case it failed to allocate it, so since in your backtrace
>> there is try to allocate it could be fixed by my patch, also because
>> you have 5MB free and they look enough for ifconfig.
>> 
>> Can you give a try with 5.15.108 and repeat the same test please?
>> Otherwise I'd need to enter debug with this board but I don't have it
>> and this kind of bugs are subtle to catch and fix.
> 
> I did further tests with version 6.2 (stm32f469-disco, stm32f429-disco and
> stm32f769-disco) and the situation definitely improved. Without your patch,
> even a simple reboot command was causing problems.

I’m very happy it fixed the problem :-)

> I had only one problem like
> this and not deterministic:
> 
> ~ # ps
> [  102.396252] ps: page allocation failure: order:7,
> mode:0xcc0(GFP_KERNEL), nodemask=(null)
> [  102.404509] CPU: 0 PID: 62 Comm: ps Not tainted 6.2.9 #4
> [  102.409911] Hardware name: STM32 (Device Tree Support)
> [  102.415096]  unwind_backtrace from show_stack+0xb/0xc
> [  102.420169]  show_stack from dump_stack_lvl+0x19/0x1e
> [  102.425334]  dump_stack_lvl from warn_alloc+0x5f/0xf4
> [  102.430409]  warn_alloc from __alloc_pages+0x36f/0x57e
> [  102.435675]  __alloc_pages from __get_free_pages+0xf/0x24
> [  102.441149]  __get_free_pages from alloc_pages_exact+0x45/0x5c
> [  102.447031]  alloc_pages_exact from do_mmap+0x4c3/0x5d2
> [  102.452288]  do_mmap from vm_mmap_pgoff+0x53/0x84
> [  102.457022]  vm_mmap_pgoff from load_flat_binary+0x4f9/0x688
> [  102.462777]  load_flat_binary from bprm_execve+0x1f9/0x2f4
> [  102.468346]  bprm_execve from do_execveat_common+0x10f/0x12c
> [  102.474023]  do_execveat_common from sys_execve+0x1d/0x20
> [  102.479492]  sys_execve from ret_fast_syscall+0x1/0x4c
> [  102.484628] Exception stack(0xc07dbfa8 to 0xc07dbff0)
> [  102.489838] bfa0:                   c0c6aff7 c0c68fa2 c0c6aff7
> c07e86b8 c056a028 0000000b
> [  102.498014] bfc0: c0c6aff7 c0c68fa2 c0c68b88 0000000b c0c6affc
> 00000ffc c0c62734 00000000
> [  102.506278] bfe0: 3a6e6962 c0c68b88 c0c0f7c7 c0c15d94
> [  102.515871] Mem-Info:
> [  102.518121] active_anon:0 inactive_anon:0 isolated_anon:0
> [  102.518121]  active_file:50 inactive_file:29 isolated_file:0
> [  102.518121]  unevictable:5 dirty:4 writeback:0
> [  102.518121]  slab_reclaimable:287 slab_unreclaimable:460
> [  102.518121]  mapped:0 shmem:0 pagetables:0
> [  102.518121]  sec_pagetables:0 bounce:0
> [  102.518121]  kernel_misc_reclaimable:0
> [  102.518121]  free:1785 free_pcp:0 free_cma:0
> [  102.556022] Node 0 active_anon:0kB inactive_anon:0kB
> active_file:200kB inactive_file:116kB unevictable:20kB
> isolated(anon):0kB isolated(file):0kB mapped:0kB dirty:16kB
> writeback:0kB shmem:0kB writeback_tmp:0kB kernel_stack:272kB
> pagetables:0kB sec_pagetables:0kB all_unreclaimable? no
> [  102.581731] Normal free:7172kB boost:0kB min:440kB low:548kB
> high:656kB reserved_highatomic:0KB active_anon:0kB inactive_anon:0kB
> active_file:200kB inactive_file:116kB unevictable:20kB
> writepending:16kB present:16384kB managed:12356kB mlocked:0kB
> bounce:0kB free_pcp:0kB local_pcp:0kB free_cma:0kB
> [  102.608439] lowmem_reserve[]: 0 0
> [  102.611733] Normal: 25*4kB (UM) 20*8kB (UM) 10*16kB (UM) 21*32kB
> (UM) 19*64kB (UM) 10*128kB (UM) 14*256kB (U) 0*512kB 0*1024kB 0*2048kB
> 0*4096kB = 7172kB
> [  102.626183] 84 total pagecache pages
> [  102.629735] 4096 pages RAM
> [  102.632444] 0 pages HighMem/MovableOnly
> [  102.636362] 1007 pages reserved
> [  102.639494] nommu: Allocation of length 430080 from process 62 (ps) failed
> [  102.646491] active_anon:0 inactive_anon:0 isolated_anon:0
> [  102.646491]  active_file:50 inactive_file:29 isolated_file:0
> [  102.646491]  unevictable:5 dirty:4 writeback:0
> [  102.646491]  slab_reclaimable:279 slab_unreclaimable:460
> [  102.646491]  mapped:0 shmem:0 pagetables:0
> [  102.646491]  sec_pagetables:0 bounce:0
> [  102.646491]  kernel_misc_reclaimable:0
> [  102.646491]  free:1793 free_pcp:0 free_cma:0
> [  102.683596] Node 0 active_anon:0kB inactive_anon:0kB
> active_file:200kB inactive_file:116kB unevictable:20kB
> isolated(anon):0kB isolated(file):0kB mapped:0kB dirty:16kB
> writeback:0kB shmem:0kB writeback_tmp:0kB kernel_stack:272kB
> pagetables:0kB sec_pagetables:0kB all_unreclaimable? no
> [  102.708986] Normal free:7172kB boost:0kB min:440kB low:548kB
> high:656kB reserved_highatomic:0KB active_anon:0kB inactive_anon:0kB
> active_file:200kB inactive_file:116kB unevictable:20kB
> writepending:16kB present:16384kB managed:12356kB mlocked:0kB
> bounce:0kB free_pcp:0kB local_pcp:0kB free_cma:0kB
> [  102.735642] lowmem_reserve[]: 0 0
> [  102.738928] Normal: 25*4kB (UM) 20*8kB (UM) 10*16kB (UM) 21*32kB
> (UM) 19*64kB (UM) 10*128kB (UM) 14*256kB (U) 0*512kB 0*1024kB 0*2048kB
> 0*4096kB = 7172kB
> [  102.753269] 84 total pagecache pages
> [  102.756881] binfmt_flat: Unable to allocate RAM for process
> text/data, errno -12
> Segmentation fault

Another bug on nommu arm :-/

I can give a try on imxrt1050 evk and see if ps repeatedly issued gives me the same problem, but it could hide the problem since it has 32MB of sdram.

Fortunately I’ve found I have a stm32f429-disco so I can give a try on that soon or late by entering debugging.

I think that for the moment your patches with Linux bumped including my patch should be enough and once I will have time to deal with this new Linux bug and I fix it then you can bump again.

So can you please resend patches using latest stable 5.15.x Linux that includes my patch?
This way stm32 nommu boards will work better than before for sure.
I can give a quick test on stm32f429-disco then and add my tested tag.

Thank you!

Best regards
—
Giulio Benetti
CEO/CTO@Benetti Engineering sas

> 
> Thanks and regards,
> Dario
>> 
>> Thank you!
>> 
>> Best regards
>> --
>> Giulio Benetti
>> Benetti Engineering sas
> 
> 
> 
> -- 
> 
> Dario Binacchi
> 
> Senior Embedded Linux Developer
> 
> dario.binacchi@amarulasolutions.com
> 
> __________________________________
> 
> 
> Amarula Solutions SRL
> 
> Via Le Canevare 30, 31100 Treviso, Veneto, IT
> 
> T. +39 042 243 5310
> info@amarulasolutions.com
> 
> www.amarulasolutions.com

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Buildroot] [PATCH 1/1] configs/stm32f769_disco_sd_defconfig: new defconfig
  2023-04-25 20:18         ` Giulio Benetti
@ 2023-05-01 16:30           ` Giulio Benetti
  0 siblings, 0 replies; 8+ messages in thread
From: Giulio Benetti @ 2023-05-01 16:30 UTC (permalink / raw)
  To: Dario Binacchi; +Cc: buildroot

Hi Dario,

On 25/04/23 22:18, Giulio Benetti wrote:
> Hi Dario,
> 
>> Il giorno 25 apr 2023, alle ore 21:50, Dario Binacchi <dario.binacchi@amarulasolutions.com> ha scritto:
>>
>> Hi Giulio,
>>
>>> On Sun, Apr 23, 2023 at 10:31 PM Giulio Benetti
>>> <giulio.benetti@benettiengineering.com> wrote:
>>>
>>> Hi Dario,
>>>
>>> On 23/04/23 19:20, Dario Binacchi wrote:
>>> [ SNIP ]
>>>
>>>>>
>>>>> Sure. Could you also try to fill the memory and see if everything works correctly?
>>>>> You could try to start many instances of a program until you fill the memory and see that everything is working ok(I hope).
>>>>
>>>>
>>>> I just uploaded version 2 with your suggested changes. I did some
>>>> tests with can applications (candump, cansend, ...) and had
>>>> no problems.
>>>> But for example, running the ifconfig application, the second time I
>>>> got this error:
>>>>
>>>> ~ # candump can2 -L &
>>>> [18] 81 candump can2 -L
>>>> ~ # ifconfig
>>>> Segmentation fault
>>>> ~ # [  193.040912] warn_alloc: 1 callbacks suppressed
>>>> [  193.040970] ifconfig: page allocation failure: order:7,
>>>> mode:0xcc0(GFP_KERNEL), nodemask=(null)
>>>> [  193.041056] CPU: 0 PID: 82 Comm: ifconfig Not tainted 5.19.0-rc2 #8
>>>> [  193.041110] Hardware name: STM32 (Device Tree Support)
>>>> [  193.041147]  unwind_backtrace from show_stack+0xb/0xc
>>>> [  193.041252]  show_stack from dump_stack_lvl+0x19/0x1e
>>>> [  193.041347]  dump_stack_lvl from warn_alloc+0x61/0xe8
>>>> [  193.041434]  warn_alloc from __alloc_pages+0x36f/0x57e
>>>> [  193.041511]  __alloc_pages from __get_free_pages+0xf/0x24
>>>> [  193.041583]  __get_free_pages from alloc_pages_exact+0x45/0x5c
>>>> [  193.041656]  alloc_pages_exact from do_mmap+0x491/0x556
>>>> [  193.041752]  do_mmap from vm_mmap_pgoff+0x53/0x84
>>>> [  193.041858]  vm_mmap_pgoff from load_flat_binary+0x501/0x690
>>>> [  193.041960]  load_flat_binary from bprm_execve+0x1f5/0x2f4
>>>> [  193.042044]  bprm_execve from do_execveat_common+0x10f/0x12c
>>>> [  193.042119]  do_execveat_common from sys_execve+0x1d/0x20
>>>> [  193.042195]  sys_execve from ret_fast_syscall+0x1/0x4c
>>>> [  193.042262] Exception stack(0xc0ddbfa8 to 0xc0ddbff0)
>>>> [  193.042324] bfa0:                   c0e6eff0 c0e68fa7 c0e6eff0
>>>> c0c6e420 c0c6e028 0000000b
>>>> [  193.042389] bfc0: c0e6eff0 c0e68fa7 c0e68b88 0000000b c0e6eff6
>>>> 00000ff6 c0e626f4 00000000
>>>> [  193.042438] bfe0: 6962732f c0e68b88 c0e0f7df c0e15db4
>>>> [  193.042873] Mem-Info:
>>>> [  193.042910] active_anon:0 inactive_anon:0 isolated_anon:0
>>>> [  193.042910]  active_file:0 inactive_file:18 isolated_file:0
>>>> [  193.042910]  unevictable:5 dirty:0 writeback:4
>>>> [  193.042910]  slab_reclaimable:281 slab_unreclaimable:511
>>>> [  193.042910]  mapped:0 shmem:0 pagetables:0 bounce:0
>>>> [  193.042910]  kernel_misc_reclaimable:0
>>>> [  193.042910]  free:1426 free_pcp:0 free_cma:0
>>>> [  193.043049] Node 0 active_anon:0kB inactive_anon:0kB
>>>> active_file:0kB inactive_file:72kB unevictable:20kB isolated(anon):0kB
>>>> isolated(file):0kB mapped:0kB dirty:0kB writeback:16kB shmem:0kB
>>>> writeback_tmp:0kB kernel_stack:400kB pagetables:0kB all_unreclaimable?
>>>> no
>>>> [  193.043162] Normal free:5704kB boost:0kB min:444kB low:552kB
>>>> high:660kB reserved_highatomic:0KB active_anon:0kB inactive_anon:0kB
>>>> active_file:0kB inactive_file:72kB unevictable:20kB writepending:16kB
>>>> present:16384kB managed:12544kB mlocked:0kB bounce:0kB free_pcp:0kB
>>>> local_pcp:0kB free_cma:0kB
>>>> [  193.043295] lowmem_reserve[]: 0 0
>>>> [  193.043352] Normal: 22*4kB (UM) 32*8kB (UM) 23*16kB (UM) 20*32kB
>>>> (UM) 20*64kB (UM) 0*128kB 12*256kB (UM) 0*512kB 0*1024kB 0*2048kB
>>>> 0*4096kB = 5704kB
>>>> [  193.043729] 23 total pagecache pages
>>>> [  193.043748] 4096 pages RAM
>>>> [  193.043765] 0 pages HighMem/MovableOnly
>>>> [  193.043783] 960 pages reserved
>>>> [  193.043805] nommu: Allocation of length 430080 from process 82
>>>> (ifconfig) failed
>>>> [  193.043843] active_anon:0 inactive_anon:0 isolated_anon:0
>>>> [  193.043843]  active_file:0 inactive_file:18 isolated_file:0
>>>> [  193.043843]  unevictable:5 dirty:0 writeback:4
>>>> [  193.043843]  slab_reclaimable:281 slab_unreclaimable:511
>>>> [  193.043843]  mapped:0 shmem:0 pagetables:0 bounce:0
>>>> [  193.043843]  kernel_misc_reclaimable:0
>>>> [  193.043843]  free:1426 free_pcp:0 free_cma:0
>>>> [  193.043965] Node 0 active_anon:0kB inactive_anon:0kB
>>>> active_file:0kB inactive_file:72kB unevictable:20kB isolated(anon):0kB
>>>> isolated(file):0kB mapped:0kB dirty:0kB writeback:16kB shmem:0kB
>>>> writeback_tmp:0kB kernel_stack:400kB pagetables:0kB all_unreclaimable?
>>>> no
>>>> [  193.044073] Normal free:5704kB boost:0kB min:444kB low:552kB
>>>> high:660kB reserved_highatomic:0KB active_anon:0kB inactive_anon:0kB
>>>> active_file:0kB inactive_file:72kB unevictable:20kB writepending:16kB
>>>> present:16384kB managed:12544kB mlocked:0kB bounce:0kB free_pcp:0kB
>>>> local_pcp:0kB free_cma:0kB
>>>> [  193.044206] lowmem_reserve[]: 0 0
>>>> [  193.044260] Normal: 22*4kB (UM) 32*8kB (UM) 23*16kB (UM) 20*32kB
>>>> (UM) 20*64kB (UM) 0*128kB 12*256kB (UM) 0*512kB 0*1024kB 0*2048kB
>>>> 0*4096kB = 5704kB
>>>> [  193.044638] 23 total pagecache pages
>>>> [  193.044670] binfmt_flat: Unable to allocate RAM for process
>>>> text/data, errno -12
>>>>
>>>> Was it similar to your problem?
>>>
>>> Yes, this error could be caused by the bug I've fixed and I've seen
>>> you've used Linux 5.19-rc2. In this version there is not my bugfix
>>> and in general it should be avoided to use rc versions.
>>>
>>> This is the patch that fixes ZERO_PAGE(0) that is dedicated to
>>> massive "memset()" in the kernel, so it's used pretty often.
>>> In my case it failed to allocate it, so since in your backtrace
>>> there is try to allocate it could be fixed by my patch, also because
>>> you have 5MB free and they look enough for ifconfig.
>>>
>>> Can you give a try with 5.15.108 and repeat the same test please?
>>> Otherwise I'd need to enter debug with this board but I don't have it
>>> and this kind of bugs are subtle to catch and fix.
>>
>> I did further tests with version 6.2 (stm32f469-disco, stm32f429-disco and
>> stm32f769-disco) and the situation definitely improved. Without your patch,
>> even a simple reboot command was causing problems.
> 
> I’m very happy it fixed the problem :-)
> 
>> I had only one problem like
>> this and not deterministic:
>>
>> ~ # ps
>> [  102.396252] ps: page allocation failure: order:7,
>> mode:0xcc0(GFP_KERNEL), nodemask=(null)
>> [  102.404509] CPU: 0 PID: 62 Comm: ps Not tainted 6.2.9 #4
>> [  102.409911] Hardware name: STM32 (Device Tree Support)
>> [  102.415096]  unwind_backtrace from show_stack+0xb/0xc
>> [  102.420169]  show_stack from dump_stack_lvl+0x19/0x1e
>> [  102.425334]  dump_stack_lvl from warn_alloc+0x5f/0xf4
>> [  102.430409]  warn_alloc from __alloc_pages+0x36f/0x57e
>> [  102.435675]  __alloc_pages from __get_free_pages+0xf/0x24
>> [  102.441149]  __get_free_pages from alloc_pages_exact+0x45/0x5c
>> [  102.447031]  alloc_pages_exact from do_mmap+0x4c3/0x5d2
>> [  102.452288]  do_mmap from vm_mmap_pgoff+0x53/0x84
>> [  102.457022]  vm_mmap_pgoff from load_flat_binary+0x4f9/0x688
>> [  102.462777]  load_flat_binary from bprm_execve+0x1f9/0x2f4
>> [  102.468346]  bprm_execve from do_execveat_common+0x10f/0x12c
>> [  102.474023]  do_execveat_common from sys_execve+0x1d/0x20
>> [  102.479492]  sys_execve from ret_fast_syscall+0x1/0x4c
>> [  102.484628] Exception stack(0xc07dbfa8 to 0xc07dbff0)
>> [  102.489838] bfa0:                   c0c6aff7 c0c68fa2 c0c6aff7
>> c07e86b8 c056a028 0000000b
>> [  102.498014] bfc0: c0c6aff7 c0c68fa2 c0c68b88 0000000b c0c6affc
>> 00000ffc c0c62734 00000000
>> [  102.506278] bfe0: 3a6e6962 c0c68b88 c0c0f7c7 c0c15d94
>> [  102.515871] Mem-Info:
>> [  102.518121] active_anon:0 inactive_anon:0 isolated_anon:0
>> [  102.518121]  active_file:50 inactive_file:29 isolated_file:0
>> [  102.518121]  unevictable:5 dirty:4 writeback:0
>> [  102.518121]  slab_reclaimable:287 slab_unreclaimable:460
>> [  102.518121]  mapped:0 shmem:0 pagetables:0
>> [  102.518121]  sec_pagetables:0 bounce:0
>> [  102.518121]  kernel_misc_reclaimable:0
>> [  102.518121]  free:1785 free_pcp:0 free_cma:0
>> [  102.556022] Node 0 active_anon:0kB inactive_anon:0kB
>> active_file:200kB inactive_file:116kB unevictable:20kB
>> isolated(anon):0kB isolated(file):0kB mapped:0kB dirty:16kB
>> writeback:0kB shmem:0kB writeback_tmp:0kB kernel_stack:272kB
>> pagetables:0kB sec_pagetables:0kB all_unreclaimable? no
>> [  102.581731] Normal free:7172kB boost:0kB min:440kB low:548kB
>> high:656kB reserved_highatomic:0KB active_anon:0kB inactive_anon:0kB
>> active_file:200kB inactive_file:116kB unevictable:20kB
>> writepending:16kB present:16384kB managed:12356kB mlocked:0kB
>> bounce:0kB free_pcp:0kB local_pcp:0kB free_cma:0kB
>> [  102.608439] lowmem_reserve[]: 0 0
>> [  102.611733] Normal: 25*4kB (UM) 20*8kB (UM) 10*16kB (UM) 21*32kB
>> (UM) 19*64kB (UM) 10*128kB (UM) 14*256kB (U) 0*512kB 0*1024kB 0*2048kB
>> 0*4096kB = 7172kB
>> [  102.626183] 84 total pagecache pages
>> [  102.629735] 4096 pages RAM
>> [  102.632444] 0 pages HighMem/MovableOnly
>> [  102.636362] 1007 pages reserved
>> [  102.639494] nommu: Allocation of length 430080 from process 62 (ps) failed
>> [  102.646491] active_anon:0 inactive_anon:0 isolated_anon:0
>> [  102.646491]  active_file:50 inactive_file:29 isolated_file:0
>> [  102.646491]  unevictable:5 dirty:4 writeback:0
>> [  102.646491]  slab_reclaimable:279 slab_unreclaimable:460
>> [  102.646491]  mapped:0 shmem:0 pagetables:0
>> [  102.646491]  sec_pagetables:0 bounce:0
>> [  102.646491]  kernel_misc_reclaimable:0
>> [  102.646491]  free:1793 free_pcp:0 free_cma:0
>> [  102.683596] Node 0 active_anon:0kB inactive_anon:0kB
>> active_file:200kB inactive_file:116kB unevictable:20kB
>> isolated(anon):0kB isolated(file):0kB mapped:0kB dirty:16kB
>> writeback:0kB shmem:0kB writeback_tmp:0kB kernel_stack:272kB
>> pagetables:0kB sec_pagetables:0kB all_unreclaimable? no
>> [  102.708986] Normal free:7172kB boost:0kB min:440kB low:548kB
>> high:656kB reserved_highatomic:0KB active_anon:0kB inactive_anon:0kB
>> active_file:200kB inactive_file:116kB unevictable:20kB
>> writepending:16kB present:16384kB managed:12356kB mlocked:0kB
>> bounce:0kB free_pcp:0kB local_pcp:0kB free_cma:0kB
>> [  102.735642] lowmem_reserve[]: 0 0
>> [  102.738928] Normal: 25*4kB (UM) 20*8kB (UM) 10*16kB (UM) 21*32kB
>> (UM) 19*64kB (UM) 10*128kB (UM) 14*256kB (U) 0*512kB 0*1024kB 0*2048kB
>> 0*4096kB = 7172kB
>> [  102.753269] 84 total pagecache pages
>> [  102.756881] binfmt_flat: Unable to allocate RAM for process
>> text/data, errno -12
>> Segmentation fault
> 
> Another bug on nommu arm :-/
> 
> I can give a try on imxrt1050 evk and see if ps repeatedly issued gives me the same problem, but it could hide the problem since it has 32MB of sdram.
> 
> Fortunately I’ve found I have a stm32f429-disco so I can give a try on that soon or late by entering debugging.

I've given a try on stm32f429-disco and I've experienced the same error
everytime I've issued a command that basically loaded busybox only.
That is not a bug, I've misread the trace, it's only an error due to
lack of memory. So I've shrinked stm32f429-disco linux by disabling IIO
and everything restarted to work.
To be honest I could also disable ifconfig in busybox but I've realized
that after sending patch[0] and IIO on stm32f429 only had Timer Trigger
enabled, so I've preferred to go that way.

So if you want to fix the problem you have to free ram up by disabling
some Linux option or some busybox option.

[0]: 
https://patchwork.ozlabs.org/project/buildroot/patch/20230501162619.1260325-1-giulio.benetti@benettiengineering.com/

Best regards
-- 
Giulio Benetti
CEO/CTO@Benetti Engineering sas

> I think that for the moment your patches with Linux bumped including my patch should be enough and once I will have time to deal with this new Linux bug and I fix it then you can bump again.
> 
> So can you please resend patches using latest stable 5.15.x Linux that includes my patch?
> This way stm32 nommu boards will work better than before for sure.
> I can give a quick test on stm32f429-disco then and add my tested tag.
> 
> Thank you!
> 
> Best regards
> —
> Giulio Benetti
> CEO/CTO@Benetti Engineering sas
> 
>>
>> Thanks and regards,
>> Dario
>>>
>>> Thank you!
>>>
>>> Best regards
>>> --
>>> Giulio Benetti
>>> Benetti Engineering sas
>>
>>
>>
>> -- 
>>
>> Dario Binacchi
>>
>> Senior Embedded Linux Developer
>>
>> dario.binacchi@amarulasolutions.com
>>
>> __________________________________
>>
>>
>> Amarula Solutions SRL
>>
>> Via Le Canevare 30, 31100 Treviso, Veneto, IT
>>
>> T. +39 042 243 5310
>> info@amarulasolutions.com
>>
>> www.amarulasolutions.com
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Buildroot] [PATCH 1/1] configs/stm32f769_disco_sd_defconfig: new defconfig
  2023-04-22 14:00 Dario Binacchi
@ 2023-04-22 14:56 ` Giulio Benetti
  0 siblings, 0 replies; 8+ messages in thread
From: Giulio Benetti @ 2023-04-22 14:56 UTC (permalink / raw)
  To: Dario Binacchi, buildroot

Hi Dario,

On 22/04/23 16:00, Dario Binacchi wrote:
> Board support package includes the following components:
> - mainline Linux kernel 5.14.21
> - mainline U-Boot 2023.04
> - default packages from buildroot
> 
> Note: There is a problem in u-boot display management. It should display
> the ST microelectronics logo but "noise" is displayed (like when running
> the command dd if=/dev/urandom of=/dev/fb0 in Linux). I also tried to
> change version (even the first version in which this feature was
> introduced), but without success. Despite this I decided not to disable
> the video management configuration to remind us that it needs to be
> fixed :).
> 
> Link: https://www.st.com/en/evaluation-tools/32f769idiscovery.html
> Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
> ---
>   DEVELOPERS                                    |  2 ++
>   .../stm32f769-disco/extlinux.conf             |  4 +++
>   .../stm32f769-disco/flash_sd.sh               | 18 +++++++++++
>   .../stm32f769-disco/genimage.cfg              | 27 ++++++++++++++++
>   .../stm32f769-disco/linux-sd.fragment         |  1 +
>   .../stm32f769-disco/post-build.sh             |  7 ++++
>   .../stm32f769-disco/readme.txt                | 32 +++++++++++++++++++
>   configs/stm32f769_disco_sd_defconfig          | 30 +++++++++++++++++
>   8 files changed, 121 insertions(+)
>   create mode 100644 board/stmicroelectronics/stm32f769-disco/extlinux.conf
>   create mode 100755 board/stmicroelectronics/stm32f769-disco/flash_sd.sh
>   create mode 100644 board/stmicroelectronics/stm32f769-disco/genimage.cfg
>   create mode 100644 board/stmicroelectronics/stm32f769-disco/linux-sd.fragment
>   create mode 100755 board/stmicroelectronics/stm32f769-disco/post-build.sh
>   create mode 100644 board/stmicroelectronics/stm32f769-disco/readme.txt
>   create mode 100644 configs/stm32f769_disco_sd_defconfig
> 
> diff --git a/DEVELOPERS b/DEVELOPERS
> index 5cd882b5791c..88ed40412ae8 100644
> --- a/DEVELOPERS
> +++ b/DEVELOPERS
> @@ -702,8 +702,10 @@ F:	package/xinetd/
>   
>   N:	Dario Binacchi <dario.binacchi@amarulasolutions.com>
>   F:	board/bsh/
> +F:	board/stmicroelectronics/stm32f769-disco/
>   F:	configs/imx8mn_bsh_smm_s2_defconfig
>   F:	configs/imx8mn_bsh_smm_s2_pro_defconfig
> +F:	configs/stm32f769_disco_sd_defconfig
>   F:	package/sscep/
>   F:	package/uuu/
>   
> diff --git a/board/stmicroelectronics/stm32f769-disco/extlinux.conf b/board/stmicroelectronics/stm32f769-disco/extlinux.conf
> new file mode 100644
> index 000000000000..48483a01fc4e
> --- /dev/null
> +++ b/board/stmicroelectronics/stm32f769-disco/extlinux.conf
> @@ -0,0 +1,4 @@
> +label stm32f769-disco-buildroot
> +  kernel /zImage
> +  devicetree /stm32f769-disco.dtb
> +  append console=ttySTM0,115200 root=/dev/mmcblk0p2 rw rootfstype=ext2 rootwait earlyprintk consoleblank=0 ignore_loglevel
> diff --git a/board/stmicroelectronics/stm32f769-disco/flash_sd.sh b/board/stmicroelectronics/stm32f769-disco/flash_sd.sh
> new file mode 100755
> index 000000000000..0ff3ae7dbfb3
> --- /dev/null
> +++ b/board/stmicroelectronics/stm32f769-disco/flash_sd.sh
> @@ -0,0 +1,18 @@
> +#!/bin/bash
> +
> +OUTPUT_DIR=$1
> +
> +if ! test -d "${OUTPUT_DIR}" ; then
> +    echo "ERROR: no output directory specified."
> +    echo "Usage: $0 OUTPUT_DIR"
> +    exit 1
> +fi
> +
> +"${OUTPUT_DIR}"/host/bin/openocd -f board/stm32f769i-disco.cfg \
> +  -c "init" \
> +  -c "reset init" \
> +  -c "flash probe 0" \
> +  -c "flash info 0" \
> +  -c "flash write_image erase ${OUTPUT_DIR}/images/u-boot.bin 0x08000000" \
> +  -c "reset run" \
> +  -c "shutdown"
> diff --git a/board/stmicroelectronics/stm32f769-disco/genimage.cfg b/board/stmicroelectronics/stm32f769-disco/genimage.cfg
> new file mode 100644
> index 000000000000..41f9da512489
> --- /dev/null
> +++ b/board/stmicroelectronics/stm32f769-disco/genimage.cfg
> @@ -0,0 +1,27 @@
> +image boot.vfat {
> +	vfat {
> +		files = {
> +			"zImage",
> +			"stm32f769-disco.dtb",
> +			"extlinux"
> +		}
> +	}
> +
> +	size = 16M
> +}
> +
> +image sdcard.img {
> +	hdimage {
> +	}
> +
> +	partition u-boot {
> +		partition-type = 0xC
> +		image = "boot.vfat"
> +	}
> +
> +	partition rootfs {
> +		partition-type = 0x83
> +		image = "rootfs.ext2"
> +		size = 32M
> +	}
> +}
> diff --git a/board/stmicroelectronics/stm32f769-disco/linux-sd.fragment b/board/stmicroelectronics/stm32f769-disco/linux-sd.fragment
> new file mode 100644
> index 000000000000..846229d0d468
> --- /dev/null
> +++ b/board/stmicroelectronics/stm32f769-disco/linux-sd.fragment
> @@ -0,0 +1 @@
> +# CONFIG_XIP_KERNEL is not set
> diff --git a/board/stmicroelectronics/stm32f769-disco/post-build.sh b/board/stmicroelectronics/stm32f769-disco/post-build.sh
> new file mode 100755
> index 000000000000..c8cca3de8c9b
> --- /dev/null
> +++ b/board/stmicroelectronics/stm32f769-disco/post-build.sh
> @@ -0,0 +1,7 @@
> +#!/bin/sh
> +BOARD_DIR="$(dirname "$0")"
> +
> +# Kernel is built without devpts support
> +sed -i '/^devpts/d' "${TARGET_DIR}"/etc/fstab
> +
> +install -m 0644 -D "${BOARD_DIR}"/extlinux.conf "${BINARIES_DIR}"/extlinux/extlinux.conf
> diff --git a/board/stmicroelectronics/stm32f769-disco/readme.txt b/board/stmicroelectronics/stm32f769-disco/readme.txt
> new file mode 100644
> index 000000000000..8f4f79a86138
> --- /dev/null
> +++ b/board/stmicroelectronics/stm32f769-disco/readme.txt
> @@ -0,0 +1,32 @@
> +STM32F769 Discovery
> +===================
> +
> +This tutorial describes how to use the predefined Buildroot
> +configuration for the STM32F769 Discovery evaluation platform.
> +
> +Building
> +--------
> +
> +  make stm32f769_disco_sd_defconfig
> +  make
> +
> +Flashing
> +--------
> +
> +  ./board/stmicroelectronics/stm32f769-disco/flash_sd.sh output/
> +
> +It will flash the U-boot bootloader.
> +
> +Creating SD card
> +----------------
> +
> +Buildroot prepares an"sdcard.img" image in the output/images/ directory,
> +ready to be dumped on a SD card. Launch the following command as root:
> +
> +  dd if=output/images/sdcard.img of=/dev/<your-sd-device>
> +
> +*** WARNING! This will destroy all the card content. Use with care! ***
> +
> +For details about the medium image layout and its content, see the
> +definition in board/stmicroelectronics/stm32f769-disco/genimage.cfg.
> +
> diff --git a/configs/stm32f769_disco_sd_defconfig b/configs/stm32f769_disco_sd_defconfig
> new file mode 100644
> index 000000000000..4d43658403ca
> --- /dev/null
> +++ b/configs/stm32f769_disco_sd_defconfig
> @@ -0,0 +1,30 @@
> +BR2_arm=y
> +BR2_cortex_m4=y

Here ^^^ it is a BR2_cortex_m7

> +BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_14=y
> +BR2_ROOTFS_POST_BUILD_SCRIPT="board/stmicroelectronics/stm32f769-disco/post-build.sh"
> +BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh"
> +BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/stmicroelectronics/stm32f769-disco/genimage.cfg"
> +BR2_LINUX_KERNEL=y
> +BR2_LINUX_KERNEL_CUSTOM_VERSION=y
> +BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.14.21"

It would be great if you could use Linux latest stable 5.15.108 that has
patch for MMU-less fix committed[0]. I've found and fixed the bug on
i.MXRT but it should affect every MMU-less system.
Or you could bump Linux to latest version 6.2 that has the patch
committed too.

This could be done also for the stm32f4xx boards you're bumping for
uboot.

[0]: 
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=linux-5.15.y&id=7ae0262748e5d8ff1e42b77bb19bba474733f280

Best regards
-- 
Giulio Benetti
Benetti Engineering sas

> +BR2_LINUX_KERNEL_DEFCONFIG="stm32"
> +BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="$(LINUX_DIR)/arch/arm/configs/dram_0xc0000000.config board/stmicroelectronics/stm32f769-disco/linux-sd.fragment"
> +BR2_LINUX_KERNEL_IMAGE_TARGET_CUSTOM=y
> +BR2_LINUX_KERNEL_IMAGE_TARGET_NAME="zImage"
> +BR2_LINUX_KERNEL_DTS_SUPPORT=y
> +BR2_LINUX_KERNEL_INTREE_DTS_NAME="stm32f769-disco"
> +BR2_PACKAGE_BUSYBOX_CONFIG="package/busybox/busybox-minimal.config"
> +# BR2_PACKAGE_IFUPDOWN_SCRIPTS is not set
> +BR2_TARGET_ROOTFS_EXT2=y
> +BR2_TARGET_ROOTFS_EXT2_SIZE="32M"
> +# BR2_TARGET_ROOTFS_TAR is not set
> +BR2_TARGET_UBOOT=y
> +BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y
> +BR2_TARGET_UBOOT_CUSTOM_VERSION=y
> +BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2023.04"
> +BR2_TARGET_UBOOT_BOARD_DEFCONFIG="stm32f769-disco"
> +BR2_TARGET_UBOOT_NEEDS_OPENSSL=y
> +BR2_PACKAGE_HOST_DOSFSTOOLS=y
> +BR2_PACKAGE_HOST_GENIMAGE=y
> +BR2_PACKAGE_HOST_MTOOLS=y
> +BR2_PACKAGE_HOST_OPENOCD=y

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Buildroot] [PATCH 1/1] configs/stm32f769_disco_sd_defconfig: new defconfig
@ 2023-04-22 14:00 Dario Binacchi
  2023-04-22 14:56 ` Giulio Benetti
  0 siblings, 1 reply; 8+ messages in thread
From: Dario Binacchi @ 2023-04-22 14:00 UTC (permalink / raw)
  To: buildroot; +Cc: Dario Binacchi

Board support package includes the following components:
- mainline Linux kernel 5.14.21
- mainline U-Boot 2023.04
- default packages from buildroot

Note: There is a problem in u-boot display management. It should display
the ST microelectronics logo but "noise" is displayed (like when running
the command dd if=/dev/urandom of=/dev/fb0 in Linux). I also tried to
change version (even the first version in which this feature was
introduced), but without success. Despite this I decided not to disable
the video management configuration to remind us that it needs to be
fixed :).

Link: https://www.st.com/en/evaluation-tools/32f769idiscovery.html
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
---
 DEVELOPERS                                    |  2 ++
 .../stm32f769-disco/extlinux.conf             |  4 +++
 .../stm32f769-disco/flash_sd.sh               | 18 +++++++++++
 .../stm32f769-disco/genimage.cfg              | 27 ++++++++++++++++
 .../stm32f769-disco/linux-sd.fragment         |  1 +
 .../stm32f769-disco/post-build.sh             |  7 ++++
 .../stm32f769-disco/readme.txt                | 32 +++++++++++++++++++
 configs/stm32f769_disco_sd_defconfig          | 30 +++++++++++++++++
 8 files changed, 121 insertions(+)
 create mode 100644 board/stmicroelectronics/stm32f769-disco/extlinux.conf
 create mode 100755 board/stmicroelectronics/stm32f769-disco/flash_sd.sh
 create mode 100644 board/stmicroelectronics/stm32f769-disco/genimage.cfg
 create mode 100644 board/stmicroelectronics/stm32f769-disco/linux-sd.fragment
 create mode 100755 board/stmicroelectronics/stm32f769-disco/post-build.sh
 create mode 100644 board/stmicroelectronics/stm32f769-disco/readme.txt
 create mode 100644 configs/stm32f769_disco_sd_defconfig

diff --git a/DEVELOPERS b/DEVELOPERS
index 5cd882b5791c..88ed40412ae8 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -702,8 +702,10 @@ F:	package/xinetd/
 
 N:	Dario Binacchi <dario.binacchi@amarulasolutions.com>
 F:	board/bsh/
+F:	board/stmicroelectronics/stm32f769-disco/
 F:	configs/imx8mn_bsh_smm_s2_defconfig
 F:	configs/imx8mn_bsh_smm_s2_pro_defconfig
+F:	configs/stm32f769_disco_sd_defconfig
 F:	package/sscep/
 F:	package/uuu/
 
diff --git a/board/stmicroelectronics/stm32f769-disco/extlinux.conf b/board/stmicroelectronics/stm32f769-disco/extlinux.conf
new file mode 100644
index 000000000000..48483a01fc4e
--- /dev/null
+++ b/board/stmicroelectronics/stm32f769-disco/extlinux.conf
@@ -0,0 +1,4 @@
+label stm32f769-disco-buildroot
+  kernel /zImage
+  devicetree /stm32f769-disco.dtb
+  append console=ttySTM0,115200 root=/dev/mmcblk0p2 rw rootfstype=ext2 rootwait earlyprintk consoleblank=0 ignore_loglevel
diff --git a/board/stmicroelectronics/stm32f769-disco/flash_sd.sh b/board/stmicroelectronics/stm32f769-disco/flash_sd.sh
new file mode 100755
index 000000000000..0ff3ae7dbfb3
--- /dev/null
+++ b/board/stmicroelectronics/stm32f769-disco/flash_sd.sh
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+OUTPUT_DIR=$1
+
+if ! test -d "${OUTPUT_DIR}" ; then
+    echo "ERROR: no output directory specified."
+    echo "Usage: $0 OUTPUT_DIR"
+    exit 1
+fi
+
+"${OUTPUT_DIR}"/host/bin/openocd -f board/stm32f769i-disco.cfg \
+  -c "init" \
+  -c "reset init" \
+  -c "flash probe 0" \
+  -c "flash info 0" \
+  -c "flash write_image erase ${OUTPUT_DIR}/images/u-boot.bin 0x08000000" \
+  -c "reset run" \
+  -c "shutdown"
diff --git a/board/stmicroelectronics/stm32f769-disco/genimage.cfg b/board/stmicroelectronics/stm32f769-disco/genimage.cfg
new file mode 100644
index 000000000000..41f9da512489
--- /dev/null
+++ b/board/stmicroelectronics/stm32f769-disco/genimage.cfg
@@ -0,0 +1,27 @@
+image boot.vfat {
+	vfat {
+		files = {
+			"zImage",
+			"stm32f769-disco.dtb",
+			"extlinux"
+		}
+	}
+
+	size = 16M
+}
+
+image sdcard.img {
+	hdimage {
+	}
+
+	partition u-boot {
+		partition-type = 0xC
+		image = "boot.vfat"
+	}
+
+	partition rootfs {
+		partition-type = 0x83
+		image = "rootfs.ext2"
+		size = 32M
+	}
+}
diff --git a/board/stmicroelectronics/stm32f769-disco/linux-sd.fragment b/board/stmicroelectronics/stm32f769-disco/linux-sd.fragment
new file mode 100644
index 000000000000..846229d0d468
--- /dev/null
+++ b/board/stmicroelectronics/stm32f769-disco/linux-sd.fragment
@@ -0,0 +1 @@
+# CONFIG_XIP_KERNEL is not set
diff --git a/board/stmicroelectronics/stm32f769-disco/post-build.sh b/board/stmicroelectronics/stm32f769-disco/post-build.sh
new file mode 100755
index 000000000000..c8cca3de8c9b
--- /dev/null
+++ b/board/stmicroelectronics/stm32f769-disco/post-build.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+BOARD_DIR="$(dirname "$0")"
+
+# Kernel is built without devpts support
+sed -i '/^devpts/d' "${TARGET_DIR}"/etc/fstab
+
+install -m 0644 -D "${BOARD_DIR}"/extlinux.conf "${BINARIES_DIR}"/extlinux/extlinux.conf
diff --git a/board/stmicroelectronics/stm32f769-disco/readme.txt b/board/stmicroelectronics/stm32f769-disco/readme.txt
new file mode 100644
index 000000000000..8f4f79a86138
--- /dev/null
+++ b/board/stmicroelectronics/stm32f769-disco/readme.txt
@@ -0,0 +1,32 @@
+STM32F769 Discovery
+===================
+
+This tutorial describes how to use the predefined Buildroot
+configuration for the STM32F769 Discovery evaluation platform.
+
+Building
+--------
+
+  make stm32f769_disco_sd_defconfig
+  make
+
+Flashing
+--------
+
+  ./board/stmicroelectronics/stm32f769-disco/flash_sd.sh output/
+
+It will flash the U-boot bootloader.
+
+Creating SD card
+----------------
+
+Buildroot prepares an"sdcard.img" image in the output/images/ directory,
+ready to be dumped on a SD card. Launch the following command as root:
+
+  dd if=output/images/sdcard.img of=/dev/<your-sd-device>
+
+*** WARNING! This will destroy all the card content. Use with care! ***
+
+For details about the medium image layout and its content, see the
+definition in board/stmicroelectronics/stm32f769-disco/genimage.cfg.
+
diff --git a/configs/stm32f769_disco_sd_defconfig b/configs/stm32f769_disco_sd_defconfig
new file mode 100644
index 000000000000..4d43658403ca
--- /dev/null
+++ b/configs/stm32f769_disco_sd_defconfig
@@ -0,0 +1,30 @@
+BR2_arm=y
+BR2_cortex_m4=y
+BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_14=y
+BR2_ROOTFS_POST_BUILD_SCRIPT="board/stmicroelectronics/stm32f769-disco/post-build.sh"
+BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh"
+BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/stmicroelectronics/stm32f769-disco/genimage.cfg"
+BR2_LINUX_KERNEL=y
+BR2_LINUX_KERNEL_CUSTOM_VERSION=y
+BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.14.21"
+BR2_LINUX_KERNEL_DEFCONFIG="stm32"
+BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="$(LINUX_DIR)/arch/arm/configs/dram_0xc0000000.config board/stmicroelectronics/stm32f769-disco/linux-sd.fragment"
+BR2_LINUX_KERNEL_IMAGE_TARGET_CUSTOM=y
+BR2_LINUX_KERNEL_IMAGE_TARGET_NAME="zImage"
+BR2_LINUX_KERNEL_DTS_SUPPORT=y
+BR2_LINUX_KERNEL_INTREE_DTS_NAME="stm32f769-disco"
+BR2_PACKAGE_BUSYBOX_CONFIG="package/busybox/busybox-minimal.config"
+# BR2_PACKAGE_IFUPDOWN_SCRIPTS is not set
+BR2_TARGET_ROOTFS_EXT2=y
+BR2_TARGET_ROOTFS_EXT2_SIZE="32M"
+# BR2_TARGET_ROOTFS_TAR is not set
+BR2_TARGET_UBOOT=y
+BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y
+BR2_TARGET_UBOOT_CUSTOM_VERSION=y
+BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2023.04"
+BR2_TARGET_UBOOT_BOARD_DEFCONFIG="stm32f769-disco"
+BR2_TARGET_UBOOT_NEEDS_OPENSSL=y
+BR2_PACKAGE_HOST_DOSFSTOOLS=y
+BR2_PACKAGE_HOST_GENIMAGE=y
+BR2_PACKAGE_HOST_MTOOLS=y
+BR2_PACKAGE_HOST_OPENOCD=y
-- 
2.32.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-05-01 16:30 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CABGWkvoH-sy4LhPtWgY422FXm6pQ9UR5eM63nV-LAmEf1FRFng@mail.gmail.com>
2023-04-22 16:56 ` [Buildroot] [PATCH 1/1] configs/stm32f769_disco_sd_defconfig: new defconfig Giulio Benetti
2023-04-23 17:20   ` Dario Binacchi
2023-04-23 20:31     ` Giulio Benetti
2023-04-25 19:50       ` Dario Binacchi
2023-04-25 20:18         ` Giulio Benetti
2023-05-01 16:30           ` Giulio Benetti
2023-04-22 14:00 Dario Binacchi
2023-04-22 14:56 ` Giulio Benetti

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.