mirror of
https://github.com/apache/nuttx.git
synced 2026-06-04 23:03:27 +08:00
SAMA5D4-EK kernel config can now boot from a ROMFS file system
This commit is contained in:
@@ -286,6 +286,38 @@ config SAMA5D4EK_HSMCI1_MOUNT_MOUNTPOINT
|
|||||||
|
|
||||||
endif # SAMA5D4EK_HSMCI1_MOUNT
|
endif # SAMA5D4EK_HSMCI1_MOUNT
|
||||||
|
|
||||||
|
config SAMA5D4EK_ROMFS_MOUNT
|
||||||
|
bool "ROMFS boot mount"
|
||||||
|
default n
|
||||||
|
depends on FS_ROMFS
|
||||||
|
---help---
|
||||||
|
By selecting this option, you an build mount a ROMFS file system as
|
||||||
|
part of the system boot operation. NOTE that the board logic
|
||||||
|
contains no a priori ROMFS file system. In order to use this option,
|
||||||
|
you must provide the file nuttx/configs/sama5d4-ek/include/boot_romfsimg.h.
|
||||||
|
You might use logic in the tool at apps/tools/mkromfsimg.sh to create
|
||||||
|
this header file.
|
||||||
|
|
||||||
|
if SAMA5D4EK_ROMFS_MOUNT
|
||||||
|
|
||||||
|
config SAMA5D4EK_ROMFS_ROMDISK_MINOR
|
||||||
|
int "ROM disk minor device number"
|
||||||
|
default 0
|
||||||
|
|
||||||
|
config SAMA5D4EK_ROMFS_ROMDISK_DEVNAME
|
||||||
|
string "ROM disk block device"
|
||||||
|
default "/dev/ram0"
|
||||||
|
|
||||||
|
config SAMA5D4EK_ROMFS_ROMDISK_SECTSIZE
|
||||||
|
int "ROM disk sector size"
|
||||||
|
default 512
|
||||||
|
|
||||||
|
config SAMA5D4EK_ROMFS_MOUNT_MOUNTPOINT
|
||||||
|
string "ROMFS mount point"
|
||||||
|
default "/bin"
|
||||||
|
|
||||||
|
endif # SAMA5D4EK_ROMFS_MOUNT
|
||||||
|
|
||||||
if INPUT_MXT
|
if INPUT_MXT
|
||||||
|
|
||||||
config SAMA5D4EK_MXT_I2CFREQUENCY
|
config SAMA5D4EK_MXT_I2CFREQUENCY
|
||||||
|
|||||||
@@ -3776,17 +3776,69 @@ Configurations
|
|||||||
CONFIG_MM_KERNEL_HEAP=y : Enable a kernel heap
|
CONFIG_MM_KERNEL_HEAP=y : Enable a kernel heap
|
||||||
CONFIG_MM_KERNEL_HEAPSIZE=8192 : (temporary.. will change)
|
CONFIG_MM_KERNEL_HEAPSIZE=8192 : (temporary.. will change)
|
||||||
|
|
||||||
4. Board initialization is performed performed before the application
|
4. By default, this configuration is setup to boot from an SD card.
|
||||||
|
Unfortunately, there some issues when using the SD card that prevent
|
||||||
|
this from working properly (see STATUS below). And alternative is to
|
||||||
|
use a built-in ROMFS file system that does not suffer from the
|
||||||
|
(assumed) HSMCI bug.
|
||||||
|
|
||||||
|
So why isn't this the default configuration? Because it does not
|
||||||
|
build out-of-the-box. You have to take special steps in the build
|
||||||
|
process as described below.
|
||||||
|
|
||||||
|
Assuming that you will want to reconfigure to use the ROMFS (rather than debugging HSCMI), you will need to disable all of these settings:
|
||||||
|
|
||||||
|
System Type->ATSAMA5 Peripheral Support
|
||||||
|
CONFIG_SAMA5_HSMCI0=n : Disable HSMCI0 support
|
||||||
|
CONFIG_SAMA5_XDMAC0=n : XDMAC0 is no longer needed
|
||||||
|
|
||||||
|
System Type
|
||||||
|
CONFIG_SAMA5_PIO_IRQ=n : PIO interrupts are no longer needed
|
||||||
|
|
||||||
|
Device Drivers -> MMC/SD Driver Support
|
||||||
|
CONFIG_MMCSD=n : Disable MMC/SD support
|
||||||
|
|
||||||
|
File System
|
||||||
|
CONFIG_FS_FAT=n : FAT file system no longer needed
|
||||||
|
|
||||||
|
Board Selection
|
||||||
|
CONFIG_SAMA5D4EK_HSMCI0_MOUNT=y : Don't mount HSMCI0 at boot
|
||||||
|
|
||||||
|
And then enable these features in order to use the ROMFS boot file
|
||||||
|
system:
|
||||||
|
|
||||||
|
File System
|
||||||
|
CONFIG_FS_ROMFS=y : Enable the ROMFS file system
|
||||||
|
|
||||||
|
Board Selection
|
||||||
|
CONFIG_SAMA5D4EK_ROMFS_MOUNT=y : Mount the ROMFS file system at boot
|
||||||
|
CONFIG_SAMA5D4EK_ROMFS_MOUNT_MOUNTPOINT="/bin"
|
||||||
|
CONFIG_SAMA5D4EK_ROMFS_ROMDISK_DEVNAME="/dev/ram0"
|
||||||
|
CONFIG_SAMA5D4EK_ROMFS_ROMDISK_MINOR=0
|
||||||
|
CONFIG_SAMA5D4EK_ROMFS_ROMDISK_SECTSIZE=512
|
||||||
|
|
||||||
|
Then you will need to follow some special build instructions below
|
||||||
|
in order to build and install the ROMFS file system image.
|
||||||
|
|
||||||
|
UPDATE: The ROMFS configuration is pre-configured in the the
|
||||||
|
file nuttx/configs/sama5d4-ek/knsh/defconfig.ROMFS
|
||||||
|
|
||||||
|
5. Board initialization is performed performed before the application
|
||||||
is started:
|
is started:
|
||||||
|
|
||||||
RTOS Features -> RTOS Hooks
|
RTOS Features -> RTOS Hooks
|
||||||
CONFIG_BOARD_INITITIALIZE=y
|
CONFIG_BOARD_INITITIALIZE=y
|
||||||
|
|
||||||
The board initialization will mount the FAT filesystem on an SD card
|
In the special ROMFS boot configuration, you need to do nothing
|
||||||
inserted int the HSMCI0 slot (full size). The SAMA4D4-EK provides
|
additional: The board initialization will mount the ROMFS file
|
||||||
two SD memory card slots: (1) a full size SD card slot (J10), and
|
system at boot time.
|
||||||
(2) a microSD memory card slot (J11). The full size SD card slot
|
|
||||||
connects via HSMCI0; the microSD connects vi HSMCI1. See the relevant
|
In the default configuration, however, the board initialization
|
||||||
|
will instead mount the FAT filesystem on an SD card inserted in
|
||||||
|
the HSMCI0 slot (full size). The SAMA4D4-EK provides two SD
|
||||||
|
memory card slots: (1) a full size SD card slot (J10), and (2) a
|
||||||
|
microSD memory card slot (J11). The full size SD card slot connects
|
||||||
|
via HSMCI0; the microSD connects vi HSMCI1. See the relevant
|
||||||
configuration settings above in the paragraph entitled "HSMCI Card
|
configuration settings above in the paragraph entitled "HSMCI Card
|
||||||
Slots" above.
|
Slots" above.
|
||||||
|
|
||||||
@@ -3809,20 +3861,45 @@ Configurations
|
|||||||
CONFIG_SAMA5D4EK_HSMCI0_MOUNT_FSTYPE="vfat"
|
CONFIG_SAMA5D4EK_HSMCI0_MOUNT_FSTYPE="vfat"
|
||||||
CONFIG_SAMA5D4EK_HSMCI0_MOUNT_MOUNTPOINT="/bin"
|
CONFIG_SAMA5D4EK_HSMCI0_MOUNT_MOUNTPOINT="/bin"
|
||||||
|
|
||||||
5. General build directions:
|
6a. General build directions (boot from SD card):
|
||||||
|
|
||||||
$ cd nuttx/tools : Go to the tools sub-directory
|
$ cd nuttx/tools : Go to the tools sub-directory
|
||||||
$ ./configure.sh sama5d4-ek/kernel : Establish this configuration
|
$ ./configure.sh sama5d4-ek/kernel : Establish this configuration
|
||||||
$ cd .. : Back to the NuttX build directory
|
$ cd .. : Back to the NuttX build directory
|
||||||
: Edit setenv.sh to use the correct path
|
: Edit setenv.sh to use the correct path
|
||||||
$ . ./setenv.sh : Set up the PATH variable
|
$ . ./setenv.sh : Set up the PATH variable
|
||||||
$ make : Build the kernel
|
$ make : Build the kerne with a dummy ROMFS image
|
||||||
: This should create the nuttx ELF
|
: This should create the nuttx ELF
|
||||||
$ make export : Create the kernel export package
|
$ make export : Create the kernel export package
|
||||||
: You should have a file like nuttx-export-*.zip
|
: You should have a file like
|
||||||
$ cd apps/ : Go to the apps/ directory
|
: nuttx-export-*.zip
|
||||||
$ tools/mkimport.sh -x <zip-file> : Use the full path to nuttx-export-*.zip
|
$ cd apps/ : Go to the apps/ directory
|
||||||
$ make import : This will build the file system
|
$ tools/mkimport.sh -x <zip-file> : Use the full path to nuttx-export-*.zip
|
||||||
|
$ make import : This will build the file system.
|
||||||
|
|
||||||
|
You will then need to copy the files from apps/bin to an SD card to
|
||||||
|
create the the bootable SD card.
|
||||||
|
|
||||||
|
6b. General build directions (boot from ROMFS image):
|
||||||
|
|
||||||
|
$ cd nuttx/tools : Go to the tools sub-directory
|
||||||
|
$ ./configure.sh sama5d4-ek/kernel : Establish this configuration
|
||||||
|
$ cd .. : Back to the NuttX build directory
|
||||||
|
: Edit setenv.sh to use the correct path
|
||||||
|
$ . ./setenv.sh : Set up the PATH variable
|
||||||
|
$ touch configs/sama5d4-ek/include/boot_romfsimg.h
|
||||||
|
$ make : Build the kernel with a dummy ROMFS image
|
||||||
|
: This should create the nuttx ELF
|
||||||
|
$ make export : Create the kernel export package
|
||||||
|
: You should have a file like
|
||||||
|
: nuttx-export-*.zip
|
||||||
|
$ cd apps/ : Go to the apps/ directory
|
||||||
|
$ tools/mkimport.sh -x <zip-file> : Use the full path to nuttx-export-*.zip
|
||||||
|
$ make import : This will build the file system
|
||||||
|
$ tools/mkromfsimg.sh : Create the real ROMFS image
|
||||||
|
$ mv boot_romfsimg.h ../nuttx/configs/sama5d4-ek/include/boot_romfsimg.h
|
||||||
|
$ cd nuttx/ : Rebuild the system with the correct
|
||||||
|
$ make clean_context all : ROMFS file system
|
||||||
|
|
||||||
STATUS:
|
STATUS:
|
||||||
|
|
||||||
|
|||||||
Executable
+1
@@ -0,0 +1 @@
|
|||||||
|
/boot_romfsimg.h
|
||||||
@@ -180,7 +180,7 @@ CONFIG_ARCH_CHIP_ATSAMA5D44=y
|
|||||||
# CONFIG_SAMA5_WDT is not set
|
# CONFIG_SAMA5_WDT is not set
|
||||||
CONFIG_SAMA5_RTC=y
|
CONFIG_SAMA5_RTC=y
|
||||||
# CONFIG_SAMA5_ICM is not set
|
# CONFIG_SAMA5_ICM is not set
|
||||||
CONFIG_SAMA5_HSMC=y
|
# CONFIG_SAMA5_HSMC is not set
|
||||||
# CONFIG_SAMA5_SMD is not set
|
# CONFIG_SAMA5_SMD is not set
|
||||||
# CONFIG_SAMA5_SAIC is not set
|
# CONFIG_SAMA5_SAIC is not set
|
||||||
# CONFIG_SAMA5_UART0 is not set
|
# CONFIG_SAMA5_UART0 is not set
|
||||||
@@ -477,13 +477,7 @@ CONFIG_DEV_RANDOM=y
|
|||||||
# CONFIG_ARCH_HAVE_PWM_PULSECOUNT is not set
|
# CONFIG_ARCH_HAVE_PWM_PULSECOUNT is not set
|
||||||
# CONFIG_PWM is not set
|
# CONFIG_PWM is not set
|
||||||
CONFIG_ARCH_HAVE_I2CRESET=y
|
CONFIG_ARCH_HAVE_I2CRESET=y
|
||||||
CONFIG_I2C=y
|
# CONFIG_I2C is not set
|
||||||
# CONFIG_I2C_SLAVE is not set
|
|
||||||
CONFIG_I2C_TRANSFER=y
|
|
||||||
CONFIG_I2C_WRITEREAD=y
|
|
||||||
# CONFIG_I2C_POLLED is not set
|
|
||||||
# CONFIG_I2C_TRACE is not set
|
|
||||||
CONFIG_I2C_RESET=y
|
|
||||||
# CONFIG_SPI is not set
|
# CONFIG_SPI is not set
|
||||||
# CONFIG_I2S is not set
|
# CONFIG_I2S is not set
|
||||||
CONFIG_RTC=y
|
CONFIG_RTC=y
|
||||||
@@ -492,7 +486,7 @@ CONFIG_RTC_DATETIME=y
|
|||||||
# CONFIG_WATCHDOG is not set
|
# CONFIG_WATCHDOG is not set
|
||||||
# CONFIG_TIMER is not set
|
# CONFIG_TIMER is not set
|
||||||
# CONFIG_ANALOG is not set
|
# CONFIG_ANALOG is not set
|
||||||
CONFIG_AUDIO_DEVICES=y
|
# CONFIG_AUDIO_DEVICES is not set
|
||||||
# CONFIG_VIDEO_DEVICES is not set
|
# CONFIG_VIDEO_DEVICES is not set
|
||||||
# CONFIG_BCH is not set
|
# CONFIG_BCH is not set
|
||||||
# CONFIG_INPUT is not set
|
# CONFIG_INPUT is not set
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -50,14 +50,23 @@
|
|||||||
# include <apps/usbmonitor.h>
|
# include <apps/usbmonitor.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <nuttx/fs/ramdisk.h>
|
||||||
#include <nuttx/binfmt/elf.h>
|
#include <nuttx/binfmt/elf.h>
|
||||||
|
|
||||||
#include "sama5d4-ek.h"
|
#include "sama5d4-ek.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_ROMFS
|
||||||
|
# include <arch/board/boot_romfsimg.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Pre-Processor Definitions
|
* Pre-Processor Definitions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
#define NSECTORS(n) \
|
||||||
|
(((n)+CONFIG_SAMA5D4EK_ROMFS_ROMDISK_SECTSIZE-1) / \
|
||||||
|
CONFIG_SAMA5D4EK_ROMFS_ROMDISK_SECTSIZE)
|
||||||
|
|
||||||
/* Debug ********************************************************************/
|
/* Debug ********************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_BOARD_INITIALIZE
|
#ifdef CONFIG_BOARD_INITIALIZE
|
||||||
@@ -86,7 +95,7 @@ int sam_bringup(void)
|
|||||||
{
|
{
|
||||||
#if defined(HAVE_NAND) || defined(HAVE_AT25) || defined(HAVE_HSMCI) || \
|
#if defined(HAVE_NAND) || defined(HAVE_AT25) || defined(HAVE_HSMCI) || \
|
||||||
defined(HAVE_USBHOST) || defined(HAVE_USBMONITOR) || defined(HAVE_WM8904) || \
|
defined(HAVE_USBHOST) || defined(HAVE_USBMONITOR) || defined(HAVE_WM8904) || \
|
||||||
defined(HAVE_AUTOMOUNTER) || defined(HAVE_ELF)
|
defined(HAVE_AUTOMOUNTER) || defined(HAVE_ELF) || defined(HAVE_ROMFS)
|
||||||
int ret;
|
int ret;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -178,6 +187,32 @@ int sam_bringup(void)
|
|||||||
sam_automount_initialize();
|
sam_automount_initialize();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_ROMFS
|
||||||
|
/* Create a ROM disk for the /etc filesystem */
|
||||||
|
|
||||||
|
ret = romdisk_register(CONFIG_SAMA5D4EK_ROMFS_ROMDISK_MINOR, romfs_img,
|
||||||
|
NSECTORS(romfs_img_len),
|
||||||
|
CONFIG_SAMA5D4EK_ROMFS_ROMDISK_SECTSIZE);
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
message("ERROR: romdisk_register failed: %d\n", -ret);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Mount the file system */
|
||||||
|
|
||||||
|
ret = mount(CONFIG_SAMA5D4EK_ROMFS_ROMDISK_DEVNAME,
|
||||||
|
CONFIG_SAMA5D4EK_ROMFS_MOUNT_MOUNTPOINT,
|
||||||
|
"romfs", MS_RDONLY, NULL);
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
message("ERROR: mount(%s,%s,romfs) failed: %d\n",
|
||||||
|
CONFIG_SAMA5D4EK_ROMFS_ROMDISK_DEVNAME,
|
||||||
|
CONFIG_SAMA5D4EK_ROMFS_MOUNT_MOUNTPOINT, errno);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_USBHOST
|
#ifdef HAVE_USBHOST
|
||||||
/* Initialize USB host operation. sam_usbhost_initialize() starts a thread
|
/* Initialize USB host operation. sam_usbhost_initialize() starts a thread
|
||||||
* will monitor for USB connection and disconnection events.
|
* will monitor for USB connection and disconnection events.
|
||||||
|
|||||||
@@ -69,6 +69,7 @@
|
|||||||
#define HAVE_AUDIO_NULL 1
|
#define HAVE_AUDIO_NULL 1
|
||||||
#define HAVE_PMIC 1
|
#define HAVE_PMIC 1
|
||||||
#define HAVE_ELF 1
|
#define HAVE_ELF 1
|
||||||
|
#define HAVE_ROMFS 1
|
||||||
|
|
||||||
/* HSMCI */
|
/* HSMCI */
|
||||||
/* Can't support MMC/SD if the card interface(s) are not enable */
|
/* Can't support MMC/SD if the card interface(s) are not enable */
|
||||||
@@ -462,6 +463,12 @@
|
|||||||
# undef HAVE_ELF
|
# undef HAVE_ELF
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* ROMFS */
|
||||||
|
|
||||||
|
#ifndef CONFIG_FS_ROMFS
|
||||||
|
# undef HAVE_ROMFS
|
||||||
|
#endif
|
||||||
|
|
||||||
/* LEDs *****************************************************************************/
|
/* LEDs *****************************************************************************/
|
||||||
/* There are 3 LEDs on the SAMA5D4-EK:
|
/* There are 3 LEDs on the SAMA5D4-EK:
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user