Skip to content

emulated cfs build #52

@matthew-l-weber

Description

@matthew-l-weber

The ticket is to build cFS, add configs/apps to CPIO, and run in the emulated ARM system.

(cross building for a RPI hints for cmake config - nasa/cFS#383)

cd <folder with copilot demo>
make dev   ### drops you into container
sudo apt update && sudo apt install -y  vim git file wget make cmake
ELISA_DEMO=$(pwd)/elisa_emulation
mkdir -p $ELISA_DEMO && cd $ELISA_DEMO
[ ! -e "archive.tar" ] && wget "https://gitlab.com/api/v4/projects/61362364/packages/generic/minimal-linux-debug/1.0.0/archive.tar" -O archive.tar
tar xf archive.tar
tar xf aarch64-buildroot-linux-musl_sdk-buildroot.tar.gz
cd aarch64-buildroot-linux-musl_sdk-buildroot
./relocate-sdk.sh              # One time, unless you move the folder, you then have to re-run
#### Don't run this as having these set breaks the cfs make      . environment-setup        # Sets up tools in the shell.  Have to repeat if you close the shell

# <build stuff using environment variables set in "environment-setup">
cd $ELISA_DEMO
git clone http://github.com/nasa/cfs
cd cfs
cp cfe/cmake/sample_defs . -r
cp cfe/cmake/Makefile.sample Makefile
cp sample_defs/toolchain-arm-cortexa8_neon-linux-gnueabi.cmake sample_defs/toolchain-arm-linux-gun.cmake -a
vi sample_defs/toolchain-arm-linux-gun.cmake ###  update variables to point at cross toolchain and cross target of aarch64
vi sample_defs/target.cmake   ## setup cpu1 to arm-linux-gnu
make SIMULATION=arm-linux-gnu O=build-elisa prep
make SIMULATION=arm-linux-gnu O=build-elisa

# Once you have the apps and configs to add to the CPIO
cd $ELISA_DEMO
mkdir -p extracted_cpio && sudo gunzip -c rootfs.cpio.gz > rootfs.cpio_uncompressed
sudo cpio -i -R +0:+0 -n -F rootfs.cpio_uncompressed --make-directories --preserve-modification-time --no-absolute-filenames --directory=./extracted_cpio

# sudo Copy your stuff into ./extracted_cpio/
# sudo Adjust permissions

sh -c 'cd extracted_cpio && sudo find . | sudo cpio -H newc -o | gzip -c > ../rootfs.cpio.gz_new'

qemu-system-aarch64 -M virt -m 512M -cpu cortex-a57 -smp 4 -nographic -kernel Image -initrd rootfs.cpio.gz_new -append "root=/dev/ram0 console=ttyAMA0"    # 'ctrl-a x' to stop QEMU

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions