Re: [OpenWrt-Devel] Dynamically generate custom files before building?

2015-03-23 Thread Sami Olmari
There is tool for that in buildroot... run ./scripts/env or look wiki for
more info. It's for having multiple device profiles in one buildroot.

  Sami Olmari

On Mar 23, 2015 6:11 PM, "Nguyễn Hồng Quân"  wrote:
>>
>> Hello all
>>
>> If I want to build customized OpenWrt, I need to place all custom file
in files/ folder.
>> The problem is that a set of custom files can only be applied to 1
device, i.e /etc/config/wireless file for TP Link router can not be used
for D-Link.
>>
>> Is there any way that I can use a script to modify the default config
file for each target device, create the one in files/ folder before
building? Where can I find the default /etc/config/wireless target device?
>>
>> Thanks
>>
>> --
>> Quân
>> ***
>> * Nguyễn Hồng Quân*
>> * Y!M: ng_hquan_vn*
>> * Facebook: ng.hong.quan  *
>> * Web: quan.hoabinh.vn*
>> ***
>>
>> ___
>> openwrt-devel mailing list
>> openwrt-devel@lists.openwrt.org
>> https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
>>
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] Dynamically generate custom files before building?

2015-03-23 Thread nam228

Hi a Quan,

I think you should try to modify "openwrt/Makefile"
Add your own script  for target devices.
After that when compiling  run "make target=XX" or something like that.

Nam.

On 24/03/2015 00:10, Nguyễn Hồng Quân wrote:

Hello all

If I want to build customized OpenWrt, I need to place all custom file 
in files/ folder.
The problem is that a set of custom files can only be applied to 1 
device, i.e /etc/config/wireless file for TP Link router can not be 
used for D-Link.


Is there any way that I can use a script to modify the default config 
file for each target device, create the one in files/ folder before 
building? Where can I find the default /etc/config/wireless target device?


Thanks

--
Quân
***
* Nguyễn Hồng Quân *
* Y!M: ng_hquan_vn *
* Facebook: ng.hong.quan *
* Web: quan.hoabinh.vn    *
***


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] Dynamically generate custom files before building?

2015-03-23 Thread Christian Schoenebeck
For me a shell script is doing the job. Calling parameter is the target.
I use a separate configuration directory beside building directory.
I copy the correct files for the target into the files directory 
and the correct .config into building directory
and then call make. All inside the script.

Christian

Am 23.03.2015 um 17:10 schrieb Nguyễn Hồng Quân:
> Hello all
> 
> If I want to build customized OpenWrt, I need to place all custom file in 
> files/ folder.
> The problem is that a set of custom files can only be applied to 1 device, 
> i.e /etc/config/wireless file for TP Link router can not be used for D-Link.
> 
> Is there any way that I can use a script to modify the default config file 
> for each target device, create the one in files/ folder before building? 
> Where can I find the default /etc/config/wireless target device?
> 
> Thanks
> 
> -- 
> Quân
> ***
> * Nguyễn Hồng Quân*
> * Y!M: ng_hquan_vn*
> * Facebook: ng.hong.quan  *
> * Web: quan.hoabinh.vn *
> ***
> 
> 
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
> 
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] Dynamically generate custom files before building?

2015-03-24 Thread Jean-Michel Pouré - GOOZE
> I think you should try to modify "openwrt/Makefile" 
> Add your own script  for target devices.

I am thinking about moving to a Makefile also. 

Currently, my scripts look like this one :
*
#git clone git://git.openwrt.org/openwrt.git openwrt-ar71xx
cd openwrt-ar71xx

#echo "make dirclean"
#make dirclean

echo "git checkout"
git checkout master
git pull

echo "updating feeds"
./scripts/feeds update -a
./scripts/feeds install luci
./scripts/feeds install luci-proto-ipv6

echo "make defconfig"
rm -f .config
echo  >.config 'CONFIG_TARGET_ar71xx_generic_TLWR841=y'
echo  >>.config 'CONFIG_PACKAGE_luci=y'
echo  >>.config 'CONFIG_PACKAGE_luci-proto-ipv6=y'

make defconfig

echo "compiling"
make -j 5
*

Next thing I would like to test is create custom targets. I am not very
sure how to work. But basically, can define
CONFIG_TARGET_ar71xx_generic_TLWR841_myown

I read on the wiki there was also the ability to compile all package and
then use image builder to quickly build custom installers.

At one point, if you need to initialize dozens of routers and APs, you
probably want to use image builder.

Kind regards,
Gnutella
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] Dynamically generate custom files before building?

2015-03-24 Thread Nguyễn Hồng Quân
Hi

What I mean is each target device will have its own default config files.
I'm thinking about /etc/config/network and /etc/config/wireless.

I want to dynamically generate the custom files of those "network",
"wireless" and place in files/ folder. I want to find the default files,
modify it and copy to files/ folder. The modification will be set SSID, set
wireless password... Those actions are done by script.

The problem is I don't know where those default files are.


On Tue, Mar 24, 2015 at 12:11 PM, Christian Schoenebeck <
christian.schoeneb...@gmail.com> wrote:

> For me a shell script is doing the job. Calling parameter is the target.
> I use a separate configuration directory beside building directory.
> I copy the correct files for the target into the files directory
> and the correct .config into building directory
> and then call make. All inside the script.
>

If I cannot know where those default are. I may have to use this approach.

Thank nam228, when I look into the Makefile, I see it mentions "target"
folder. This may be a hint to look for.

-- 
Quân
***
* Nguyễn Hồng Quân*
* Y!M: ng_hquan_vn*
* Facebook: ng.hong.quan  *
* Web: quan.hoabinh.vn*
***
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] Dynamically generate custom files before building?

2015-03-24 Thread Sami Olmari
Why not use ./scripts/env with your own batchfile? It has all the things
you need for multiple hardware configurations on single buildroot... only
thing you need to do is automate it with bash-script etc...

Sami Olmari
On Mar 24, 2015 6:15 PM, "Nguyễn Hồng Quân"  wrote:

> Hi
>
> What I mean is each target device will have its own default config files.
> I'm thinking about /etc/config/network and /etc/config/wireless.
>
> I want to dynamically generate the custom files of those "network",
> "wireless" and place in files/ folder. I want to find the default files,
> modify it and copy to files/ folder. The modification will be set SSID, set
> wireless password... Those actions are done by script.
>
> The problem is I don't know where those default files are.
>
>
> On Tue, Mar 24, 2015 at 12:11 PM, Christian Schoenebeck <
> christian.schoeneb...@gmail.com> wrote:
>
>> For me a shell script is doing the job. Calling parameter is the target.
>> I use a separate configuration directory beside building directory.
>> I copy the correct files for the target into the files directory
>> and the correct .config into building directory
>> and then call make. All inside the script.
>>
>
> If I cannot know where those default are. I may have to use this approach.
>
> Thank nam228, when I look into the Makefile, I see it mentions "target"
> folder. This may be a hint to look for.
>
> --
> Quân
> ***
> * Nguyễn Hồng Quân*
> * Y!M: ng_hquan_vn*
> * Facebook: ng.hong.quan  *
> * Web: quan.hoabinh.vn*
> ***
>
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
>
>
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] Dynamically generate custom files before building?

2015-03-24 Thread Nguyễn Hồng Quân
Thank Jean-Michel

Your script has many valuable information

On Wed, Mar 25, 2015 at 12:11 AM, Jean-Michel Pouré - GOOZE <
jmpo...@gooze.eu> wrote:

> > I think you should try to modify "openwrt/Makefile"
> > Add your own script  for target devices.
>
> I am thinking about moving to a Makefile also.
>
> Currently, my scripts look like this one :
> *
> #git clone git://git.openwrt.org/openwrt.git openwrt-ar71xx
> cd openwrt-ar71xx
>
> #echo "make dirclean"
> #make dirclean
>
> echo "git checkout"
> git checkout master
> git pull
>
> echo "updating feeds"
> ./scripts/feeds update -a
> ./scripts/feeds install luci
> ./scripts/feeds install luci-proto-ipv6
>
> echo "make defconfig"
> rm -f .config
> echo  >.config 'CONFIG_TARGET_ar71xx_generic_TLWR841=y'
> echo  >>.config 'CONFIG_PACKAGE_luci=y'
> echo  >>.config 'CONFIG_PACKAGE_luci-proto-ipv6=y'
>
> make defconfig
>
> echo "compiling"
> make -j 5
> *
>
> Next thing I would like to test is create custom targets. I am not very
> sure how to work. But basically, can define
> CONFIG_TARGET_ar71xx_generic_TLWR841_myown
>
> I read on the wiki there was also the ability to compile all package and
> then use image builder to quickly build custom installers.
>
> At one point, if you need to initialize dozens of routers and APs, you
> probably want to use image builder.
>

About image builder, the wiki
http://wiki.openwrt.org/doc/howto/obtain.firmware.generate

*Image Generator* is the program that creates the OpenWrt firmware image
file. In the process of compiling OpenWrt
, *Image Generator* is coercively
created (compiled), because it is needed to eventually create the image
file. It is located in /openwrt/trunk/xxx and you can use it, to create
more image-files from the packages you obtained during compilation.

but I don't know what is "xxx" and also cannot find the "trunk" folder.
Could you please tell me where it is?
-- 
Quân
***
* Nguyễn Hồng Quân*
* Y!M: ng_hquan_vn*
* Facebook: ng.hong.quan  *
* Web: quan.hoabinh.vn*
***
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] Dynamically generate custom files before building?

2015-03-24 Thread Nguyễn Hồng Quân
Hi

On Wed, Mar 25, 2015 at 12:33 AM, Sami Olmari  wrote:

> Why not use ./scripts/env with your own batchfile? It has all the things
> you need for multiple hardware configurations on single buildroot... only
> thing you need to do is automate it with bash-script etc...
>
I tried the script:

$ ./scripts/env
Usage: ./scripts/env [options]  [arguments]
Commands:
help  This help text
list  List environments
clear Delete all environment and revert to flat config/files
new Create a new environment
switch  Switch to a different environment
delete  Delete an environment
rename   Rename the current environment
diff  Show differences between current state and environment
save  Save your changes to the environment
revertRevert your changes since last save

Options:


and I don't understand what it can do :-(

-- 
Quân
***
* Nguyễn Hồng Quân*
* Y!M: ng_hquan_vn*
* Facebook: ng.hong.quan  *
* Web: quan.hoabinh.vn*
***
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] Dynamically generate custom files before building?

2015-03-24 Thread Joseph Marlin
If I understand your question correctly, I think you'll find the default config 
files in: target/linux/your_architecture_here/base-files/etc/config/

Joseph Marlin

- Original Message -
From: "Nguyễn Hồng Quân" 
To: "Christian Schoenebeck" 
Cc: openwrt-devel@lists.openwrt.org
Sent: Tuesday, March 24, 2015 12:14:32 PM
Subject: Re: [OpenWrt-Devel] Dynamically generate custom files before   
building?

Hi 

What I mean is each target device will have its own default config files. I'm 
thinking about /etc/config/network and /etc/config/wireless. 

I want to dynamically generate the custom files of those "network", "wireless" 
and place in files/ folder. I want to find the default files, modify it and 
copy to files/ folder. The modification will be set SSID, set wireless 
password... Those actions are done by script. 

The problem is I don't know where those default files are. 


On Tue, Mar 24, 2015 at 12:11 PM, Christian Schoenebeck < 
christian.schoeneb...@gmail.com > wrote: 


For me a shell script is doing the job. Calling parameter is the target. 
I use a separate configuration directory beside building directory. 
I copy the correct files for the target into the files directory 
and the correct .config into building directory 
and then call make. All inside the script. 

If I cannot know where those default are. I may have to use this approach. 

Thank nam228, when I look into the Makefile, I see it mentions "target" folder. 
This may be a hint to look for. 

-- 
Quân 
*** 
* Nguyễn Hồng Quân * 
* Y!M: ng_hquan_vn * 
* Facebook: ng.hong.quan * 
* Web: quan.hoabinh.vn * 
*** 

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] Dynamically generate custom files before building?

2015-03-24 Thread Sami Olmari
isn't it quite self-explanatory? with "./scripts/env new " you
generate new profile, where you can then have own configs and own set of
files/ etc. So... 10 devices, 10 profiles, each having own settings and
files... You get the idea.

 Sami Olmari

On Tue, Mar 24, 2015 at 6:44 PM, Nguyễn Hồng Quân 
wrote:

> Hi
>
> On Wed, Mar 25, 2015 at 12:33 AM, Sami Olmari  wrote:
>
>> Why not use ./scripts/env with your own batchfile? It has all the things
>> you need for multiple hardware configurations on single buildroot... only
>> thing you need to do is automate it with bash-script etc...
>>
> I tried the script:
>
> $ ./scripts/env
> Usage: ./scripts/env [options]  [arguments]
> Commands:
> help  This help text
> list  List environments
> clear Delete all environment and revert to flat
> config/files
> new Create a new environment
> switch  Switch to a different environment
> delete  Delete an environment
> rename   Rename the current environment
> diff  Show differences between current state and
> environment
> save  Save your changes to the environment
> revertRevert your changes since last save
>
> Options:
>
>
> and I don't understand what it can do :-(
>
> --
> Quân
> ***
> * Nguyễn Hồng Quân*
> * Y!M: ng_hquan_vn*
> * Facebook: ng.hong.quan  *
> * Web: quan.hoabinh.vn*
> ***
>
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] Dynamically generate custom files before building?

2015-03-25 Thread Jean-Michel Pouré - GOOZE
Le mercredi 25 mars 2015 à 00:43 +0800, Nguyễn Hồng Quân a écrit :
> Your script has many valuable information

You are more than welcome.

Maybe we should create a page on the wiki to explain howto: create a
minimal Debian build environment, chroot, build. But I am not sure to
understand how to modify /etc files interactively and tweak some
important kernel modules (deactivate breakpoints, etc ...) or even use
GrSec.

Please report any progress and explain us how to do that.

Kind regards,
Gnutella
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] Dynamically generate custom files before building?

2015-03-25 Thread Jean-Michel Pouré - GOOZE
Le mercredi 25 mars 2015 à 00:10 +0200, Sami Olmari a écrit :
> isn't it quite self-explanatory?

Yes, but we don't know how these scripts work and need to read source
code. Apparently, it branches GIT. So what happens when we need to
upgrade to latest GIT. Furthermore, can you build several appliances at
the same time?

IMHO, I prefer to build a separate build root for each device and
rebuild each time using a script.

If you look at Debian build architecture, it is the idea: create a build
environment, chroot and build.

Kind regards,
Gnutella
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] Dynamically generate custom files before building?

2015-03-25 Thread Jo-Philipp Wich
Hi,

some architectures do not have any default files for wireless and
network in the repository. Those files are generated by scripts on first
boot.

The question is raised over and over again in the forums and on the
lists. The natural solution to your kind of objective is to write an
(files/)etc/uci-defaults/99_mystuff script which amends/modifies the
just generated files according to your needs.

This way you also do not need to maintain complete configurations for
each possible model you intend to cover, especially if the only actual
delta is a different SSID and setting a PSK.

Apart from that it is also possible to make a wireless config somewhat
generic by replacing the "option path" or "option macaddr" phy
identifier with "option phy phy0" - this way it would work across a
range of different models, assuming they all use mac80211.

The script approach would be something like that:

$ cat files/etc/uci-defaults/99_mysettings
#!/bin/sh

uci set wireless.radio0.channel=3
uci del wireless.radio0.disabled

uci set wireless.@wifi-iface[0].ssid="Foo Bar"
uci set wireless.@wifi-iface[0].encryption=psk2
uci set wireless.@wifi-iface[0].key="secr3t123"

# do we have a 5ghz radio?
if uci -q get wireless.radio1 >/dev/null; then
uci set wireless.radio1.channel=52
uci del wireless.radio1.disabled

uci set wireless.@wifi-iface[1].ssid="Foo Bar 5"
uci set wireless.@wifi-iface[1].encryption=psk2
uci set wireless.@wifi-iface[1].key="secr3t123"
fi

exit 0


etc.

HTH,
Jow
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] Dynamically generate custom files before building?

2015-03-25 Thread nam228

Thank Jo-Philipp Wich for sharing your knowledge.

In my case I'm using Barrier Breaker.
I modified this file :

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

Nam.

On 25/03/2015 19:36, Jo-Philipp Wich wrote:

Hi,

some architectures do not have any default files for wireless and
network in the repository. Those files are generated by scripts on first
boot.

The question is raised over and over again in the forums and on the
lists. The natural solution to your kind of objective is to write an
(files/)etc/uci-defaults/99_mystuff script which amends/modifies the
just generated files according to your needs.

This way you also do not need to maintain complete configurations for
each possible model you intend to cover, especially if the only actual
delta is a different SSID and setting a PSK.

Apart from that it is also possible to make a wireless config somewhat
generic by replacing the "option path" or "option macaddr" phy
identifier with "option phy phy0" - this way it would work across a
range of different models, assuming they all use mac80211.

The script approach would be something like that:

$ cat files/etc/uci-defaults/99_mysettings
#!/bin/sh

uci set wireless.radio0.channel=3
uci del wireless.radio0.disabled

uci set wireless.@wifi-iface[0].ssid="Foo Bar"
uci set wireless.@wifi-iface[0].encryption=psk2
uci set wireless.@wifi-iface[0].key="secr3t123"

# do we have a 5ghz radio?
if uci -q get wireless.radio1 >/dev/null; then
 uci set wireless.radio1.channel=52
 uci del wireless.radio1.disabled

 uci set wireless.@wifi-iface[1].ssid="Foo Bar 5"
 uci set wireless.@wifi-iface[1].encryption=psk2
 uci set wireless.@wifi-iface[1].key="secr3t123"
fi

exit 0


etc.

HTH,
Jow
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel