Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Customizing files when building sysupgrade image #60

Closed
1am opened this issue Dec 5, 2015 · 8 comments
Closed

Customizing files when building sysupgrade image #60

1am opened this issue Dec 5, 2015 · 8 comments

Comments

@1am
Copy link

1am commented Dec 5, 2015

Hello,

I wanted to ask about customization of the whole filesystem which will be created on a Carambola2 based device after re-flashing.

Long story short, I've made a prototype which is working well and wanted to transfer these settings to more devices, preferably in some automated way... From what I've found so far it's not possible to just make a complete copy of a working system and transfer it to another device. So right now I'm configuring the build process to create the sysupdate image which I need (with all the network, USB devices configured like they should) and I'm kind of stuck with the root filesystem.

After some more reading I've found that by default ImageBuilder will look for the file system structure in /files/ via OpenWRT wiki. The thing is that I can find multiple files subdirectories scattered all over the directories from the repo and build dirs, none of which resemble the final structure - some are missing /etc/config/network files while others contain only the file...
Looking a bit further I've decided to take a look at Arduino Yun ditribution repo which already contains the directory I'm looking for.

Given that I've made a bold assumption that the Carambola makefile was modified in that part to look elsewhere for the root file structure... So given all that, my humble question would be: how do I add/remove/edit file structure which will later be compiled into the openwrt-ar71xx-generic-carambola2-squashfs-sysupgrade.bin tp be used with sysupdate or Caraboot's usb recovery?

@mantas-p
Copy link
Contributor

mantas-p commented Dec 7, 2015

Hi,

Every package in OpenWRT can supply files/ directory for install to file-system, so normally rootfs contents will depend on packages you select. In your case, you can just put your customized files to <buildroot dir>/files/ and it will override any files from packages.

@1am
Copy link
Author

1am commented Dec 7, 2015

Thank you! I'll try it out later today.
What would be your suggested approach to have some unique per-device settings bundled with the image (eg. password)?

@mantas-p
Copy link
Contributor

mantas-p commented Dec 7, 2015

Well you can't have per-device settings in image, unless you generate separate image for every device. You can generate some settings with scripts on first boot (/etc/config/network is generated that way). MAC address is the only unique information per-device after flashing, but it's not good for generating passwords if you want them unpredictable.

@1am
Copy link
Author

1am commented Dec 7, 2015

Just to clarify, the buildroot directory is the root dir of the repository or build_dir which is created during the build process?

Where could I find the script for the /etc/config/network generation? I'm not planning to generate passwords with this but it might be good reference for learning how things are set up.

@mantas-p
Copy link
Contributor

mantas-p commented Dec 7, 2015

<buildroot dir> is root dir of repo (it's called carambola2 for this repo).

This script generates network config based on board info:

target/linux/ar71xx/base-files/etc/uci-defaults/02_network

@1am
Copy link
Author

1am commented Dec 7, 2015

Thank you! I've tested with custom /etc/banner and it worked.

@1am 1am closed this as completed Dec 7, 2015
@1am
Copy link
Author

1am commented Dec 8, 2015

If I'd want to add custom scripts executed like target/linux/ar71xx/base-files/etc/uci-defaults/02_network do they need to be placed in the same path (target/linux/ar71xx/base-files/etc/uci-defaults/) to be executed, or there's also some place for custom first boot?

Maybe there is some reference on the particular directories of the OpenWRT build repo / scripts? I can't find mich in the OpenWrt build system wiki

@mantas-p
Copy link
Contributor

You can place them either in target/linux/ar71xx/base-files/etc/uci-defaults/ or files/etc/uci-defaults/, they will end up in same place anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants