07-31-2016 07:26 PM
How to set up a custom script when the system starts in Petalinux2015.4.
I would like to make the system automatically complete some tasks when it starts, in the script defined. But I don't know where to write the script in petalinux2015.4
07-31-2016 11:40 PM
To have the PetaLinux build tools incorporate pre-build binary code, follow this general flow:
Below is an example of the modifications:
$(ROMFSINST) -d -p 0755 mystartup /etc/init.d/mystartup
$(ROMFSINST) -s /etc/init.d/mystartup /etc/rcS.d/S99mystartup
Note: The scripts in /etc/rcS.d/ run in alphabetical order.
03-05-2017 07:27 AM
I'm using PetaLinux 2016.04 and trying to get a custom script to run on startup.
Following the steps below, in step 2 I create an app (which I later do see when I run petalinux-config - c rootfs).
It seems it doesn't get created in <PETALINUX_PROJECT_DIR>/components/apps/<APP> but in<PETALINUX_PROJECT_DIR>/project-spec/meta-user/recipes-apps/<APP>
I place the script I want to run at startup in here, then update the Makefile as in the example (not as in step 4, I don't see a /build/linux/rootfs/targetroot/ folder).
APP = boot-scripts-my # Add any other object files to this list below APP_OBJS = boot-scripts-my.o all: build install build: $(APP) clean: .PHONY: install image install: $(APP) $(TARGETINST) -d -p 0755 mystartup /etc/init.d/mystartup $(TARGETINST) -s /etc/init.d/mystartup /etc/rc5.d/S99mystartup $(APP): $(APP_OBJS) $(CC) $(LDFLAGS) -o $@ $(APP_OBJS) $(LDLIBS)
But after booting this (on Zedboard), I don't see any mystartup script file in any subfolder of /etc/, and no boot-scripts-my either. (I know the Makefile is being read when I do petalinux-build, as it complained originally about an error in that file, which I then fixed.)
03-05-2017 09:03 AM