boards/x86/qemu/qemu-i486: Switch nsh/vga_fb from nsh to nxinit.

Aligns the qemu-i486 nsh and vga_fb defconfigs with the nxinit
migration already done for sim, rv-virt and qemu-armv8a:

- CONFIG_INIT_ENTRYPOINT/ENTRYNAME: "nsh_main" -> "init_main"
- CONFIG_SYSTEM_NXINIT=y, plus its dependencies CONFIG_EXPERIMENTAL,
  CONFIG_LIBC_EXECFUNCS, CONFIG_SCHED_HAVE_PARENT and
  CONFIG_SCHED_CHILD_STATUS
- CONFIG_ETC_ROMFS=y (CONFIG_FS_ROMFS was already enabled on both
  configs)
- New boards/x86/qemu/qemu-i486/src/etc/init.d/init.rc, identical in
  content to boards/arm64/qemu/qemu-armv8a/src/etc/init.d/init.rc
  (service console sh + restart_period 1000, started from `on init`
  under CONFIG_SYSTEM_NSH)
- src/Makefile: add init.rc to RCSRCS when CONFIG_ETC_ROMFS and
  CONFIG_SYSTEM_NXINIT are both set, matching qemu-armv8a's
  src/Makefile

This depends on the previous commit ("arch/x86: Add -P to CPP to
suppress linemarkers."): without it, the preprocessed init.rc that
Board.mk feeds to nxinit's parser at build time still contains GNU
linemarker lines and the parser rejects it with -EINVAL at boot. That
arch-level fix is otherwise independent and can be reverted on its
own without affecting other x86 boards.

qemu-i486 is 32-bit x86 with no romfs_img/romdisk_register/
romfs_boot/romfs_stub definitions anywhere under its board directory,
so it does not hit the romfs_img symbol collision that affects
qemu-intel64 (a separate board, tracked separately); i486 goes
straight from a clean ETC_ROMFS build to a working /etc mount.

Verified under QEMU (qemu-system-i386), both configs, host gcc -m32
(CROSSDEV is unset on Linux, ARCH_X86_M32=y already handles -m32):

nsh (-cpu 486 -m 2):
  nsh> ps
    TID   PID  PPID PRI POLICY   TYPE    NPX STATE    EVENT     SIGMASK            STACK COMMAND
      0     0     0   0 FIFO     Kthread   - Ready              0000000000000000 0002024 Idle_Task
      2     2     0 100 FIFO     Task      - Waiting  Semaphore 0000000000000000 0002004 init_main
      3     3     2 100 FIFO     Task      - Running            0000000000000000 0002012 sh
  nsh> mount
    /etc type romfs
    /proc type procfs
  nsh> free
        total       used       free    maxused    maxfree  nused  nfree name
       572784       9680     563104      10048     563104     52      1 Umem

vga_fb (-cpu 486 -m 1024 -vga std -serial stdio -display none): same
init_main/sh parent-child relationship, /etc romfs mounted, `fb`
framebuffer test completes ("Test finished"); free shows
551696/86832/464864 total/used/free (heavier due to LCD framebuffer
allocations, still well clear of CONFIG_RAM_SIZE=1048576).

ostest (third config on this board, INIT_ENTRYPOINT="ostest_main")
is out of scope and left untouched.

Assisted-by: Claude:claude-sonnet-5
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
This commit is contained in:
wangjianyu3 2026-09-17 02:02:56 +08:00 • committed by GUIDINGLI
parent 877ea4f8d8
commit 324c894bd2
5 changed files with 54 additions and 2 deletions

View file

@ -27,12 +27,15 @@ CONFIG_BOOT_RUNFROMEXTSRAM=y
CONFIG_BUILTIN=y
CONFIG_DEBUG_FULLOPT=y
CONFIG_DEBUG_SYMBOLS=y
CONFIG_ETC_ROMFS=y
CONFIG_EXAMPLES_HELLO=y
CONFIG_EXPERIMENTAL=y
CONFIG_FS_FAT=y
CONFIG_FS_PROCFS=y
CONFIG_FS_ROMFS=y
CONFIG_IDLETHREAD_STACKSIZE=2048
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INIT_ENTRYPOINT="init_main"
CONFIG_LIBC_EXECFUNCS=y
CONFIG_LINE_MAX=64
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_DISABLE_IFUPDOWN=y
@ -42,9 +45,12 @@ CONFIG_PTHREAD_MUTEX_TYPES=y
CONFIG_RAM_SIZE=1048576
CONFIG_RAM_START=0x00100000
CONFIG_READLINE_CMD_HISTORY=y
CONFIG_SCHED_CHILD_STATUS=y
CONFIG_SCHED_HAVE_PARENT=y
CONFIG_SCHED_WAITPID=y
CONFIG_START_DAY=3
CONFIG_START_MONTH=3
CONFIG_START_YEAR=2011
CONFIG_SYSTEM_NSH=y
CONFIG_SYSTEM_NXINIT=y
CONFIG_TESTING_OSTEST=y

View file

@ -28,15 +28,18 @@ CONFIG_BUILTIN=y
CONFIG_DEBUG_FULLOPT=y
CONFIG_DEBUG_SYMBOLS=y
CONFIG_DRIVERS_VIDEO=y
CONFIG_ETC_ROMFS=y
CONFIG_EXAMPLES_FB=y
CONFIG_EXAMPLES_HELLO=y
CONFIG_EXPERIMENTAL=y
CONFIG_FS_FAT=y
CONFIG_FS_PROCFS=y
CONFIG_FS_ROMFS=y
CONFIG_IDLETHREAD_STACKSIZE=2048
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INIT_ENTRYPOINT="init_main"
CONFIG_LCD=y
CONFIG_LCD_FRAMEBUFFER=y
CONFIG_LIBC_EXECFUNCS=y
CONFIG_LINE_MAX=64
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_DISABLE_IFUPDOWN=y
@ -47,10 +50,13 @@ CONFIG_QEMU_VGA=y
CONFIG_RAM_SIZE=1048576
CONFIG_RAM_START=0x00100000
CONFIG_READLINE_CMD_HISTORY=y
CONFIG_SCHED_CHILD_STATUS=y
CONFIG_SCHED_HAVE_PARENT=y
CONFIG_SCHED_WAITPID=y
CONFIG_START_DAY=3
CONFIG_START_MONTH=3
CONFIG_START_YEAR=2011
CONFIG_SYSTEM_NSH=y
CONFIG_SYSTEM_NXINIT=y
CONFIG_TESTING_OSTEST=y
CONFIG_VIDEO_FB=y

View file

@ -0,0 +1 @@
/etctmp*

View file

@ -28,4 +28,10 @@ ifeq ($(CONFIG_QEMU_VGA),y)
CSRCS += qemu_vga_lcd.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

View file

@ -0,0 +1,33 @@
/****************************************************************************
* boards/x86/qemu/qemu-i486/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