aboutsummaryrefslogtreecommitdiffstats
path: root/package/devel/gdb/Makefile
blob: a3579969917ec144f65300eca60de2cec85adfcb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#
# Copyright (C) 2006-2016 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

include $(TOPDIR)/rules.mk

PKG_NAME:=gdb
PKG_VERSION:=10.2
PKG_RELEASE:=$(AUTORELEASE)

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=@GNU/gdb
PKG_HASH:=aaa1223d534c9b700a8bec952d9748ee1977513f178727e1bee520ee000b4f29

PKG_BUILD_PARALLEL:=1
PKG_INSTALL:=1
PKG_LICENSE:=GPL-3.0+
PKG_CPE_ID:=cpe:/a:gnu:gdb

include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/nls.mk

define Package/gdb/Default
  SECTION:=devel
  CATEGORY:=Development
  DEPENDS:=+!USE_MUSL:libthread-db $(ICONV_DEPENDS) $(INTL_DEPENDS)
  URL:=https://www.gnu.org/software/gdb/
endef

define Package/gdb
$(call Package/gdb/Default)
  TITLE:=GNU Debugger
  DEPENDS+=+libreadline +libncurses +zlib
endef

define Package/gdb/description
GDB, the GNU Project debugger, allows you to see what is going on `inside'
another program while it executes -- or what another program was doing at the
moment it crashed.
endef

define Package/gdbserver
$(call Package/gdb/Default)
  TITLE:=Remote server for GNU Debugger
endef

define Package/gdbserver/description
GDBSERVER is a program that allows you to run GDB on a different machine than the
one which is running the program being debugged.
endef

# XXX: add --disable-werror to prevent build failure with arm
CONFIGURE_ARGS+= \
	--with-system-readline \
	--with-system-zlib \
	--without-expat \
	--without-lzma \
	--disable-unit-tests \
	--disable-ubsan \
	--disable-sim \
	--disable-werror \
	--disable-source-highlight

CONFIGURE_VARS+= \
	ac_cv_search_tgetent="$(TARGET_LDFLAGS) -lncurses -lreadline"

TARGET_LDFLAGS+= \
	$(INTL_LDFLAGS) $(if $(INTL_FULL),-lintl) \
	-static-libstdc++ \
	-Wl,--gc-sections

define Build/Install
	$(MAKE) -C $(PKG_BUILD_DIR) \
		DESTDIR="$(PKG_INSTALL_DIR)" \
		CPPFLAGS="$(TARGET_CPPFLAGS)" \
		install-gdb install-gdbserver
endef

define Package/gdb/install
	$(INSTALL_DIR) $(1)/usr/bin
	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/gdb $(1)/usr/bin/
endef

define Package/gdbserver/install
	$(INSTALL_DIR) $(1)/usr/bin
	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/gdbserver $(1)/usr/bin/
endef

$(eval $(call BuildPackage,gdb))
$(eval $(call BuildPackage,gdbserver))
om">at your own risk. # # Changelog: # 2009-01-01 Henk.Vergonet at gmail.com # use strict; use Getopt::Std; use Compress::Zlib; my $version = "0.1"; my %arg = ( o => 'bcm963xx_fs_kernel', b => 'OpenWrt', c => '6348', s => 64, f => 0xbfc00000, x => 0x00010000, a => 0x80010000, e => 0x80010000, i => 2, ); my $prog = $0; $prog =~ s/^.*\///; getopts("r:k:o:lc:b:s:f:i:a:e:tpvh", \%arg); die "usage: $prog ~opts~ -r <file> : input rootfs file -k <file> : input kernel file -o <file> : output image file, default $arg{o} -l : littleendian system, default ".($arg{l} ? 'yes' : 'no')." -c <chipid> : default $arg{c} -b <boardid> : default $arg{b} -s <size_kb> : erase sise flash, default $arg{s} -f <baseaddr> : flash base, default ".sprintf('0x%x', $arg{f})." -x <cfelen> : length of cfe, default ".sprintf('0x%x', $arg{x})." -i : 2=dual image, default $arg{i} -a <loadaddr> : Kernel load address, default ".sprintf('0x%x', $arg{a})." -e <entryaddr>: Kernel entry address, default ".sprintf('0x%x', $arg{e})." -t : Prefix kernel with load,entry,size -p : Add a 'gOtO' partition -v : be more verbose -h : help, version $version EXAMPLES: $prog -k kern -r rootfs " if $arg{h} || !$arg{k} || !$arg{r}; sub Read_Image { open my $fh, $_[0] or die "open $_[0]: $!"; local $/; # Set input to "slurp" mode. my $buf = <$fh>; close $fh; return $buf; } sub Padlen { my $p = $_[0] % $_[1]; return ($p ? $_[1] - $p : 0); } sub Pad { my ($buf, $off, $bs) = @_[0..2]; $buf .= chr(255) x Padlen(length($buf) + $off, $bs); return $buf; } sub bcmImage { my ($k, $f) = @_[0..1]; my $tmp = $arg{x} + 0x100 + $arg{f}; # regular: rootfs+kernel my ($img, $fa, $ka) = ( $f.$k, $tmp, $tmp + length($f) ); # test: kernel+rootfs # my ($img, $fa, $ka) = ( $k.$f, $tmp + length($k), $tmp ); $fa = 0 unless length($f); my $hdr = pack("a4a20a14a6a16a2a10a12a10a12a10a12a10a2a2a74Na16", '6', 'LinuxInside', 'ver. 2.0', $arg{c}, $arg{b}, ($arg{l} ? '0' : '1'), length($img), '0', '0', $fa, length($f), $ka, length($k), ($arg{i}==2 ? '1' : '0'), '', # if 1, the image is INACTIVE; if 0, active '', ~crc32($k, crc32($f)), ''); $hdr .= pack('Na16', ~crc32($hdr), ''); printf "kernel at 0x%x length 0x%x(%u)\n", $ka, length($k), length($k) if $arg{v}; printf "rootfs at 0x%x length 0x%x(%u)\n", $fa, length($f), length($f) if $arg{v}; open(FO, ">$arg{o}"); print FO $hdr; print FO $img; close FO; } # MAIN my $kern = Read_Image $arg{k}; my $root = Read_Image $arg{r}; $kern = pack('NNN', $arg{a}, $arg{e}, length($kern)).$kern if $arg{t}; # specific fixup for the CFE that expects rootfs-kernel order if ($arg{p}) { $kern = Pad($kern, 0x10c, $arg{s} * 1024); my $dummy_root = pack('a4NN', 'gOtO', length($kern)+12, length($root)+Padlen(length($root), $arg{s} * 1024) ); $kern .= $root; $root = $dummy_root; } bcmImage($kern, $root);