I tenei waahanga ka titiro ahau ki etahi o nga whiringa whakaritenga e hiahiatia ana e au. Ehara tenei i te rarangi katoa o nga mea e tukuna ana e buildroot, engari he tino mahi, kaore e hiahiatia he wawaotanga ki nga konae a buildroot ake.
Ma te whakamahi i te tikanga WAHO mo te whakarite
Engari ko tenei tikanga kaore i te tino watea, ina koa ka whakahou i te buildroot. He tikanga hei whakaoti i tenei raru rakau waho. Ko te mea nui ka taea e koe te penapena i te papa, nga whirihora, nga kete me etahi atu raarangi ki roto i te raarangi motuhake (hei tauira, ka whakamahi ahau i nga raarangi papaa hei tono i nga paanui ki nga paanui, etahi atu korero kei roto i te waahanga motuhake) ka whakaurua e buildroot ake ki era kei roto. tona whaiaronga.
Tuhipoka: ka taea e koe te whakakikorua i etahi rakau o waho i te wa kotahi, he tauira kei roto i te pukapuka buildroot
Hangaia he whaiaronga my_tree, kei te taha o te whaiaronga buildroot ka whakawhiti i ta maatau whirihoranga ki reira. Ko te putanga ko te hanganga kōnae e whai ake nei:
[alexey@alexey-pc my_tree]$ tree
.
├── board
│ └── my_x86_board
│ ├── bef_cr_fs_img.sh
│ ├── linux.config
│ ├── rootfs_overlay
│ └── users.txt
├── Config.in
├── configs
│ └── my_x86_board_defconfig
├── external.desc
├── external.mk
├── package
└── patches
6 directories, 7 files
Ka taea e koe te kite, i te nuinga o te waa ka whakahoki ano te hanganga i te hanganga o buildroot.
Whaiaronga poari kei roto nga konae motuhake mo ia papa i roto i ta maatau keehi:
- bef_cr_fs_img.sh he hōtuhi ka mahia i muri i te hanganga o te punaha konae, engari i mua i te whakangao ki nga whakaahua. Ka whakamahia e matou a muri ake nei
- linux.config - whirihoranga kernel
- rootfs_overlay - whaiaronga ki te whakakikorua ki runga ake o te punaha konae
- users.txt - he kōnae e whakaatu ana i nga kaiwhakamahi ka hangaia
Whaiaronga configs kei roto defconfig o a maatau papa. Kotahi noa ta matou.
mōkī - Putumōhio me a maatau kete. I te timatanga, kei roto i te buildroot nga whakaahuatanga me nga ture mo te hanga i te iti o nga kohinga. Hei muri ka taapirihia e matou te kaiwhakahaere matapihi icewm me te kaiwhakahaere takiuru kauwhata Slim i konei.
Pato — ka taea e koe te penapena pai i o papanga mo nga kete rereke. Ko etahi atu korero kei roto i te waahanga motuhake i raro nei.
Inaianei me taapiri i nga konae whakaahuatanga mo to tatou rakau-waho. E 3 nga konae te kawenga mo tenei: external.desc, Config.in, external.mk.
waho.desc kei roto te whakaahuatanga tuturu:
[alexey@alexey-pc my_tree]$ cat external.desc
name: my_tree
desc: My simple external-tree for article
Ko te rarangi tuatahi ko te taitara. I te wa kei te heke mai buildroot hanga he taurangi $(BR2_EXTERNAL_MY_TREE_PATH), me whakamahi ina whirihora i te huihuinga. Hei tauira, ko te ara ki te konae kaiwhakamahi ka taea te whakarite penei:
$(BR2_EXTERNAL_my_tree_PATH)/board/my_x86_board/users.txt
Ko te rarangi tuarua he whakaahuatanga poto, ka taea e te tangata te panui.
Config.in, waho.mk — nga konae hei whakaahua i nga kohinga taapiri. Ki te kore koe e taapiri i a koe ake kete, ka waiho noa enei konae. Mo tenei wa, ka mahia e matou.
Inaianei kua reri to tatou rakau-waho, kei roto te defconfig o to tatou papa me nga konae e hiahiatia ana. Haere ki te whaiaronga buildroot ka whakapūtā hei whakamahi i te rākau-waho:
[alexey@alexey-pc buildroot]$ make BR2_EXTERNAL=../my_tree/ my_x86_board_defconfig
#
# configuration written to /home/alexey/dev/article/ramdisk/buildroot/.config
#
[alexey@alexey-pc buildroot]$ make menuconfig
I te whakahau tuatahi ka whakamahia e matou te tautohetohe BR2_WAHO=../taku_rakau/, e tohu ana i te whakamahinga o te rakau o waho. Ka taea e koe te tohu i etahi rakau-waho hei whakamahi i te wa kotahi. I tenei keehi, me mahi kotahi noa koe, muri iho ka hangaia he konae putanga/.br-external.mk ka penapena korero mo te rakau-waho i whakamahia:
[alexey@alexey-pc buildroot]$ cat output/.br-external.mk
#
# Automatically generated file; DO NOT EDIT.
#
BR2_EXTERNAL ?= /home/alexey/dev/article/ramdisk/my_small_linux/my_tree
BR2_EXTERNAL_NAMES =
BR2_EXTERNAL_DIRS =
BR2_EXTERNAL_MKS =
BR2_EXTERNAL_NAMES += my_tree
BR2_EXTERNAL_DIRS += /home/alexey/dev/article/ramdisk/my_small_linux/my_tree
BR2_EXTERNAL_MKS += /home/alexey/dev/article/ramdisk/my_small_linux/my_tree/external.mk
export BR2_EXTERNAL_my_tree_PATH = /home/alexey/dev/article/ramdisk/my_small_linux/my_tree
export BR2_EXTERNAL_my_tree_DESC = My simple external-tree for article
He mea nui! Ko nga huarahi kei roto i tenei konae ka tino tuturu!
Kua puta mai he tuemi Kōwhiringa o waho i te tahua:
Kei roto i tenei tahuaroto a tatou kete mai i to tatou rakau-waho. Kei te putua tenei waahanga i tenei wa.
Inaianei he mea nui ake ma tatou ki te tuhi ano i nga huarahi e tika ana hei whakamahi i te rakau-waho.
Kia mahara kei roto i nga waahanga Hanga → Wāhi hei tiaki i te waahanga whirihora buildroot, ka puta he huarahi tino ki te defconfig kua tiakina. Ka hangaia i te wa e tohuhia ana te whakamahinga o te extgernal_tree.
Ka whakatikahia ano e matou nga huarahi i te waahanga whirihoranga Pūnaha. Mo te ripanga me nga kaiwhakamahi hanga:
$(BR2_EXTERNAL_my_tree_PATH)/board/my_x86_board/users.txt
I roto i te waahanga Kernel, hurihia te ara ki te whirihoranga kernel:
$(BR2_EXTERNAL_my_tree_PATH)/board/my_x86_board/linux.config
Inaianei ka whakamahia a maatau konae mai i a maatau rakau-waho i te wa o te huihuinga. Ina neke atu ki tetahi atu raarangi, ki te whakahou ranei i te buildroot, he iti noa nga raru.
Tāpiri whakakikorua pakiaka fs:
Ma tenei tikanga ka taea e koe te taapiri / whakakapi i nga konae kei roto i te punaha konae.
Mena kei te whakakikorua te konae fs, engari karekau i te whaainga, katahi ka taapirihia
Mena kei roto te konae i te whakakikorua fs pakiaka me te whainga, ka whakakapia.
Tuatahi, me whakarite te ara ki te pakiaka fs overlay dir. Ka mahia tenei i roto i te whirihoranga Pūnaha → Root filesystem overlay directory section:
$(BR2_EXTERNAL_my_tree_PATH)/board/my_x86_board/rootfs_overlay/
Inaianei kia hanga e rua nga konae.
[alexey@alexey-pc my_small_linux]$ cat my_tree/board/my_x86_board/rootfs_overlay/etc/hosts
127.0.0.1 localhost
127.0.1.1 my_small_linux
8.8.8.8 google-public-dns-a.google.com.
[alexey@alexey-pc my_small_linux]$ cat my_tree/board/my_x86_board/rootfs_overlay/new_file.txt
This is new file from overlay
Ko te konae tuatahi (my_tree/board/my_x86_board/rootfs_overlay/etc/hosts) ka whakakapi i te konae /etc/hosts i runga i te punaha kua oti. Ka taapirihia te konae tuarua (cat my_tree/board/my_x86_board/rootfs_overlay/new_file.txt).
Ka kohikohia ka tirohia e matou:
Te whakatinanatanga o nga tuhinga whakarite i nga waahanga rereke o te huihuinga punaha
I te nuinga o nga wa ka hiahia koe ki te mahi i etahi mahi i roto i te punaha konae i mua i te whakauru ki nga whakaahua.
Ka taea tenei i te waahanga whirihoranga Pūnaha:
Ko nga tuhinga tuatahi e rua ka mahia i muri i te hanganga o te punaha konae, engari i mua i te whakauru ki nga whakaahua. Ko te rereketanga ko te tuhinga fakeroot ka mahia i roto i te horopaki o te fakeroot, e whakataurite ana i te mahi hei kaiwhakamahi pakiaka.
Ko te tuhinga whakamutunga ka mahia i muri i te hanganga o nga whakaahua punaha. Ka taea e koe te mahi i etahi atu mahi i roto, hei tauira, kape i nga konae e tika ana ki te tūmau NFS, te hanga ranei i tetahi ahua o to rorohiko rorohiko.
Hei tauira, ka hanga e ahau he tuhinga ka tuhia te putanga me te ra hanga ki /etc/.
Tuatahi ka tohu ahau i te ara ki tenei konae i taku rakau-waho:
Na inaianei ko te tuhinga ake:
[alexey@alexey-pc buildroot]$ cat ../my_tree/board/my_x86_board/bef_cr_fs_img.sh
#!/bin/sh
echo "my small linux 1.0 pre alpha" > output/target/etc/mysmalllinux-release
date >> output/target/etc/mysmalllinux-release
I muri i te huihuinga, ka kite koe i tenei konae kei runga i te punaha.
I roto i te mahi, ka taea te nui te tuhi. Na reira, i roto i te tino kaupapa i whai ahau i tetahi huarahi tino pai ake:
- I hanga e ahau he whaiaronga (my_tree/board_my_x86_board/inside_fakeroot_scripts) kei reira nga tuhinga hei mahi, me nga tau rangatū. Hei tauira, 0001-add-my_small_linux-version.sh, 0002-clear-apache-root-dir.sh
- I tuhia e au he tuhinga (my_tree/board_my_x86_board/run_inside_fakeroot.sh) ka haere ki roto i tenei whaiaronga me te mahi raupapa i nga tuhinga kei roto.
- I tauwhāitihia tēnei hōtuhi i roto i ngā tautuhinga papa i roto i te whirihoranga Pūnaha -> Ko ngā hōtuhi ritenga kia rere ki roto i te taiao fakeroot ($(BR2_EXTERNAL_my_tree_PATH)/board/my_x86_board/run_inside_fakeroot.sh) wāhanga
Source: will.com