license.c 724 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. * (C) Copyright 2007 by OpenMoko, Inc.
  3. * Author: Harald Welte <laforge@openmoko.org>
  4. *
  5. * SPDX-License-Identifier: GPL-2.0+
  6. */
  7. #include <common.h>
  8. /* Licenses/gpl-2.0.txt is currently 18092 bytes in size */
  9. #define LICENSE_MAX 20480
  10. #include <command.h>
  11. #include <malloc.h>
  12. #include <license.h>
  13. int do_license(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
  14. {
  15. char *dst = malloc(LICENSE_MAX);
  16. unsigned long len = LICENSE_MAX;
  17. if (!dst)
  18. return -1;
  19. if (gunzip(dst, LICENSE_MAX, license_gzip, &len) != 0) {
  20. printf("Error uncompressing license text\n");
  21. free(dst);
  22. return -1;
  23. }
  24. puts(dst);
  25. free(dst);
  26. return 0;
  27. }
  28. U_BOOT_CMD(
  29. license, 1, 1, do_license,
  30. "print GPL license text",
  31. ""
  32. );