meta-phosphor/obmc-init.sh: fix panic when rwfs is full

mkdir -p $work will fail if rwfs partition is full, and then it will
cause overlayfs mount fail as well. Finally it cause kernel panic and
bmc fails to boot:

rofs = mtd4 squashfs rwfs = mtd5 jffs2
[    3.841846] jffs2: notice: (103) jffs2_build_xattr_subsystem: complete building xattr subsystem, 21 of xdatum (19 unchecked, 2 orphan) and 45 of xref (1 dead, 1 orphan) found.
mkdir: can't create directory 'run/initramfs/rw/work': No space left on device
[    9.022304] overlayfs: failed to resolve 'run/initramfs/rw/work': -2
mount: mounting cow on /root failed: No such file or directory
chroot: can't execute '/bin/sh': No such file or directory

Unable to confirm /sbin/init is an executable non-empty file
in merged file system mounted at /root.

Change Root test failed!
Fatal error, triggering kernel panic!
[    9.141777] Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000100
[    9.142489] CPU: 0 PID: 1 Comm: init Not tainted 5.10.36-60b3c9d #1
[    9.142667] Hardware name: Generic DT based system
[    9.142949] Backtrace:
[    9.144308] [<80915100>] (dump_backtrace) from [<809153a4>] (show_stack+0x20/0x24)
[    9.144623]  r7:80b08ed4 r6:60000093 r5:00000000 r4:80d71c9c
[    9.144816] [<80915384>] (show_stack) from [<80919b54>] (dump_stack+0x9c/0xb0)
[    9.144982] [<80919ab8>] (dump_stack) from [<80915824>] (panic+0x114/0x33c)
[    9.145136]  r7:80b08ed4 r6:80d0a970 r5:00000000 r4:80dbe378
[    9.145271] [<80915710>] (panic) from [<80126c14>] (do_exit+0x99c/0xa0c)
[    9.145426]  r3:00000001 r2:00000000 r1:00000100 r0:80b08ed4
[    9.145552]  r7:ffffe000
[    9.145632] [<80126278>] (do_exit) from [<80127cf0>] (do_group_exit+0x50/0xc8)
[    9.145787]  r7:000000f8
[    9.145863] [<80127ca0>] (do_group_exit) from [<80127d88>] (__wake_up_parent+0x0/0x30)
[    9.146034]  r7:000000f8 r6:00000004 r5:00000004 r4:010fd190
[    9.146185] [<80127d68>] (sys_exit_group) from [<80100060>] (ret_fast_syscall+0x0/0x54)
[    9.146425] Exception stack(0x810c5fa8 to 0x810c5ff0)
[    9.146745] 5fa0:                   010fd190 00000004 00000001 00000000 00000001 010fd190
[    9.147049] 5fc0: 010fd190 00000004 00000004 000000f8 00000000 00000000 004e4a84 00000000
[    9.147295] 5fe0: 004e4b40 7ec93a04 00474048 76df4a54
[    9.147959] CPU1: stopping
[    9.148650] CPU: 1 PID: 0 Comm: swapper/1 Not tainted 5.10.36-60b3c9d #1
[    9.148957] Hardware name: Generic DT based system
[    9.149264] Backtrace:
[    9.150182] [<80915100>] (dump_backtrace) from [<809153a4>] (show_stack+0x20/0x24)
[    9.150598]  r7:00000001 r6:60070193 r5:00000000 r4:80d71c9c
[    9.150878] [<80915384>] (show_stack) from [<80919b54>] (dump_stack+0x9c/0xb0)
[    9.151149] [<80919ab8>] (dump_stack) from [<8010f1f4>] (do_handle_IPI+0x2f8/0x32c)
[    9.151430]  r7:00000001 r6:0d15a000 r5:00000001 r4:80dbe278
[    9.151649] [<8010eefc>] (do_handle_IPI) from [<8010f250>] (ipi_handler+0x28/0x30)
[    9.151925]  r9:810f6000 r8:81080800 r7:00000001 r6:0d15a000 r5:81084b80 r4:00000014
[    9.152205] [<8010f228>] (ipi_handler) from [<80184754>] (handle_percpu_devid_fasteoi_ipi+0x80/0x154)
[    9.152536] [<801846d4>] (handle_percpu_devid_fasteoi_ipi) from [<8017dce4>] (__handle_domain_irq+0x8c/0xe0)
[    9.152911]  r7:00000001 r6:00000000 r5:00000000 r4:80c6fbdc
[    9.153147] [<8017dc58>] (__handle_domain_irq) from [<80101348>] (gic_handle_irq+0x7c/0x90)
[    9.153508]  r9:810f6000 r8:8f80200c r7:80c6fbe8 r6:8f802000 r5:810f7f38 r4:80d0541c
[    9.153819] [<801012cc>] (gic_handle_irq) from [<80100b0c>] (__irq_svc+0x6c/0x90)
[    9.154168] Exception stack(0x810f7f38 to 0x810f7f80)
[    9.154541] 7f20:                                                       00000000 000195e0
[    9.154993] 7f40: 8ddcb144 8011ba00 810f6000 00000001 80d04d10 80d04d4c 80d9dfdc 80b0b4f0
[    9.155402] 7f60: 00000000 810f7f94 810f7f98 810f7f88 80108fd4 80108fd8 60070013 ffffffff
[    9.155762]  r9:810f6000 r8:80d9dfdc r7:810f7f6c r6:ffffffff r5:60070013 r4:80108fd8
[    9.156070] [<80108f90>] (arch_cpu_idle) from [<80926c68>] (default_idle_call+0x38/0x108)
[    9.156382] [<80926c30>] (default_idle_call) from [<80159894>] (do_idle+0xdc/0x148)
[    9.156676] [<801597b8>] (do_idle) from [<80159bd0>] (cpu_startup_entry+0x28/0x2c)
[    9.156974]  r9:410fc075 r8:8000406a r7:80dbe280 r6:10c0387d r5:00000001 r4:00000091
[    9.157275] [<80159ba8>] (cpu_startup_entry) from [<8010f7c0>] (secondary_start_kernel+0x15c/0x180)
[    9.157614] [<8010f664>] (secondary_start_kernel) from [<8010182c>] (__enable_mmu+0x0/0x14)
[    9.157919]  r5:00000051 r4:810e006a

Fix this by not removing workdir directly, but keeping the directory
and removing all entires under it. We will still get below warning,
but it can boot to shell and provide ssh access to give a chance of
recovery.

[    9.519053] overlayfs: failed to create directory run/initramfs/rw/work/work (errno: 28); mounting read-only

Also update related patch file in meta-google to avoid build failure.

Signed-off-by: Heyi Guo <guoheyi@linux.alibaba.com>
Change-Id: I69c640c70ee3e9d1133b7d61d391501616c229d6
2 files changed
tree: f5632d5495b250c98a30c17c9d5c0b61afc59ac9
  1. .github/
  2. meta-amd/
  3. meta-ampere/
  4. meta-aspeed/
  5. meta-asrock/
  6. meta-bytedance/
  7. meta-evb/
  8. meta-facebook/
  9. meta-fii/
  10. meta-google/
  11. meta-hpe/
  12. meta-ibm/
  13. meta-ingrasys/
  14. meta-inspur/
  15. meta-intel-openbmc/
  16. meta-inventec/
  17. meta-nuvoton/
  18. meta-openembedded/
  19. meta-openpower/
  20. meta-phosphor/
  21. meta-qualcomm/
  22. meta-quanta/
  23. meta-raspberrypi/
  24. meta-security/
  25. meta-supermicro/
  26. meta-tyan/
  27. meta-wistron/
  28. meta-yadro/
  29. poky/
  30. .eslintrc.json
  31. .gitignore
  32. .gitreview
  33. .templateconf
  34. openbmc-env
  35. OWNERS
  36. README.md
  37. setup
README.md

OpenBMC

Build Status

OpenBMC is a Linux distribution for management controllers used in devices such as servers, top of rack switches or RAID appliances. It uses Yocto, OpenEmbedded, systemd, and D-Bus to allow easy customization for your platform.

Setting up your OpenBMC project

1) Prerequisite

See the Yocto documentation for the latest requirements

Ubuntu

$ sudo apt install git python3-distutils gcc g++ make file wget \
    gawk diffstat bzip2 cpio chrpath zstd lz4 bzip2

Fedora

$ sudo dnf install git python3 gcc g++ gawk which bzip2 chrpath cpio
hostname file diffutils diffstat lz4 wget zstd rpcgen patch

2) Download the source

git clone https://github.com/openbmc/openbmc
cd openbmc

3) Target your hardware

Any build requires an environment set up according to your hardware target. There is a special script in the root of this repository that can be used to configure the environment as needed. The script is called setup and takes the name of your hardware target as an argument.

The script needs to be sourced while in the top directory of the OpenBMC repository clone, and, if run without arguments, will display the list of supported hardware targets, see the following example:

$ . setup <machine> [build_dir]
Target machine must be specified. Use one of:

bletchley               mihawk                  swift
dl360poc                mori                    tatlin-archive-x86
e3c246d4i               mtjade                  tiogapass
ethanolx                nicole                  transformers
evb-ast2500             olympus-nuvoton         vegman-n110
evb-ast2600             on5263m5                vegman-rx20
evb-npcm750             p10bmc                  vegman-sx20
f0b                     palmetto                witherspoon
fp5280g2                quanta-q71l             witherspoon-tacoma
g220a                   romulus                 x11spi
gbs                     s2600wf                 yosemitev2
gsj                     s6q                     zaius
kudo                    s7106
lannister               s8036

Once you know the target (e.g. romulus), source the setup script as follows:

. setup romulus

4) Build

bitbake obmc-phosphor-image

Additional details can be found in the docs repository.

OpenBMC Development

The OpenBMC community maintains a set of tutorials new users can go through to get up to speed on OpenBMC development out here

Build Validation and Testing

Commits submitted by members of the OpenBMC GitHub community are compiled and tested via our Jenkins server. Commits are run through two levels of testing. At the repository level the makefile make check directive is run. At the system level, the commit is built into a firmware image and run with an arm-softmmu QEMU model against a barrage of CI tests.

Commits submitted by non-members do not automatically proceed through CI testing. After visual inspection of the commit, a CI run can be manually performed by the reviewer.

Automated testing against the QEMU model along with supported systems are performed. The OpenBMC project uses the Robot Framework for all automation. Our complete test repository can be found here.

Submitting Patches

Support of additional hardware and software packages is always welcome. Please follow the contributing guidelines when making a submission. It is expected that contributions contain test cases.

Bug Reporting

Issues are managed on GitHub. It is recommended you search through the issues before opening a new one.

Questions

First, please do a search on the internet. There's a good chance your question has already been asked.

For general questions, please use the openbmc tag on Stack Overflow. Please review the discussion on Stack Overflow licensing before posting any code.

For technical discussions, please see contact info below for Discord and mailing list information. Please don't file an issue to ask a question. You'll get faster results by using the mailing list or Discord.

Features of OpenBMC

Feature List

  • Host management: Power, Cooling, LEDs, Inventory, Events, Watchdog
  • Full IPMI 2.0 Compliance with DCMI
  • Code Update Support for multiple BMC/BIOS images
  • Web-based user interface
  • REST interfaces
  • D-Bus based interfaces
  • SSH based SOL
  • Remote KVM
  • Hardware Simulation
  • Automated Testing
  • User management
  • Virtual media

Features In Progress

  • OpenCompute Redfish Compliance
  • Verified Boot

Features Requested but need help

  • OpenBMC performance monitoring

Finding out more

Dive deeper into OpenBMC by opening the docs repository.

Technical Steering Committee

The Technical Steering Committee (TSC) guides the project. Members are:

  • Roxanne Clarke, IBM
  • Nancy Yuen, Google
  • Sai Dasari, Facebook
  • Terry Duncan, Intel
  • Sagar Dharia, Microsoft
  • Samer El-Haj-Mahmoud, Arm

Contact