Android does not start after changing init.rc

I want to start a script upon boot of Android and therefore I modified init.rc to include my init.additional.rc script (I use my own script, because potentially there will be more things to start and I want to keep them seperate).
In init.rc, I add

import /init.additional.rc

Building init.additional.rc into the root directory works, init.additional.rc only contains a comment right now.
However, as soon as I add the import statement to init.rc, build the whole system and flash the images, the board does not boot anymore (it does not reach the boot animation).

Furthermore, removing the import, deleting the generated images and rebuilding the system does not bring it back to life. The only thing that works is clearing the out directory and rebuilding the whole system from scratch.

As far as I understand it, the root directory is part of the ramdisk.img, which itself is part of the boot.img and is flashed by fastboot flash boot boot.img. Is that correct?
Is there anything I am missing?

Interestingly, only adding a comment to init.rc directly works as expected. Android still boots and the root directory contains the correct init.rc including the comment. But as soon as I add a service definition to init.rc, it hangs during boot, again.

The easier way to debug this kind of issue is to get the console/UART ouput? Do you have an adapter?

Correct.

You can even check initrd content with:

abootimg -x boot.img
mkdir initrd && cd initrd
cat ../initrd.img | gunzip | cpio -vid

Unfortunately, I dont have an adapter. But nice tip checking the content of the boot.img! It all looks good in there, both init.rc and init.additional.rc have the expected content.

I just made another interesting observation: If I flash only a different system.img (one from a previous built), the system boots up just fine with the adapted init.rc. So somehow the system.img seems to be the problem and not the boot.img.
Just to clarify, I changed the init.rc in the following location: system/core/rootdir/init.rc.

The ‘right’ way is to edit/add your init script into device/linaro/hikey and then add it to the target makefile (hikey960/device-hikey960.mk). You should not edit system/core which is ‘generic’ to all android devices.
Basically, device directory is dedicated to target customization.

And then I import my script inside of /device/linaro/hikey/init.common.rc?

yes, that should work.

Although I do not understand why this problem has occurred, adding my import in init.common.rc seems to have solved the problem. @Loic Thank you for your support!