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

[script] refactor bootstrap and make-raspbian.bash #67

Conversation

lmnotran
Copy link
Contributor

@lmnotran lmnotran commented Aug 10, 2023

script/bootstrap.bash

I think the bootstrap script was originally taken from https://github.com/openthread/ot-br-posix/blob/main/tests/scripts/bootstrap.sh.

Most of the script isn't required since the OTBR build occurs in the mounted Raspberry Pi OS chroot, not the host machine. Within the Raspberry Pi OS chroot, the OTBR requirements are already being installed in script/otbr-setup.bash

This PR removes most of the unnecessary packages and also makes the bootstrap script more flexible, allowing smaller portions of the script to be run via command line arguments

Also, the download of RaspiOS has been moved to script/make-raspbian.bash

script/make-raspbian.bash

  • cleanup() has been refactored
    • Any running processes from $QEMU_ROOT are killed before unmounting
  • /etc/resolv.conf is mounted from the host into $QEMU_ROOT.
    • This is necessary for environments which block public DNS, such as in some corporate networks.
    • The host-machine's DNS configuration is not included in the output raspios image. Instead, the original /etc/resolv.conf from the raspios .img will be present in the output image

@lmnotran lmnotran changed the title Feature/use host dns configuration in rpi qemu [script] refactor bootstrap and make-raspbian.bash Aug 10, 2023
@lmnotran lmnotran force-pushed the feature/use-host-dns-configuration-in-rpi-qemu branch from c5f54e2 to c23d70c Compare August 10, 2023 18:43
This is necessary for environments which block public DNS, such as in some corporate networks.

The host-machine's DNS configuration is not included in the output raspios image.
@lmnotran lmnotran force-pushed the feature/use-host-dns-configuration-in-rpi-qemu branch 2 times, most recently from 3381a5a to 48cfce8 Compare August 15, 2023 03:13

# Mount /etc/resolv.conf
if [ -f "/etc/resolv.conf" ]; then
sudo mount -o ro,bind /etc/resolv.conf "$QEMU_ROOT"/etc/resolv.conf
Copy link
Contributor Author

@lmnotran lmnotran Aug 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is necessary for environments which block public DNS, such as in some corporate networks.

The host-machine's DNS configuration is not included in the output raspios image. Instead, the original /etc/resolv.conf from the raspios .img will be present in the output image

@lmnotran lmnotran force-pushed the feature/use-host-dns-configuration-in-rpi-qemu branch 2 times, most recently from 7ff3e71 to 48cfce8 Compare August 16, 2023 20:23
@lmnotran lmnotran force-pushed the feature/use-host-dns-configuration-in-rpi-qemu branch 3 times, most recently from fd86d19 to a22b3ed Compare August 17, 2023 20:16
@lmnotran lmnotran marked this pull request as ready for review August 17, 2023 20:56
Copy link
Member

@suveshpratapa suveshpratapa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lmnotran lmnotran force-pushed the feature/use-host-dns-configuration-in-rpi-qemu branch 3 times, most recently from e562796 to 2f31c9e Compare August 21, 2023 20:22
- Rename `repo_dir` to `OT_REFERENCE_RELEASE`
- Move raspios download into `make-raspbian.bash` instead of `bootstrap.bash`
- Add support for x-zipped raspios images
- Use DOCKER env var from host machine when running `script/otbr-setup.bash` in QEMU machine
`script/otbr-setup.bash` should fail and exit if there's a problem running `script/setup`
@lmnotran lmnotran force-pushed the feature/use-host-dns-configuration-in-rpi-qemu branch from 2f31c9e to 33bc086 Compare August 22, 2023 02:33
@lmnotran
Copy link
Contributor Author

@jwhui please review when you get a chance

Copy link
Member

@jwhui jwhui left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! 👍🏼

@jwhui jwhui merged commit f5838a6 into openthread:main Aug 22, 2023
2 checks passed
@lmnotran lmnotran deleted the feature/use-host-dns-configuration-in-rpi-qemu branch August 23, 2023 21:09
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

Successfully merging this pull request may close these issues.

4 participants