mirror of
https://github.com/apache/nuttx.git
synced 2026-10-10 07:40:27 +00:00
boards/x86_64/qemu-intel64: add nxinit /etc ROMFS support
Add etc/init.d/init.rc and build it into the /etc ROMFS for Make and CMake. The kernel-build romfs image uses the same ROM disk minor, so skip it with CONFIG_ETC_ROMFS and register it only with BUILD_KERNEL. Assisted-by: OpenCode:claude-sonnet-5 Kiro:claude-opus-5 Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
This commit is contained in:
parent
737edcb885
commit
4ac8b5b812
5 changed files with 61 additions and 2 deletions
1
boards/x86_64/qemu/qemu-intel64/src/.gitignore
vendored
Normal file
1
boards/x86_64/qemu/qemu-intel64/src/.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
/etctmp*
|
||||
|
|
@ -45,11 +45,25 @@ if(CONFIG_BUILD_KERNEL)
|
|||
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/romfs_boot.c)
|
||||
add_dependencies(board board_romfs)
|
||||
list(APPEND SRCS ${CMAKE_CURRENT_BINARY_DIR}/romfs_boot.c)
|
||||
elseif(CONFIG_BOARD_LATE_INITIALIZE)
|
||||
elseif(CONFIG_BOARD_LATE_INITIALIZE AND NOT CONFIG_ETC_ROMFS)
|
||||
# empty ROMFS placeholder, see Makefile
|
||||
list(APPEND SRCS romfs_stub.c)
|
||||
endif()
|
||||
|
||||
target_sources(board PRIVATE ${SRCS})
|
||||
|
||||
if(CONFIG_ETC_ROMFS AND CONFIG_SYSTEM_NXINIT)
|
||||
nuttx_add_romfs(
|
||||
NAME
|
||||
etc
|
||||
MOUNTPOINT
|
||||
etc
|
||||
RCSRCS
|
||||
etc/init.d/init.rc
|
||||
PATH
|
||||
${CMAKE_CURRENT_BINARY_DIR}/etc)
|
||||
|
||||
target_link_libraries(board PRIVATE romfs_etc)
|
||||
endif()
|
||||
|
||||
set_property(GLOBAL PROPERTY LD_SCRIPT "${NUTTX_BOARD_DIR}/scripts/qemu.ld")
|
||||
|
|
|
|||
|
|
@ -23,10 +23,19 @@
|
|||
include $(TOPDIR)/Make.defs
|
||||
|
||||
CSRCS = qemu_boot.c qemu_bringup.c qemu_net.c qemu_boardinit.c
|
||||
CSRCS += $(if $(wildcard romfs_boot.c), romfs_boot.c, romfs_stub.c)
|
||||
|
||||
ifneq ($(CONFIG_ETC_ROMFS),y)
|
||||
CSRCS += $(if $(wildcard romfs_boot.c), romfs_boot.c, romfs_stub.c)
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_BOARDCTL_RESET),y)
|
||||
CSRCS += qemu_reset.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ETC_ROMFS),y)
|
||||
ifeq ($(CONFIG_SYSTEM_NXINIT),y)
|
||||
RCSRCS += etc/init.d/init.rc
|
||||
endif
|
||||
endif
|
||||
|
||||
include $(TOPDIR)/boards/Board.mk
|
||||
|
|
|
|||
33
boards/x86_64/qemu/qemu-intel64/src/etc/init.d/init.rc
Normal file
33
boards/x86_64/qemu/qemu-intel64/src/etc/init.d/init.rc
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
/****************************************************************************
|
||||
* boards/x86_64/qemu/qemu-intel64/src/etc/init.d/init.rc
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#ifdef CONFIG_SYSTEM_NSH
|
||||
service console sh
|
||||
restart_period 1000
|
||||
#endif
|
||||
|
||||
on init
|
||||
#ifdef CONFIG_SYSTEM_NSH
|
||||
start console
|
||||
#endif
|
||||
|
|
@ -90,6 +90,7 @@ void board_late_initialize(void)
|
|||
|
||||
/* Create ROM disk for mount in nx_start_application */
|
||||
|
||||
#ifdef CONFIG_BUILD_KERNEL
|
||||
if (NSECTORS(romfs_img_len) > 1)
|
||||
{
|
||||
ret = romdisk_register(0, romfs_img, NSECTORS(romfs_img_len),
|
||||
|
|
@ -99,5 +100,6 @@ void board_late_initialize(void)
|
|||
ferr("ERROR: Failed to register romfs: %d\n", -ret);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue